Ejemplo n.º 1
0
 /**
  * Call this to add new toggle dialogs to the left button-list
  *
  * @param dlg The toggle dialog. It must not be in the list already.
  */
 public IconToggleButton addToggleDialog(final ToggleDialog dlg, boolean isExpert) {
   final IconToggleButton button = new IconToggleButton(dlg.getToggleAction(), isExpert);
   button.setShowHideButtonListener(dlg);
   button.setInheritsPopupMenu(true);
   dlg.setButton(button);
   toolBarToggle.add(button);
   allDialogs.add(dlg);
   allDialogButtons.add(button);
   button.applyButtonHiddenPreferences();
   if (dialogsPanel.initialized) {
     dialogsPanel.add(dlg);
   }
   return button;
 }
  private ImageWayPointDialog() {
    this.dialog =
        new ToggleDialog(
            tr("WayPoint Image"),
            "imagewaypoint",
            tr("Display non-geotagged photos"),
            Shortcut.registerShortcut(
                "subwindow:imagewaypoint",
                tr("Toggle: {0}", tr("WayPoint Image")),
                KeyEvent.VK_Y,
                Shortcut.ALT_SHIFT),
            200);

    this.previousAction = new PreviousAction();
    this.nextAction = new NextAction();
    this.rotateLeftAction = new RotateLeftAction();
    this.rotateRightAction = new RotateRightAction();

    final JButton previousButton = new JButton(this.previousAction);
    final JButton nextButton = new JButton(this.nextAction);
    final JButton rotateLeftButton = new JButton(this.rotateLeftAction);
    final JButton rotateRightButton = new JButton(this.rotateRightAction);

    // default layout, FlowLayout, is fine
    final JPanel buttonPanel = new JPanel();
    buttonPanel.add(previousButton);
    buttonPanel.add(nextButton);
    buttonPanel.add(rotateLeftButton);
    buttonPanel.add(rotateRightButton);

    final JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());

    this.imageDisplay = new ImageComponent();
    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
    mainPanel.add(this.imageDisplay, BorderLayout.CENTER);

    this.listener = new ImageChangeListener(this);
    ImageEntries.getInstance().addListener(this.listener);

    this.updateUI();
    dialog.add(mainPanel);
  }