本文整理匯總了Java中javax.swing.JToggleButton.setActionCommand方法的典型用法代碼示例。如果您正苦於以下問題:Java JToggleButton.setActionCommand方法的具體用法?Java JToggleButton.setActionCommand怎麽用?Java JToggleButton.setActionCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JToggleButton
的用法示例。
在下文中一共展示了JToggleButton.setActionCommand方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void init() {
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));
setFloatable(false);
add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 32767)));
JLabel label = new JLabel("Properties");
label.setFont(new Font("Default", Font.BOLD, 12));
add(label);
add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));
add(Utils.createButton("Add Row", "add", "Ctrl+Plus", WebORTable.this));
add(Utils.createButton("Delete Rows", "remove", "Ctrl+Minus", WebORTable.this));
addSeparator();
add(Utils.createButton("Move Rows Up", "up", "Ctrl+Up", WebORTable.this));
add(Utils.createButton("Move Rows Down", "down", "Ctrl+Down", WebORTable.this));
addSeparator();
frameToggle = new JToggleButton(Utils.getIconByResourceName("/ui/resources/or/web/propViewer"));
frameToggle.addItemListener(WebORTable.this);
frameToggle.setToolTipText("Show/Hide Frame Property");
frameToggle.setActionCommand("Toggle Frame");
add(frameToggle);
}
示例2: create
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton create(String text) {
JToggleButton togg = new JToggleButton();
togg.setIcon(Utils.getIconByResourceName("/ui/resources/or/" + text.toLowerCase()));
togg.setToolTipText(text);
togg.setActionCommand(text);
togg.addItemListener(ObjectRepo.this);
bgroup.add(togg);
return togg;
}
示例3: init
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private void init() {
add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 0),
new java.awt.Dimension(10, 32767)));
JLabel label = new JLabel("Properties");
label.setFont(new Font("Default", Font.BOLD, 12));
add(label);
add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));
toggleImage = new JToggleButton(Utils.getIconByResourceName("/ui/resources/or/image/image"));
toggleImage.addItemListener(ImageORTable.this);
toggleImage.setActionCommand("ToggleImage");
toggleImage.setToolTipText("Show/Hide Image");
add(toggleImage);
JButton offset = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/findOffset"));
offset.addActionListener(ImageORTable.this);
offset.setToolTipText("Show Offset");
offset.setActionCommand("Show Offset");
add(offset);
JButton findOn = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/findOnScreen"));
findOn.addActionListener(ImageORTable.this);
findOn.setToolTipText("Find on Screen");
findOn.setActionCommand("Find on Screen");
add(findOn);
JButton editor = new JButton(Utils.getIconByResourceName("/ui/resources/or/image/propViewer"));
editor.addActionListener(ImageORTable.this);
editor.setToolTipText("Show Property Editor");
editor.setActionCommand("Show Property Editor");
add(editor);
}
示例4: createToggleButton
import javax.swing.JToggleButton; //導入方法依賴的package包/類
private JToggleButton createToggleButton() {
JToggleButton console = new JToggleButton(Utils.getIconByResourceName("/ui/resources/toolbar/console"));
console.setActionCommand("Console");
console.setToolTipText("Show/Hide Console Box");
console.addActionListener(actionListener);
return console;
}
示例5: 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();
}