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