コード例 #1
0
 public void show(Graphics g) {
   // System.out.println("Showing ...");
   Bar b = (Bar) getDisplayElement(s1);
   Rectangle r = new Rectangle(b.getLocation(), b.getSize());
   r.y += r.height;
   Rectangle r2 = ((TextElement) getDisplayElement(s5)).fitToRect(g, "SansSerif", Font.PLAIN, r);
   r2.y += r2.height;
   ((TextElement) getDisplayElement(s6)).fitToRect(g, "SansSerif", Font.PLAIN, r2);
   super.show(g);
 }
コード例 #2
0
 protected void computeGeometry() {
   Rectangle bg = mediumSquare(width, height);
   bg.y -= bg.height / 4;
   Rectangle f1 = innerRect(bg, 0.8);
   f1.y = (int) (bg.y + (bg.height - f1.height) * 0.75);
   Rectangle ce = innerRect(f1, 6.0 / 8.0);
   ce.y = (int) (f1.y + (f1.height - ce.height) * 0.75);
   Rectangle f2 = innerRect(ce, 2.0 / 3.0);
   f2.y = (int) (ce.y + (ce.height - f2.height) * 0.75);
   getDisplayElement(s1).setRect(bg.x, bg.y, bg.width, bg.height);
   getDisplayElement(s2).setRect(f1.x, f1.y, f1.width, f1.height);
   getDisplayElement(s3).setRect(ce.x, ce.y, ce.width, ce.height);
   getDisplayElement(s4).setRect(f2.x, f2.y, f2.width, f2.height);
 }