本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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();
}