Exemplo n.º 1
0
  public static void main(String[] args) {
    Display b1 = new StringDisplay("Hello, World.");
    Display b2 = new SideBorder(b1, '#');
    Display b3 = new FullBorder(b2);

    b1.show();
    b2.show();
    b3.show();

    Display b4 =
        new SideBorder(
            new FullBorder(
                new FullBorder(new SideBorder(new FullBorder(new StringDisplay("こんにちは。")), '*'))),
            '/');
    b4.show();
  }
 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);
 }