Пример #1
0
 /** Constructs a new TabCloseButton */
 public TabCloseButton() {
   this.setPreferredSize(new Dimension(this.size, this.size));
   this.setToolTipText(Settings.getLanguage().get("Close"));
   this.setUI(new BasicButtonUI());
   //				this.setContentAreaFilled( false );
   this.setFocusable(false);
   this.setBorder(BorderFactory.createEtchedBorder());
   this.setBorderPainted(false);
   // transparent background
   this.setBackground(new Color(0, 0, 0, 0));
 }
Пример #2
0
  /** The popup menu for the tabs. */
  protected class TabPopup extends JPopupMenu implements ActionListener {
    private JMenuItem tearOffMenuItem =
        new JMenuItem(Settings.getLanguage().get("Open in a new window"));
    private String tabTitle;
    private Component tabComponent;

    /** Constructs a new TabPopup */
    public TabPopup() {
      super();
      this.tearOffMenuItem.addActionListener(this);
      this.add(this.tearOffMenuItem);
    }

    /**
     * Displays the popup menu.
     *
     * @param invoker The Component which invoked this menu.
     * @param x The x coordinate of the location for this menu.
     * @param y The y coordinate of the location for this menu.
     * @param tabTitle The title of the tab which was clicked on.
     * @param tabComponent The component contained in the tab which was clicked on.
     */
    public void show(Component invoker, int x, int y, String tabTitle, Component tabComponent) {
      if (TabbedWindow.class.isAssignableFrom(
          ((JComponent) invoker).getTopLevelAncestor().getClass())) {
        this.tabTitle = tabTitle;
        this.tabComponent = tabComponent;
        this.show(invoker, x, y);
      }
    }

    /**
     * The actionPerformed method of the ActionListener interface.
     *
     * @param event The event which triggered this action.
     */
    public void actionPerformed(ActionEvent event) {
      Object source = event.getSource();
      if (source == this.tearOffMenuItem) {
        TabbedWindow top = (TabbedWindow) ((JComponent) this.getInvoker()).getTopLevelAncestor();
        TabbedWindow newWindow = top.newWindow();
        newWindow.addTab(this.tabTitle, this.tabComponent);
      }
    }
  }
Пример #3
0
 /** Creates an instance for the specified graph. */
 public MultipleCirclesLayout(Graph<V, E> g) {
   super(g);
   this.foldChange = Settings.getSettings().getDouble("preferences.correlation.foldChange", 2.0);
 }