{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

BMIPanel - BMIPanel.java Computes body mass index in a GUI...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // BMIPanel.java // // Computes body mass index in a GUI. //******************************************************************** import java.awt.*; import java.awt.event.*; import javax.swing.*; public class BMIPanel extends JPanel { private int WIDTH = 300; private int HEIGHT = 120; private JLabel heightLabel, weightLabel, BMILabel, resultLabel; private JTextField height, weight; private JButton calculate; //----------------------------------------------------------------- // Sets up the GUI. //----------------------------------------------------------------- public BMIPanel() { //create labels for the height and weight textfields heightLabel = new JLabel ("Your height in inches: "); weightLabel = new JLabel ("Your weight in pounds: "); //create a "this is your BMI" label BMILabel = new JLabel ("This is your BMI: "); //create a result label to hold the BMI value resultLabel = new JLabel ("---"); //create a JTextField to hold the person's height in inches
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

BMIPanel - BMIPanel.java Computes body mass index in a GUI...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online