本文整理匯總了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();
}