import javax.swing.JFrame; // This package will make available the JFrame class.
import java.awt.*; // This package makes the setBackground() method available.
import javax.swing.*; // creating labels and it displays infromation.
import java.awt.event.ActionEvent;// indicates that a component-defined action occurred.
import java.awt.event.ActionListener; // responsible for handling all action events. when the user clicks on a component
import java.util.Scanner;
import javax.swing.JOptionPane; // makes it easy to pop up a simple dialog box
import java.awt.event.*; // used for event handling
import javax.swing.JCheckBox; // checkbox
import java.util.Random;
import java.awt.Font;
public class WelcomePage
{
public static void main(String [] args)
{
JFrame myFrame = new JFrame("BMI Calculator");
myFrame.setVisible(true);
JLabel welcomeLabel = new JLabel("Welcome to BSIT BMI Calculator");
welcomeLabel.setBounds(160, 10, 350, 30);
welcomeLabel.setFont(new Font(null, Font.ITALIC, 20));
JLabel accessLabel = new JLabel("To access this program, kindly register using your personal information.");
accessLabel.setBounds(20, 50, 1000, 30);
JLabel fnLabel = new JLabel("First Name");
fnLabel.setBounds(60, 90, 350, 30);
JLabel label1 = new JLabel(":");
label1.setBounds(190, 90, 350, 30);
JTextField fnTextField = new JTextField();
fnTextField.setBounds(250, 90, 350, 30);
JLabel lnLabel = new JLabel("Last Name");
lnLabel.setBounds(60, 130, 350, 30);
JLabel label2 = new JLabel(":");
label2.setBounds(190, 130, 350, 30);
JTextField lnTextField = new JTextField();
lnTextField.setBounds(250, 130, 350, 30);
JLabel sexLabel = new JLabel("Sex");
sexLabel.setBounds(60, 170, 350, 30);
JLabel label3 = new JLabel(":");
label3.setBounds(190, 170, 350, 30);
String[] sex = {"Male", "Female"};
JComboBox sexComboBox = new JComboBox(sex);
sexComboBox.setBounds(250, 170, 350, 30);
//sexComboBox.addActionListener(this);
JLabel bdLabel = new JLabel("Birthday");
bdLabel.setBounds(60, 210, 350, 30);
JLabel label4 = new JLabel(":");
label4.setBounds(190, 210, 350, 30);
//JTextField bdTextField = new JTextField();
//bdTextField.setBounds(250, 180, 350, 30);
String[] month = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
JComboBox monthComboBox = new JComboBox(month);
monthComboBox.setBounds(250, 210, 80, 30);
JTextField dayTextField = new JTextField();
dayTextField.setBounds(350, 210, 80, 30);
JTextField yearTextField = new JTextField();
yearTextField.setBounds(450, 210, 80, 30);
JLabel addressLabel = new JLabel("Address");
addressLabel.setBounds(60, 250, 350, 30);
JLabel label5 = new JLabel(":");
label5.setBounds(190, 250, 350, 30);
JTextField addressTextField = new JTextField();
addressTextField.setBounds(250, 250, 350, 30);
JLabel phoneLabel = new JLabel("Phone Number");
phoneLabel.setBounds(60, 290, 350, 30);
JLabel label6 = new JLabel(":");
label6.setBounds(190, 290, 350, 30);
JTextField phoneTextField = new JTextField();
phoneTextField.setBounds(250, 290, 350, 30);
JLabel emailLabel = new JLabel("Email Address");
emailLabel.setBounds(60, 330, 350, 30);
JLabel label7 = new JLabel(":");
label7.setBounds(190, 330, 350, 30);
JTextField emailTextField = new JTextField();
emailTextField.setBounds(250, 330, 350, 30);
JLabel usernameLabel = new JLabel("Username");
usernameLabel.setBounds(60, 370, 350, 30);
JLabel label8 = new JLabel(":");
label8.setBounds(190, 370, 350, 30);
JTextField usernameTextField = new JTextField();
usernameTextField.setBounds(250, 370, 350, 30);
JLabel passwordLabel = new JLabel("Password");
passwordLabel.setBounds(60, 410, 350, 30);
JLabel label9 = new JLabel(":");
label9.setBounds(190, 410, 350, 30);
JPasswordField passwordField = new JPasswordField();
passwordField.setBounds(250, 410, 350, 30);
JButton submitButton = new JButton("Submit");
submitButton.setBounds(450, 455, 80, 30);
JButton clearButton = new JButton("Clear");
clearButton.setBounds(550, 455, 80, 30);
JLabel appearanceLabel = new JLabel("You can adjust the appearance of the system based on your preference.");
appearanceLabel.setBounds(150, 495, 500, 30);
JButton darkButton = new JButton("Dark");
darkButton.setBounds(250, 530, 80, 30);
JButton lightButton = new JButton("Light");
lightButton.setBounds(350, 530, 80, 30);
Cursor submitButtonCursor = new Cursor(Cursor.HAND_CURSOR);
submitButton.setCursor(submitButtonCursor);
Cursor clearButtonCursor = new Cursor(Cursor.HAND_CURSOR);
clearButton.setCursor(clearButtonCursor);
Cursor darkButtonCursor = new Cursor(Cursor.HAND_CURSOR);
darkButton.setCursor(darkButtonCursor);
Cursor lightButtonCursor = new Cursor(Cursor.HAND_CURSOR);
lightButton.setCursor(lightButtonCursor);
myFrame.add(welcomeLabel);
myFrame.add(accessLabel);
myFrame.add(fnLabel);
myFrame.add(label1);
myFrame.add(fnTextField);
myFrame.add(lnLabel);
myFrame.add(label2);
myFrame.add(lnTextField);
myFrame.add(sexLabel);
myFrame.add(label3);
myFrame.add(sexComboBox);
myFrame.add(bdLabel);
myFrame.add(label4);
//myFrame.add(bdTextField);
myFrame.add(monthComboBox);
myFrame.add(dayTextField);
myFrame.add(yearTextField);
myFrame.add(addressLabel);
myFrame.add(label5);
myFrame.add(addressTextField);
myFrame.add(phoneLabel);
myFrame.add(label6);
myFrame.add(phoneTextField);
myFrame.add(emailLabel);
myFrame.add(label7);
myFrame.add(emailTextField);
myFrame.add(usernameLabel);
myFrame.add(label8);
myFrame.add(usernameTextField);
myFrame.add(passwordLabel);
myFrame.add(label9);
myFrame.add(passwordField);
myFrame.add(submitButton);
myFrame.add(clearButton);
myFrame.add(appearanceLabel);
myFrame.add(darkButton);
myFrame.add(lightButton);
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//myFrame.setResizable(false);
myFrame.setSize(700, 620);
myFrame.setLayout(null);
submitButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
myFrame.dispose();
bmi b = new bmi();
}
});
clearButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
fnTextField.setText("");
lnTextField.setText("");
dayTextField.setText("");
yearTextField.setText("");
addressTextField.setText("");
phoneTextField.setText("");
emailTextField.setText("");
usernameTextField.setText("");
passwordField.setText("");
}
});
darkButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
Container colorcontain = myFrame.getContentPane();
colorcontain.setBackground(Color.BLACK);
}
});
lightButton.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
Container colorcontain = myFrame.getContentPane();
colorcontain.setBackground(Color.WHITE);
}
});
}
}