/** Method declaration */
  private void initGUI() {

    Panel pQuery = new Panel();
    Panel pCommand = new Panel();

    pResult = new Panel();

    pQuery.setLayout(new BorderLayout());
    pCommand.setLayout(new BorderLayout());
    pResult.setLayout(new BorderLayout());

    Font fFont = new Font("Dialog", Font.PLAIN, 12);

    txtCommand = new TextArea(5, 40);

    txtCommand.addKeyListener(this);

    txtResult = new TextArea(20, 40);

    txtCommand.setFont(fFont);
    txtResult.setFont(new Font("Courier", Font.PLAIN, 12));

    butExecute = new Button("Execute");
    butClear = new Button("Clear");

    butExecute.addActionListener(this);
    butClear.addActionListener(this);
    pCommand.add("East", butExecute);
    pCommand.add("West", butClear);
    pCommand.add("Center", txtCommand);

    gResult = new Grid();

    setLayout(new BorderLayout());
    pResult.add("Center", gResult);
    pQuery.add("North", pCommand);
    pQuery.add("Center", pResult);
    fMain.add("Center", pQuery);

    tTree = new Tree();

    // (ulrivo): screen with less than 640 width
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

    if (d.width >= 640) {
      tTree.setMinimumSize(new Dimension(200, 100));
    } else {
      tTree.setMinimumSize(new Dimension(80, 100));
    }

    gResult.setMinimumSize(new Dimension(200, 300));
    fMain.add("West", tTree);
    doLayout();
    fMain.pack();
  }
  /**
   * I Layout sono 3 intanto Layout esterno: è di tipo Border e ordina banner a nord e tastiera a
   * sud Layout del banner: è di tipo Border e ordina messaggio e casella di testo Layout tastiera:
   * è ovviamente una grid.
   */
  public void init() { // DICHIARO GLI OGGETTI DELLA APPLET, DEI PANNELLI. LI AGGIUNGO A QUESTA

    setLayout(new BorderLayout());

    Panel banner = new Panel();
    banner.setLayout(new BorderLayout());
    banner.setBackground(Color.RED);

    Label titolo = new Label("benvenuto in pCalc");
    banner.add(titolo, BorderLayout.NORTH);

    TextField risultato = new TextField(30);
    banner.add(risultato, BorderLayout.SOUTH);

    Panel tastiera = new Panel();
    tastiera.setLayout(new GridLayout(3, 3));

    Button tasto0 = new Button("0");
    tastiera.add(tasto0);
    Button tasto1 = new Button("1");
    tastiera.add(tasto1);
    Button tasto2 = new Button("2");
    tastiera.add(tasto2);
    Button tasto3 = new Button("3");
    tastiera.add(tasto3);
    Button tasto4 = new Button("4");
    tastiera.add(tasto4);
    Button tasto5 = new Button("5");
    tastiera.add(tasto5);
    Button tasto6 = new Button("6");
    tastiera.add(tasto6);
    Button tasto7 = new Button("7");
    tastiera.add(tasto7);
    Button tasto8 = new Button("8");
    tastiera.add(tasto8);
    Button tasto9 = new Button("9");
    tastiera.add(tasto9);

    add(banner, BorderLayout.NORTH);
    add(tastiera, BorderLayout.SOUTH);
  }
Exemple #3
0
 public ListFrame(String title, int row, int col, Applet ma, boolean multiple, Font ft) {
   super();
   myApplet = ma;
   this.setTitle(title);
   setLayout(new BorderLayout());
   panel = new Panel();
   panel.setLayout(new FlowLayout(FlowLayout.LEFT));
   nLists = 1;
   list = new List[1];
   list[0] = new List(row, multiple);
   list[0].setFont(ft);
   panel.add(list[0]);
   add("Center", panel);
   this.setResizable(true);
   this.resize(minimumSize);
   selectedIndices = new int[1][];
 }
Exemple #4
0
 public ListFrame(String title, int[] row, int[] col, Applet ma, boolean multiple, Font ft) {
   super();
   myApplet = ma;
   this.setTitle(title);
   this.nLists = Math.min(row.length, col.length);
   setLayout(new BorderLayout());
   panel = new Panel();
   panel.setLayout(new BorderLayout());
   list = new List[nLists];
   for (int i = 0; i < nLists; i++) {
     list[i] = new List(row[i], multiple);
     list[i].setFont(ft);
   }
   add("North", list[0]);
   panel.add("Center", list[1]);
   add("Center", panel);
   this.setResizable(true);
   this.resize(minimumSize);
   selectedIndices = new int[nLists][];
 }
  public void init() {
    canvas = new RoadCanvas();
    slowdown = new Scrollbar(Scrollbar.HORIZONTAL, 0, 0, 0, 100);
    slowdown.setPageIncrement(10);
    slowdown.setValue(10);

    arrival = new Scrollbar(Scrollbar.HORIZONTAL, 0, 0, 0, 100);
    arrival.setPageIncrement(10);
    arrival.setValue(50);

    Panel p = new Panel();
    p.setLayout(new GridLayout(1, 6));
    p.add(new Label("Slowdown"));
    p.add(slowdown);
    p.add(new Label(""));
    p.add(new Label("Arrival"));
    p.add(arrival);
    p.add(new Label(""));
    setLayout(new BorderLayout());
    add("North", p);
    add("Center", canvas);
  }