import java.awt.*; public class CantorTriangle extends Panel{ String s = "Cantor's Triangle"; int x=20; int y=50; public static void main(String[] args) { Frame f = new Frame(); f.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); }; }); CantorTriangle ut = new CantorTriangle(); ut.setSize(640,640); // same size as defined in the HTML APPLET f.add(ut); f.pack(); ut.init(); f.setSize(640,640 + 20); // add 20, seems enough for the Frame title, f.show(); } public void init() { add(new Button("Go")); } //How can I access g like in the applet? public void fillTriangle() { Polygon poly = new Polygon(); poly.addPoint(0, 0); poly.addPoint(20, 0); poly.addPoint(10, 16); g.fillPolygon(poly); } public void paint(Graphics g) { g.drawString(s, x,y); g.drawLine(x , y+2 , x+getFontMetrics(getFont()).stringWidth(s) , y+2 ); } }