RectangleProgramFour - This is creating the text boxes...

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

View Full Document Right Arrow Icon
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class RectangleProgramFour extends JFrame { private JLabel lengthL, widthL, areaL, perimeterL; private JTextField lengthTF, widthTF, areaTF, perimeterTF; private JButton calculateB, exitB; private calculateButtonHandler cbHandler; private exitButtonHandler ebHandler; p private static final int WIDTH = 400; private static final int HEIGHT = 300; p public RectangleProgramFour() { setTitle("Jamel Jenkins 10/22/08"); s lengthL = new JLabel("Enter the length: ", SwingConstants.RIGHT); widthL = new JLabel ("Enter the width: ", SwingConstants.RIGHT); areaL = new JLabel ("Enter the area: ", SwingConstants.RIGHT); perimeterL = new JLabel ("Enter the perimeter: ", SwingConstants.RIGHT); // This is stating what will be displayed in the GUI\ / lengthTF = new JTextField(10); widthTF = new JTextField(10); areaTF = new JTextField(10); perimeterTF = new JTextField(10);
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // This is creating the text boxes where you will be able to type in your values / calculateB = new JButton("Calculate"); cbHandler = new calculateButtonHandler(); calulateB.addActionListener(cbHandler); c exitB = new JButton("Exit"); ebHandler = new exitButtonHandler(); exitB.addActionListener(ebHandler); e Container pane = getContentPane(); pane.setLayout(new GridLayout(5, 2)); // This says that the grid will have 5 rows and 2 columns / pane.add(lengthL); pane.add(lengthTF); pane.add(widthL); pane.add(widthTF); pane.add(areaL); pane.add(areaTF); pane.add(perimeterL); pane.add(perimeterTF); pane.add(calculateB); pane.add(exitB); p setSize(WIDTH,HEIGHT); s setVisible(true); s setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(Stringargs) { RectangleProgramFour rectObject = new RectangleProgramFour(); R System.exit(0); }}...
View Full Document

This note was uploaded on 10/04/2010 for the course COMPUTER S 106 taught by Professor Moore during the Spring '08 term at Clark Atlanta.

Page1 / 2

RectangleProgramFour - This is creating the text boxes...

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