/**
*Text generated by Simple GUI Extension for BlueJ
*Update by Jeff Borland
*
*
**/
import javax.swing.UIManager.LookAndFeelInfo;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javax.swing.border.Border;
import java.awt.image.*;
import java.util.Scanner;
import javax.swing.*;
/**
*Description of project goes here
*Author
*
*
**/
public class GUI_BMI extends BorlandBase {
private JButton bmiButton;
private JLabel bmiLabel;
private BTextField bmiField;
private BTextField feetField;
private JLabel height2Label;
private JLabel heightLabel;
private JLabel inchesLabel;
private BTextField inchesField;
private JLabel poundsLabel;
private JLabel poundsField;
private JLabel outputLabel;
private BTextField weightField;
//Constructor
public void initialize(){
setWidth(500);
setHeight(400);
setScreenLayout(null);
setBackgroundColor(new Color(192,6,192));
bmiButton = new JButton();
bmiButton.setBounds(358,104,90,35);
bmiButton.setBackground(new Color(214,217,223));
bmiButton.setForeground(new Color(0,0,0));
bmiButton.setEnabled(true);
bmiButton.setFont(new Font("sansserif",0,12));
bmiButton.setText("Get BMI");
bmiButton.setVisible(true);
bmiLabel = new JLabel();
bmiLabel.setBounds(220,201,90,35);
bmiLabel.setBackground(new Color(214,217,223));
bmiLabel.setForeground(new Color(0,0,0));
bmiLabel.setEnabled(true);
bmiLabel.setFont(new Font("sansserif",0,12));
bmiLabel.setText("Your BMI");
bmiLabel.setVisible(true);
bmiField = new BTextField();
bmiField.setBounds(204,234,90,35);
bmiField.setBackground(new Color(255,255,255));
bmiField.setForeground(new Color(0,0,0));
bmiField.setEnabled(false);
bmiField.setFont(new Font("sansserif",0,12));
bmiField.setVisible(true);
feetField = new BTextField();
feetField.setBounds(176,14,90,35);
feetField.setBackground(new Color(255,255,255));
feetField.setForeground(new Color(0,0,0));
feetField.setEnabled(true);
feetField.setFont(new Font("sansserif",0,12));
feetField.setVisible(true);
height2Label = new JLabel();
height2Label.setBounds(44,19,90,35);
height2Label.setBackground(new Color(214,217,223));
height2Label.setForeground(new Color(0,0,0));
height2Label.setEnabled(true);
height2Label.setFont(new Font("sansserif",0,12));
height2Label.setText("Your height");
height2Label.setVisible(true);
heightLabel = new JLabel();
heightLabel.setBounds(44,105,90,35);
heightLabel.setBackground(new Color(214,217,223));
heightLabel.setForeground(new Color(0,0,0));
heightLabel.setEnabled(true);
heightLabel.setFont(new Font("sansserif",0,12));
heightLabel.setText("Your weight");
heightLabel.setVisible(true);
inchesLabel = new JLabel();
inchesLabel.setBounds(380,45,90,35);
inchesLabel.setBackground(new Color(214,217,223));
inchesLabel.setForeground(new Color(0,0,0));
inchesLabel.setEnabled(true);
inchesLabel.setFont(new Font("sansserif",0,12));
inchesLabel.setText("(inches)");
inchesLabel.setVisible(true);
inchesField = new BTextField();
inchesField.setBounds(358,14,90,35);
inchesField.setBackground(new Color(255,255,255));
inchesField.setForeground(new Color(0,0,0));
inchesField.setEnabled(true);
inchesField.setFont(new Font("sansserif",0,12));
inchesField.setVisible(true);
poundsLabel = new JLabel();
poundsLabel.setBounds(194,45,90,35);
poundsLabel.setBackground(new Color(214,217,223));
poundsLabel.setForeground(new Color(0,0,0));
poundsLabel.setEnabled(true);
poundsLabel.setFont(new Font("sansserif",0,12));
poundsLabel.setText("(feet)");
poundsLabel.setVisible(true);
poundsField = new JLabel();
poundsField.setBounds(194,137,90,35);
poundsField.setBackground(new Color(214,217,223));
poundsField.setForeground(new Color(0,0,0));
poundsField.setEnabled(true);
poundsField.setFont(new Font("sansserif",0,12));
poundsField.setText("(pounds)");
poundsField.setVisible(true);
weightField = new BTextField();
weightField.setBounds(176,104,90,35);
weightField.setBackground(new Color(255,255,255));
weightField.setForeground(new Color(0,0,0));
weightField.setEnabled(true);
weightField.setFont(new Font("sansserif",0,12));
weightField.setVisible(true);
outputLabel = new JLabel();
outputLabel.setBounds(44,300,390,35);
outputLabel.setBackground(new Color(214,217,223));
outputLabel.setForeground(new Color(0,0,0));
outputLabel.setEnabled(true);
outputLabel.setFont(new Font("sansserif",0,14));
outputLabel.setText("Enter your info to find your BMI");
outputLabel.setVisible(true);
//adding components to contentPane panel
addItem(bmiButton);
addItem(bmiLabel);
addItem(bmiField);
addItem(feetField);
addItem(height2Label);
addItem(heightLabel);
addItem(inchesLabel);
addItem(inchesField);
addItem(poundsLabel);
addItem(poundsField);
addItem(weightField);
addItem(outputLabel);
}
//If you would like something painted when program opens
public void paintScreen(Graphics g)
{
}
//For listening for a buttonPressed
public void buttonPressed (Component c)
{
if (c==bmiButton)
{
}
}
public static void main(String[] args){
try{ BorlandBase.main((BorlandBase)(new Object() { }.getClass().getEnclosingClass().newInstance())); }
catch (Exception e){e.printStackTrace();}
}
}
|