RectangleProgramThree - widthTF = new JTextField(10);...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import javax.swing.*; import java.awt.*; public class RectangleProgramThree extends JFrame { private static final int WIDTH = 400; private static final int HEIGHT = 300; p private JLabel lengthL, widthL, areaL, perimeterL; p private JTextField lengthTF, widthTF, areaTF, perimeterTF; p public RectangleProgramThree() { { 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);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: widthTF = new JTextField(10); areaTF = new JTextField(10); perimeterTF = new JTextField(10); // This is creating the text boxes where you will be able to type in your values / Container pane = getContentPane(); pane.setLayout(new GridLayout(4, 2)); // This says that the grid will have 4 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); p setSize(WIDTH,HEIGHT); s setVisible(true); s setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(Stringargs); p RectangleProgramThree rectObject = new RectangleProgramThree(); }}...
View Full Document

Ask a homework question - tutors are online