当前位置: 首页>>代码示例>>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;未经允许,请勿转载。