
140
Chapter 8: Developing GUIs m
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
paraml = getParameter("firstlnt");
param2 = getParameter("secondlnt");
argl = Integer.parselnt(paraml);
arg2 = Integer.parselnt(param2);
result = argl * arg2;
cp = getContentPane();
Panel p = new Panel ();
cp.add(p);
class Panel extends JPanel {
public void paintComponent (java.awt.Graphics g) {
super.paintComponent(g);
resultString = Integer.toString(result);
g.drawString("The product of " + paraml + " and " +
param2 + " is " + resultString, 50, 100);
}
MultiplyApplet--Swing version
There are only a couple ...