1 19 20 package jode.decompiler; 21 import java.awt.Color ; 22 import java.awt.Dimension ; 23 import java.awt.Graphics ; 24 import java.awt.Insets ; 25 26 public class Applet extends java.applet.Applet { 27 private final int BORDER = 10; 28 private final int BEVEL = 2; 29 private Window jodeWin = new Window(this); 30 private Insets myInsets; 31 private Color pageColor; 32 33 public Insets getInsets() { 44 if (myInsets == null) { 45 Insets appInsets = super.getInsets(); 46 myInsets = new Insets 48 (appInsets.top+BORDER, appInsets.left+BORDER, 49 appInsets.bottom+BORDER, appInsets.right+BORDER); 50 } 51 return myInsets; 52 } 53 54 public void paint(Graphics g) { 55 super.paint(g); 56 Color back = getBackground(); 57 Color bright = back.brighter(); 58 Color dark = back.darker(); 59 Dimension size = getSize(); 63 65 g.setColor(pageColor); 67 g.fillRect(0 , 0 , BORDER, BORDER); 68 g.fillRect(size.width - BORDER, 0 , BORDER, BORDER); 69 g.fillRect(size.width - BORDER, size.height - BORDER, BORDER, BORDER); 70 g.fillRect(0 , size.height - BORDER, BORDER, BORDER); 71 72 g.setColor(bright); 74 g.fillArc(0, 0, 75 2*BORDER, 2*BORDER, 90, 90); 76 g.fillArc(size.width - 2*BORDER, 0, 77 2*BORDER, 2*BORDER, 45, 45); 78 g.fillArc(0, size.height - 2*BORDER, 79 2*BORDER, 2*BORDER, 180, 45); 80 81 g.fillRect(BORDER, 0, size.width - 2*BORDER, BEVEL); 83 g.fillRect(0, BORDER, BEVEL, size.height - 2*BORDER); 84 85 g.setColor(dark); 87 g.fillArc(size.width - 2*BORDER, 0, 88 2*BORDER, 2*BORDER, 0, 45); 89 g.fillArc(0, size.height - 2*BORDER, 90 2*BORDER, 2*BORDER, 225, 45); 91 g.fillArc(size.width - 2*BORDER, size.height - 2*BORDER, 92 2*BORDER, 2*BORDER, -90, 90); 93 g.fillRect(BORDER, size.height - BEVEL, size.width - 2*BORDER, BEVEL); 94 g.fillRect(size.width - BEVEL, BORDER, BEVEL, size.height - 2*BORDER); 95 96 g.setColor(back); 98 g.fillArc(BEVEL, BEVEL, 99 2*(BORDER-BEVEL), 2*(BORDER-BEVEL), 90, 90); 100 g.fillArc(size.width - (2*BORDER-BEVEL), BEVEL, 101 2*(BORDER-BEVEL), 2*(BORDER-BEVEL), 0, 90); 102 g.fillArc(BEVEL, size.height - 2*BORDER + BEVEL, 103 2*(BORDER-BEVEL), 2*(BORDER-BEVEL), 180, 90); 104 g.fillArc(size.width - (2*BORDER-BEVEL), 105 size.height - (2*BORDER-BEVEL), 106 2*(BORDER-BEVEL), 2*(BORDER-BEVEL), -90, 90); 107 } 108 109 public void init() { 110 String colorstr = getParameter("pagecolor"); 111 if (colorstr == null) 112 colorstr = "ffffff"; 113 this.pageColor = new Color (Integer.parseInt(colorstr, 16)); 114 colorstr = getParameter("bgcolor"); 115 if (colorstr != null) 116 setBackground(new Color (Integer.parseInt(colorstr, 16))); 117 String cp = getParameter("classpath"); 118 if (cp != null) 119 jodeWin.setClassPath(cp); 120 String cls = getParameter("class"); 121 if (cls != null) 122 jodeWin.setClass(cls); 123 } 124 } 125 | Popular Tags |