Ejemplo n.º 1
0
 private void makeTabbedPane() {
   // tab 擺在上面,太多 tab 時使用捲頁的顯示方式
   tabbedPane = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
   tabbedPane.addChangeListener(changeController);
   tabbedPane.addMouseListener(mouseController);
   getContentPane().add(tabbedPane, BorderLayout.CENTER);
 }
Ejemplo n.º 2
0
  private JTabbedPane getJTabbedPane0() {
    if (jTabbedPane0 == null) {
      jTabbedPane0 = new JTabbedPane();
      jTabbedPane0.add(
          getJSplitPane0(), new Constraints(new Bilateral(7, 0, 39), new Bilateral(7, 0, 39)));
      jTabbedPane0.setTabPlacement(JTabbedPane.LEFT);
      jTabbedPane0.setFont(new Font("Arial", Font.PLAIN, 10));

      jTabbedPane0.setTitleAt(0, "<HTML> T<BR>a<BR>s<BR>k<BR>R<BR>e<BR>p<BR>o<BR>r<BR>r<BR>t<BR>");
      jTabbedPane0.addMouseListener(
          new MouseAdapter() {

            public void mouseEntered(MouseEvent event) {
              jTabbedPane0MouseMouseEntered(event);
            }

            public void mouseClicked(MouseEvent event) {
              jTabbedPane0MouseMouseClicked(event);
            }
          });
      jTabbedPane0.addMouseWheelListener(
          new MouseWheelListener() {

            public void mouseWheelMoved(MouseWheelEvent event) {
              jTabbedPane0MouseWheelMouseWheelMoved(event);
            }
          });
    }
    return jTabbedPane0;
  }
Ejemplo n.º 3
0
  public VTabbedToolPanel(SessionShare sshare, AppIF appIF) {
    // super( new BorderLayout() );
    this.sshare = sshare;
    this.appIF = appIF;
    this.tabbedToolPanel = new JPanel();
    this.pinPanel = this;
    this.selectedTabName = null;
    setPinObj(this.tabbedToolPanel);
    this.tabbedToolPanel.setLayout(new BorderLayout());
    this.tabbedPane = new JTabbedPane();
    panelName = "Tab Panel";
    setTitle(panelName);
    setName(panelName);

    tabbedPane.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            tabChanged();
            /**
             * ** the following was moved to tabChanged() if(tabbedPane.getTabCount() > 1 &&
             * Util.getRQPanel() != null) { int ind = tabbedPane.getSelectedIndex(); if(ind >= 0 &&
             * ind < tabbedPane.getTabCount())
             * Util.getRQPanel().updatePopup(tabbedPane.getTitleAt(ind)); } *********
             */
          }
        });

    // Add Mouse Listener for CSH
    MouseAdapter ml = new CSHMouseAdapter();
    tabbedPane.addMouseListener(ml);

    Object obj = sshare.userInfo().get("canvasnum");
    if (obj != null) {
      Dimension dim = (Dimension) obj;
      nviews = (dim.height) * (dim.width);
    } else nviews = 1;

    for (int i = 0; i < nviews; i++) tp_paneInfo[i] = new Hashtable();

    /*
    obj = sshare.userInfo().get("activeWin");
    if(obj != null) {
               vpId = ((Integer)obj).intValue();
    } else vpId = 0;
            */

    // System.out.println("VToolPanel nviews vpId "+nviews+" "+vpId);

    fillHashtable();
    Util.setVTabbedToolPanel(this);
    ParamInfo.addEditListener(this);
  }
Ejemplo n.º 4
0
  /** The constructor. */
  public FindDialog() {
    super(Translator.localize("dialog.find.title"), ArgoDialog.OK_CANCEL_OPTION, false);

    JPanel mainPanel = new JPanel(new BorderLayout());

    initNameLocTab();
    //        tabs.addTab(Translator.localize("dialog.find.tab.name-and-location"),
    //                nameLocTab);

    // penyaskito says: According to issue 2501, I have removed the tabs.
    //        initModifiedTab();
    //        tabs.addTab(Translator.localize("dialog.find.tab.last-modified"),
    //                modifiedTab);
    //        tabs.setEnabledAt(1, false);

    //        initTagValsTab();
    //        tabs.addTab(Translator.localize("dialog.find.tab.tagged-values"),
    //                tagValsTab);
    //        tabs.setEnabledAt(2, false);

    //        initConstraintsTab();
    //        tabs.addTab(Translator.localize("tab.constraints"),
    //		     constraintsTab);
    //        tabs.setEnabledAt(3, false);

    //        tabs.setMinimumSize(new Dimension(300, 250));

    //        JPanel north = new JPanel();
    //        north.setLayout(new BorderLayout());
    //        north.add(tabs, BorderLayout.CENTER);

    //        mainPanel.add(north, BorderLayout.NORTH);

    mainPanel.add(nameLocTab, BorderLayout.NORTH);

    initHelpTab();
    results.addTab(Translator.localize("dialog.find.tab.help"), help);
    mainPanel.add(results, BorderLayout.CENTER);

    search.addActionListener(this);
    results.addMouseListener(this);

    clearTabs.addActionListener(this);
    clearTabs.setEnabled(false);

    setContent(mainPanel);

    getOkButton().setEnabled(false);
  }
  public TabbedEditor(org.colos.ejs.osejs.Osejs _ejs, String _type, String _header) {
    ejs = _ejs;
    defaultType = _type;
    defaultHeader = _header;
    defaultString = new String(res.getString(defaultHeader + ".Page"));

    MyActionListener al = new MyActionListener();

    popupMenu = new PopupMenu();
    customMenuItems(al); // Creates the top menu items
    // common menu items
    copyPage = createMenuItem("copyPage", defaultHeader, al);
    upPage = createMenuItem("upPage", defaultHeader, al);
    dnPage = createMenuItem("dnPage", defaultHeader, al);
    renamePage = createMenuItem("renamePage", defaultHeader, al);
    popupMenu.addSeparator();
    togglePage = createMenuItem("togglePage", defaultHeader, al);
    removePage = createMenuItem("removePage", defaultHeader, al);

    JPanel firstPanel = createFirstPanel();

    tabbedPanel = new JTabbedPane();
    tabbedPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbedPanel.add(popupMenu);
    // tabbedPanel.setPreferredSize (res.getDimension("TabbedEditor.PreferredSize"));
    tabbedPanel.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mousePressed(java.awt.event.MouseEvent evt) {
            if (OSPRuntime.isPopupTrigger(evt)) // SwingUtilities.isRightMouseButton(evt))
            showMenu(evt.getComponent(), evt.getX(), evt.getY());
          }
        });
    cardLayout = new CardLayout();
    finalPanel = new JPanel(cardLayout);
    finalPanel.add(tabbedPanel, "TabbedPanel");
    finalPanel.add(firstPanel, "FirstPanel");
    setFont(finalPanel.getFont());

    Font font = InterfaceUtils.font(null, res.getString("Editor.TitleFont"));
    addPageMI.setFont(font);
    copyPage.setFont(font);
    upPage.setFont(font);
    dnPage.setFont(font);
    togglePage.setFont(font);
    removePage.setFont(font);
    renamePage.setFont(font);
    myFont = font.deriveFont(Font.PLAIN);
    showFirstPage();
  }
Ejemplo n.º 6
0
  private void initTabPopup() {
    final JPopupMenu popup = new JPopupMenu();

    JMenuItem close = new JMenuItem(i18n.CLOSE);
    close.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            _tabbedExecutionsPanel.remove(_tabbedExecutionsPanel.getSelectedIndex());
          }
        });
    popup.add(close);

    JMenuItem closeAllButThis = new JMenuItem(i18n.CLOSE_ALL_BUT_THIS);
    closeAllButThis.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            for (Component c : _tabbedExecutionsPanel.getComponents()) {
              if (c != _tabbedExecutionsPanel.getSelectedComponent())
                _tabbedExecutionsPanel.remove(c);
            }
          }
        });
    popup.add(closeAllButThis);

    JMenuItem closeAll = new JMenuItem(i18n.CLOSE_ALL);
    closeAll.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            _tabbedExecutionsPanel.removeAll();
          }
        });
    popup.add(closeAll);

    _tabbedExecutionsPanel.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            showPopup(e, popup);
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            showPopup(e, popup);
          }
        });
  }
Ejemplo n.º 7
0
  public void init() {
    tabbedPane.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            if (e.getModifiers() == InputEvent.BUTTON3_MASK) {
              contextMenu.show(e.getComponent(), e.getX(), e.getY());
            }
          }

          public void mouseReleased(MouseEvent e) {}
        });
    fileChooser = new JFileChooser();
    fileChooser.setDialogTitle("Save file");
    fileChooser.setApproveButtonText("Save file");
    fileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
  }
Ejemplo n.º 8
0
  /**
   * Gets all of the tabPanels from the ConfigLoader, then adds them to the JTabbedPane.
   *
   * <p>Sets the target to null.
   *
   * <p>Registers listeners.
   *
   * <p>
   *
   * @param compassPoint the position for which to build the pane
   * @param theOrientation is the orientation.
   */
  public DetailsPane(String compassPoint, Orientation theOrientation) {
    LOG.log(Level.INFO, "making DetailsPane({0})", compassPoint);

    orientation = theOrientation;

    loadTabs(compassPoint);

    setOrientation(orientation);

    setLayout(new BorderLayout());
    setFont(new Font("Dialog", Font.PLAIN, 10));
    add(topLevelTabbedPane, BorderLayout.CENTER);

    setTarget(null, true);
    topLevelTabbedPane.addMouseListener(this);
    topLevelTabbedPane.addChangeListener(this);
  }
  /**
   * Due to JDK 1.4 Bug 4465870 this doesn't work with JDK 1.4. when scrollable tabbed pane is used.
   */
  private void createTabPopup() {
    final JPopupMenu popup = new JPopupMenu();

    // i18n[SQLResultExecuterPanel.close=Close]
    String closeLabel = s_stringMgr.getString("SQLResultExecuterPanel.close");
    JMenuItem mnuClose = new JMenuItem(closeLabel);
    initAccelerator(CloseCurrentSQLResultTabAction.class, mnuClose);
    mnuClose.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            closeCurrentResultTab();
          }
        });
    popup.add(mnuClose);

    // i18n[SQLResultExecuterPanel.closeAllButThis=Close all but this]
    String cabtLabel = s_stringMgr.getString("SQLResultExecuterPanel.closeAllButThis");
    JMenuItem mnuCloseAllButThis = new JMenuItem(cabtLabel);
    initAccelerator(CloseAllSQLResultTabsButCurrentAction.class, mnuCloseAllButThis);
    mnuCloseAllButThis.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            closeAllButCurrentResultTabs();
          }
        });
    popup.add(mnuCloseAllButThis);

    // i18n[SQLResultExecuterPanel.closeAll=Close all]
    String caLabel = s_stringMgr.getString("SQLResultExecuterPanel.closeAll");
    JMenuItem mnuCloseAll = new JMenuItem(caLabel);
    initAccelerator(CloseAllSQLResultTabsAction.class, mnuCloseAll);
    mnuCloseAll.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            closeAllSQLResultTabs();
          }
        });
    popup.add(mnuCloseAll);

    // i18n[SQLResultExecuterPanel.toggleSticky=Toggle sticky]
    String tsLabel = s_stringMgr.getString("SQLResultExecuterPanel.toggleSticky");
    JMenuItem mnuToggleSticky = new JMenuItem(tsLabel);
    initAccelerator(ToggleCurrentSQLResultTabStickyAction.class, mnuToggleSticky);
    mnuToggleSticky.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            toggleCurrentSQLResultTabSticky();
          }
        });
    popup.add(mnuToggleSticky);

    _tabbedExecutionsPanel.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent e) {
            maybeShowPopup(e, popup);
          }

          public void mouseReleased(MouseEvent e) {
            maybeShowPopup(e, popup);
          }
        });
  }