import java.applet.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.util.*; import java.io.*; import java.net.*; public class DBJettJTApplet extends Applet implements ActionListener { Frame f; int newWinX, newWinY; Font btnFont; Font lblFont; int sizes[] = { 512, 640, 800, 1024 }; String sizeNames[] = { "Small", "Medium", "Large", "Huge" }; public void init() { btnFont = new Font("SansSerif", Font.BOLD, 14); lblFont = new Font("SansSerif", Font.ITALIC, 10); newWinX = 14; newWinY = 14; setLayout(new GridLayout(0,1,2,2)); setBackground(Color.white); Panel p1; Button btn; Label lbl; for(int i = 0; i < sizes.length; i++) { p1 = new Panel(); p1.setLayout(new FlowLayout(FlowLayout.LEFT)); btn = new Button(sizeNames[i]); btn.setFont(btnFont); btn.setActionCommand(sizeNames[i]); btn.addActionListener(this); p1.add(btn); lbl = new Label(" (" + sizes[i] + "x" + sizes[i] + ")", Label.RIGHT); lbl.setFont(lblFont); p1.add(lbl); add(p1); } } public void actionPerformed(ActionEvent e) { String nam = e.getActionCommand(); int i; for(i = 0; i < sizes.length; i++) { if (sizeNames[i].equals(nam)) break; } int siz = sizes[i]; String title = "DBJettFrJT " + nam + " Design ("; title += siz; title += "x" + siz; title += ")"; Frame f = new Frame(title); DBJettFrJT dp2 = new DBJettFrJT(); //f.add("Center", dp2); f.pack(); f.setResizable(false); f.setLocation(newWinX, newWinY); newWinX += 12; newWinY += 10; canvasesUp += 1; f.show(); f.setVisible(false); f.dispose(); // cp.applyPreset(0,false); } public int canvasesUp = 0; static Frame f2; static DBJettJTApplet sa; public static void main(String []args) { f2 = new Frame("DBJettFrJT"); sa = new DBJettJTApplet(); f2.add("Center",sa); f2.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { if (sa.canvasesUp > 0) { try { Toolkit.getDefaultToolkit().beep(); } catch (SecurityException se) { } } else f2.dispose(); System.exit(0); } }); sa.init(); sa.start(); f2.pack(); f2.show(); } }