Example #1
0
  /** inits GUI with labels of current language */
  public void initGUI() {
    geoTree.setFont(app.getPlainFont());

    boolean wasShowing = isShowing();
    if (wasShowing) {
      setVisible(false);
    }

    //	LIST PANEL
    JScrollPane listScroller = new JScrollPane(geoTree);
    listScroller.setMinimumSize(new Dimension(120, 200));
    listScroller.setBackground(geoTree.getBackground());
    listScroller.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));

    // delete button
    delButton = new JButton(app.getImageIcon("delete_small.gif"));
    delButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            deleteSelectedGeos();
          }
        });

    // apply defaults button
    defaultsButton = new JButton();
    defaultsButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            applyDefaults();
          }
        });

    closeButton = new JButton();
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            closeDialog();
          }
        });

    // build button panel with some buttons on the left
    // and some on the right
    JPanel buttonPanel = new JPanel(new BorderLayout());
    JPanel leftButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JPanel rightButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.add(rightButtonPanel, BorderLayout.EAST);
    buttonPanel.add(leftButtonPanel, BorderLayout.WEST);

    // left buttons
    if (app.letDelete()) leftButtonPanel.add(delButton);

    leftButtonPanel.add(defaultsButton);

    // right buttons
    rightButtonPanel.add(closeButton);

    // PROPERTIES PANEL
    if (colChooser == null) {
      // init color chooser
      colChooser = new GeoGebraColorChooser(app);
    }

    // check for null added otherwise you get two listeners for the colChooser
    // when a file is loaded
    if (propPanel == null) {
      propPanel = new PropertiesPanel(app, colChooser, false);
      propPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
    }
    selectionChanged(); // init propPanel

    // put it all together
    Container contentPane = getContentPane();
    contentPane.removeAll();
    // contentPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    JSplitPane splitPane = new JSplitPane();
    splitPane.setLeftComponent(listScroller);
    splitPane.setRightComponent(propPanel);

    contentPane.setLayout(new BorderLayout());
    contentPane.add(splitPane, BorderLayout.CENTER);
    contentPane.add(buttonPanel, BorderLayout.SOUTH);

    if (wasShowing) {
      setVisible(true);
    }

    setLabels();
  }