Java Reference
In-Depth Information
lengthTF =
new
JTextField(10);
widthTF =
new
JTextField(10);
areaTF =
new
JTextField(10);
perimeterTF =
new
JTextField(10);
Container pane = getContentPane();
pane.setLayout(
new
GridLayout(4, 2));
pane.add(lengthL);
pane.add(lengthTF);
pane.add(widthL);
pane.add(widthTF);
pane.add(areaL);
pane.add(areaTF);
pane.add(perimeterL);
pane.add(perimeterTF);
setSize(WIDTH, HEIGHT);
setVisible(
true
);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void
main(String[] args)
{
RectangleProgramThree rectObject =
new
RectangleProgramThree();
}
}
Sample Run: (Figure 6-7 shows the sample run.)
FIGURE 6-7
Sample run for
RectangleProgramThree
To complete the design of the user interface, we will discuss how to create buttons.
Search WWH ::
Custom Search