示例#1
0
  /** Append a downward triangle image to the right hand side of an input icon. */
  @Override
  public void setIcon(Icon icon) {

    if (isFixedIcon) {
      super.setIcon(icon);
      return;
    }

    if (iconSize == null)
      if (icon != null) iconSize = new Dimension(icon.getIconWidth(), icon.getIconHeight());
      else iconSize = new Dimension(1, 1);

    if (icon == null) {
      // icon = GeoGebraIcon.createEmptyIcon(1, iconSize.height);
    } else {
      icon = GeoGebraIcon.ensureIconSize((ImageIcon) icon, iconSize);
    }

    // add a down_triangle image to the left of the icon
    if (icon != null)
      super.setIcon(
          GeoGebraIcon.joinIcons((ImageIcon) icon, app.getImageIcon("triangle-down.png")));
    else super.setIcon(app.getImageIcon("triangle-down.png"));
  }
  /**
   * Creates new ZoomMenu
   *
   * @param app
   * @param px
   * @param py
   */
  public ContextMenuGraphicsWindow(Application app, double px, double py) {
    this(app);

    iconZoom = app.getImageIcon("zoom16.gif");

    // zoom point
    this.px = px;
    this.py = py;

    EuclidianViewInterfaceCommon ev = app.getActiveEuclidianView();
    if (ev.getEuclidianViewNo() == 2) {
      setTitle("<html>" + app.getPlain("DrawingPad2") + "</html>");
    } else {
      setTitle("<html>" + app.getPlain("DrawingPad") + "</html>");
    }

    addAxesAndGridCheckBoxes();

    addSeparator();

    // zoom for both axes
    JMenu zoomMenu = new JMenu(app.getMenu("Zoom"));
    zoomMenu.setIcon(iconZoom);
    zoomMenu.setBackground(getBackground());
    addZoomItems(zoomMenu);
    add(zoomMenu);

    // zoom for y-axis
    JMenu yaxisMenu = new JMenu(app.getPlain("xAxis") + " : " + app.getPlain("yAxis"));
    yaxisMenu.setIcon(app.getEmptyIcon());
    yaxisMenu.setBackground(getBackground());
    addAxesRatioItems(yaxisMenu);
    add(yaxisMenu);

    JMenuItem miShowAllObjectsView = new JMenuItem(app.getPlain("ShowAllObjects"));
    miShowAllObjectsView.setIcon(app.getEmptyIcon());
    miShowAllObjectsView.setActionCommand("showAllObjects");
    miShowAllObjectsView.addActionListener(this);
    miShowAllObjectsView.setBackground(bgColor);
    add(miShowAllObjectsView);

    JMenuItem miStandardView = new JMenuItem(app.getPlain("StandardView"));
    setMenuShortCutAccelerator(miStandardView, 'M');
    miStandardView.setIcon(app.getEmptyIcon());
    miStandardView.setActionCommand("standardView");
    miStandardView.addActionListener(this);
    miStandardView.setBackground(bgColor);
    add(miStandardView);

    addSeparator();
    if (!ev.isZoomable()) {
      zoomMenu.setEnabled(false);
      yaxisMenu.setEnabled(false);
      miShowAllObjectsView.setEnabled(false);
      miStandardView.setEnabled(false);
    }

    if (ev.isUnitAxesRatio()) {
      yaxisMenu.setEnabled(false);
    }

    addMiProperties();
  }
示例#3
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();
  }