當前位置: 首頁>>代碼示例>>Java>>正文


Java JToggleButton.setText方法代碼示例

本文整理匯總了Java中javax.swing.JToggleButton.setText方法的典型用法代碼示例。如果您正苦於以下問題:Java JToggleButton.setText方法的具體用法?Java JToggleButton.setText怎麽用?Java JToggleButton.setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JToggleButton的用法示例。


在下文中一共展示了JToggleButton.setText方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RuleEditorViews

import javax.swing.JToggleButton; //導入方法依賴的package包/類
public RuleEditorViews(RuleEditorPanel ruleEditorPanel) {
    this.ruleEditorPanel = ruleEditorPanel;

    updatedOnlyToggleButton = new JToggleButton(new ViewActionSupport.UpdatedOnlyViewAction(this));
    updatedOnlyToggleButton.setToolTipText(updatedOnlyToggleButton.getText());
    updatedOnlyToggleButton.setText(null);
    updatedOnlyToggleButton.setSelected(getViewMode() == ViewMode.UPDATED_ONLY);
    updatedOnlyToggleButton.setFocusable(false);

    categorizedToggleButton = new JToggleButton(new ViewActionSupport.CategorizedViewAction(this));
    categorizedToggleButton.setToolTipText(categorizedToggleButton.getText());
    categorizedToggleButton.setText(null);
    categorizedToggleButton.setSelected(getViewMode() == ViewMode.CATEGORIZED);
    categorizedToggleButton.setFocusable(false);

    allToggleButton = new JToggleButton(new ViewActionSupport.AllViewAction(this));
    allToggleButton.setToolTipText(allToggleButton.getText());
    allToggleButton.setText(null);
    allToggleButton.setSelected(getViewMode() == ViewMode.ALL);
    allToggleButton.setFocusable(false);

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:RuleEditorViews.java

示例2: addButton

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton addButton(final String value) {
    final int numBtns = m_buttons.size();

    if (numBtns >= (m_maxRows * m_panels.size())) {
        // create a new Panel
        final JPanel panel = new JPanel(new GridLayout(m_maxRows, 1));

        this.add(panel);

        m_panels.add(panel);
        m_lastPanel = panel;
    }
    // createButton and add this as itemListener
    final JToggleButton btn = new CustomToggleButton(value);
    btn.addActionListener(this);

    if (value.equals(ClassModel.NO_CLASS)) {
        btn.setText(m_defaultText);
    }

    m_lastPanel.add(btn); // add it to the last Panel

    m_buttons.add(btn);
    return btn;
}
 
開發者ID:knime,項目名稱:knime-activelearning,代碼行數:26,代碼來源:ToggleButtonList.java

示例3: createWorkspaceToolBar

import javax.swing.JToggleButton; //導入方法依賴的package包/類
public void createWorkspaceToolBar() {
    JToolBar workspaceToolBar = new JToolBar();
    workspaceToolBar.setFloatable(false);
    for (ActionDescriptor descriptor : getActionDescriptors()) {
        final Action action = descriptor.getAction();
        if (action instanceof ShowWorkspaceAction) {
            JToggleButton button = new JToggleButton(action);
            button.setText(cut((String) action
                    .getValue(Action.ACTION_COMMAND_KEY)));
            button.setToolTipText((String) action
                    .getValue(Action.ACTION_COMMAND_KEY));
            button.addActionListener(new java.awt.event.ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    action.actionPerformed(e);
                }
            });
            button.setFocusable(false);
            workspaceToolBar.add(button);
        }
    }
    factory.setNorthEastCornerComponent(workspaceToolBar);
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:24,代碼來源:ShowWorkspacePlugin.java

示例4: installDefaults

import javax.swing.JToggleButton; //導入方法依賴的package包/類
public void installDefaults (AbstractButton b) {
       super.installDefaults(b);
if(!defaults_initialized) {
           hiddenToggle = new JToggleButton();
           hiddenToggle.setText("");
           JToolBar bar = new JToolBar();
           bar.setRollover(true);
           bar.add(hiddenToggle);
    defaults_initialized = true;
}
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:GtkSlidingButtonUI.java

示例5: installDefaults

import javax.swing.JToggleButton; //導入方法依賴的package包/類
@Override
   public void installDefaults (AbstractButton b) {
       super.installDefaults(b);
if(!defaults_initialized) {
           hiddenToggle = new JToggleButton();
           hiddenToggle.setText("");
           JToolBar bar = new JToolBar();
           bar.setRollover(true);
           bar.add(hiddenToggle);
    defaults_initialized = true;
}
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:NimbusSlidingButtonUI.java

示例6: installDefaults

import javax.swing.JToggleButton; //導入方法依賴的package包/類
@Override
   public void installDefaults (AbstractButton b) {
       super.installDefaults(b);
if(!defaults_initialized) {
           hiddenToggle = new JToggleButton();
           hiddenToggle.setText("");
           JToolBar bar = new JToolBar();
           bar.add(hiddenToggle);
    defaults_initialized = true;
}
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:WinXPSlidingButtonUI.java

示例7: createToolBar

import javax.swing.JToggleButton; //導入方法依賴的package包/類
public JToolBar createToolBar() {
    JToolBar bar = new JToolBar();

    JComboBox zoom = createZoomComboBox();

    for (Action action : getFileActions()) {
        if (action == null)
            bar.addSeparator();
        else
            bar.add(action).setFocusable(false);
    }
    bar.addSeparator();

    JToggleButton grid = new JToggleButton(layoutGridAction);
    grid.setText(null);
    grid.setFocusable(false);

    JToggleButton col = new JToggleButton(layoutColAction);
    col.setText(null);
    col.setFocusable(false);

    ButtonGroup bg = new ButtonGroup();
    bg.add(col);
    bg.add(grid);

    bar.add(grid);
    bar.add(col);
    bar.addSeparator();
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    panel.add(zoom);
    bar.add(panel);
    return bar;
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:34,代碼來源:PrintPreviewComponent.java

示例8: updateToolbar

import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void updateToolbar(FileObject file, Collection<CssStylesPanelProvider> activeProviders) {

        toolBar.removeAll();
        if (activeProviders.size() <= 1) {
            //remove the whole toolbar, if there's one or zero providers
            removeToolbar();
        } else {
            addToolbar();
        }

        // Button group for document and source buttons
        ButtonGroup buttonGroup = new ButtonGroup();

        boolean first = true;

        CssStylesPanelProvider selected = (file == null) ? null : selectedTabs.get(file.getMIMEType());

        //do the active providers contain the pre-selected provider for this mimetype?
        boolean containsPreselected = selected == null ? false : activeProviders.contains(selected);

        for (CssStylesPanelProvider provider : activeProviders) {
            JToggleButton button = new JToggleButton();
            button.setText(provider.getPanelDisplayName());
            button.setActionCommand(provider.getPanelID());
            button.addActionListener(toolbarListener);

            button.setFocusable(true);
            button.setFocusPainted(false);
            button.setRolloverEnabled(true);

            //copied from org.netbeans.core.multiview.TabsComponent.createButton to make the look 
            //similar to the editor tabs
            Border b = (getButtonBorder());
            if (b != null) {
                button.setBorder(b);
            }
            if (AQUA) {
                button.putClientProperty("JButton.buttonType", "square"); //NOI18N
                button.putClientProperty("JComponent.sizeVariant", "small"); //NOI18N
            }

            buttonGroup.add(button);
            toolBar.add(button);

            if (containsPreselected) {
                //one of the active providers is already pre-selected by user
                if (provider == selected) {
                    //the selected one - activate it
                    button.setSelected(true);
                    setActiveProvider(provider);
                } else {
                    button.setSelected(false);
                }
            } else {
                //no provider has been explicitly selected by the user yet
                button.setSelected(first);
                if (first) {
                    setActiveProvider(provider);
                    first = false;
                }
            }
        }

        revalidate();
        repaint();
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:67,代碼來源:CssStylesPanel.java


注:本文中的javax.swing.JToggleButton.setText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。