BMIPanel - /* / BMIPanel.java / / Computes body mass index...

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 DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.

Page1 / 2

BMIPanel - /* / BMIPanel.java / / Computes body mass index...

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

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