Exemplo n.º 1
0
  private void createButtons() {
    int iconSize = 16; // app.getScaledIconSize();

    int toggleSize = (int) Math.round(app.getScaledIconSize() * 0.75);
    // button to show/hide styling bar and the title panel buttons
    toggleStyleBarButton = new JButton();
    toggleStyleBarButton.addActionListener(this);
    toggleStyleBarButton.setFocusPainted(false);
    toggleStyleBarButton.setBorderPainted(false);
    toggleStyleBarButton.setContentAreaFilled(false);
    toggleStyleBarButton.setPreferredSize(new Dimension(toggleSize, toggleSize));
    toggleStyleBarButton.setRolloverEnabled(true);

    // button to show/hide styling bar if the title panel is invisible
    toggleStyleBarButton2 = new JButton();
    toggleStyleBarButton2.setFocusPainted(false);
    toggleStyleBarButton2.setBorderPainted(false);
    toggleStyleBarButton2.setContentAreaFilled(false);
    toggleStyleBarButton2.setPreferredSize(new Dimension(toggleSize, toggleSize));
    toggleStyleBarButton2.addActionListener(this);
    toggleStyleBarButton2.setRolloverEnabled(true);

    updateToggleStyleBarButtons();

    // button to insert the view in the main window
    unwindowButton = new JButton(app.getScaledIcon("view-unwindow.png"));
    unwindowButton.addActionListener(this);
    unwindowButton.setFocusPainted(false);
    unwindowButton.setContentAreaFilled(false);
    unwindowButton.setBorderPainted(false);
    unwindowButton.setPreferredSize(new Dimension(iconSize, iconSize));

    // button to insert the view in the main window
    unwindowButton2 = new JButton(app.getScaledIcon("view-unwindow.png"));
    unwindowButton2.addActionListener(this);
    unwindowButton2.setFocusPainted(false);
    unwindowButton2.setContentAreaFilled(false);
    unwindowButton2.setBorderPainted(false);
    unwindowButton2.setPreferredSize(new Dimension(iconSize, iconSize));

    // button to display the view in a separate window
    windowButton = new JButton(app.getScaledIcon("view-window.png"));
    windowButton.addActionListener(this);
    windowButton.setFocusPainted(false);
    windowButton.setContentAreaFilled(false);
    windowButton.setBorderPainted(false);
    windowButton.setPreferredSize(new Dimension(iconSize, iconSize));

    // button to close the view
    closeButton = new JButton(app.getScaledIcon("view-close.png"));
    closeButton.addActionListener(this);
    closeButton.setFocusPainted(false);
    closeButton.setPreferredSize(new Dimension(iconSize, iconSize));

    // button to toggle maximize/normal state
    maximizeButton = new JButton(app.getScaledIcon("view-maximize.png"));
    maximizeButton.addActionListener(this);
    maximizeButton.setFocusPainted(false);
    maximizeButton.setPreferredSize(new Dimension(iconSize, iconSize));
  }
Exemplo n.º 2
0
  public void updateIcons() {
    if (toggleStyleBarButton == null) {
      return;
    }
    int iconSize = app.getScaledIconSize();

    int toggleSize = (int) Math.round(app.getScaledIconSize() * 0.75);
    // button to show/hide styling bar and the title panel buttons
    toggleStyleBarButton.setPreferredSize(new Dimension(toggleSize, toggleSize));

    // button to show/hide styling bar if the title panel is invisible
    toggleStyleBarButton2.setPreferredSize(new Dimension(toggleSize, toggleSize));

    // button to insert the view in the main window
    unwindowButton.setIcon(app.getScaledIcon("view_unwindow.png"));
    unwindowButton.setPreferredSize(new Dimension(iconSize, iconSize));

    // button to insert the view in the main window
    unwindowButton2.setIcon(app.getScaledIcon("view_unwindow.png"));
    unwindowButton2.setPreferredSize(new Dimension(iconSize, iconSize));

    // button to display the view in a separate window
    windowButton.setIcon(app.getScaledIcon("view_window.png"));
    windowButton.setPreferredSize(new Dimension(iconSize, iconSize));

    // button to close the view
    closeButton.setIcon(app.getScaledIcon("view_close.png"));
    closeButton.setPreferredSize(new Dimension(iconSize, iconSize));

    // button to toggle maximize/normal state
    maximizeButton.setPreferredSize(new Dimension(iconSize, iconSize));

    if (isMaximized()) {
      maximizeButton.setIcon(app.getScaledIcon("view_unmaximize.png"));
    } else {
      maximizeButton.setIcon(app.getScaledIcon("view_maximize.png"));
    }
    updateToggleStyleBarButtons();
  }