示例#1
0
 public EditModeTabs() {
   ButtonGroup bG = new ButtonGroup();
   for (int i = 0; i < m_editPanes.length; i++) {
     TabButton addMe = new TabButton(m_editPanes[i].m_name);
     final int mode = m_editPanes[i].m_mode;
     addMe.addActionListener(
         new ActionListener() {
           @Override
           public void actionPerformed(ActionEvent e) {
             m_soul.m_editorManager.setMode(mode);
           }
         });
     bG.add(addMe);
     this.add(addMe);
   }
   this.setOpaque(false);
   this.setLayout(new MigLayout("gap 0, inset 0"));
 }
示例#2
0
 /** 其他导航条按钮还原 */
 public void otherNavBtnToNormal(Widget widget) {
   Control[] btns = winToolbar.getChildren();
   for (Control btn : btns) {
     if (btn instanceof TabButton) {
       if (!btn.equals(widget)) {
         ((TabButton) btn).toNoraml();
       }
     }
   }
 }
示例#3
0
  /**
   * Adds a tab.
   *
   * @param card the tab content.
   * @param name the tab name.
   */
  public void addTab(final WComponent card, final String name) {
    WContainer titledCard = new WContainer();
    WText title = new WText("<b>[" + name + "]:</b><br/>");
    title.setEncodeText(false);
    titledCard.add(title);
    titledCard.add(card);

    deck.add(titledCard);

    final TabButton button = new TabButton(name, titledCard);

    button.setAction(
        new Action() {
          public void execute(final ActionEvent event) {
            deck.makeVisible(button.getAssociatedCard());
          }
        });

    btnPanel.add(button);
  }
 void updateTabButton(int index, int selectedIndex, int buttonsCount) {
   if (buttonsCount == 1) {
     tabButton.setFocusable(false);
     tabButton.setCursor(Cursor.getDefaultCursor());
     setBackground(BACKGROUND_COLOR_NORMAL);
     setBorder(
         TabbedCaptionBorder.get(
             BORDER_COLOR_NORMAL, BORDER_COLOR_NORMAL, COLOR_NONE, COLOR_NONE));
   } else if (index == selectedIndex) {
     tabButton.setFocusable(true);
     tabButton.setCursor(Cursor.getDefaultCursor());
     setBackground(BACKGROUND_COLOR_HIGHLIGHT);
     setBorder(
         TabbedCaptionBorder.get(
             BORDER_COLOR_HIGHLIGHT,
             BORDER_COLOR_HIGHLIGHT,
             COLOR_NONE,
             BORDER_COLOR_HIGHLIGHT));
   } else {
     tabButton.setFocusable(true);
     tabButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
     setBackground(BACKGROUND_COLOR_NORMAL);
     Color topColor = BORDER_COLOR_NORMAL;
     Color leftColor = index == 0 ? BORDER_COLOR_NORMAL : null;
     Color bottomColor = BORDER_COLOR_HIGHLIGHT;
     Color rightColor =
         index == selectedIndex - 1
             ? null
             : index == buttonsCount - 1 ? COLOR_NONE : TABS_SEPARATOR;
     setBorder(TabbedCaptionBorder.get(topColor, leftColor, bottomColor, rightColor));
   }
 }
 public void setEnabled(boolean enabled) {
   super.setEnabled(enabled);
   tabButton.setEnabled(enabled);
 }
示例#6
0
  private Composite createWinToolBar(Composite composite) {
    Composite winToolbar = new Composite(composite, SWT.NONE);
    winToolbar.setLayoutData(new RowData(850, 88));

    TabButton button1 =
        new TabButton(winToolbar, SWT.NONE, true, "/res/tab_button_SoftCenter.png", 3, null, this);
    button1.setBounds(20, 0, 74, 82);
    TabButton button2 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_AppCenter.png", 3, null, this);
    button2.setBounds(20 + 74 + 5, 0, 74, 82);
    TabButton button3 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_GameCenter.png", 3, null, this);
    button3.setBounds(20 + 74 * 2 + 5, 0, 74, 82);
    TabButton button4 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_Update.png", 3, null, this);
    button4.setBounds(20 + 74 * 3 + 5, 0, 74, 82);
    TabButton button5 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_Uninstall.png", 3, null, this);
    button5.setBounds(20 + 74 * 4 + 5, 0, 74, 82);
    TabButton button6 =
        new TabButton(
            winToolbar, SWT.NONE, false, "/res/tab_button_StartupAccelerate.png", 3, null, this);
    button6.setBounds(20 + 74 * 5 + 5, 0, 74, 82);
    TabButton button7 =
        new TabButton(
            winToolbar, SWT.NONE, false, "/res/tab_button_MobileEssential.png", 3, null, this);
    button7.setBounds(20 + 74 * 6 + 5, 0, 74, 82);

    Label logoLabel = new Label(winToolbar, SWT.NONE);
    logoLabel.setBounds(690, 5, 140, 67);
    logoLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/logo.png"));

    return winToolbar;
  }