本文整理汇总了Java中javax.swing.AbstractButton类的典型用法代码示例。如果您正苦于以下问题:Java AbstractButton类的具体用法?Java AbstractButton怎么用?Java AbstractButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractButton类属于javax.swing包,在下文中一共展示了AbstractButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableComponents
import javax.swing.AbstractButton; //导入依赖的package包/类
private void enableComponents(Component comp, boolean enable) {
if (comp instanceof Container) {
for (Component subComp : ((Container)comp).getComponents()) {
enableComponents(subComp, enable);
}
}
if ((comp instanceof JComboBox)
|| ((comp instanceof JTextComponent) && ((JTextComponent)comp).isEditable())
|| (comp instanceof AbstractButton) || (comp instanceof JList)) {
if (enable) {
Boolean b = enableMap.get(comp);
if (b != null) {
comp.setEnabled(b);
} else {
comp.setEnabled(true);
}
} else {
enableMap.put(comp, comp.isEnabled());
comp.setEnabled(false);
}
}
}
示例2: loc
import javax.swing.AbstractButton; //导入依赖的package包/类
private static void loc (Component c, String key) {
if (!(c instanceof JLabel)) {
c.getAccessibleContext ().setAccessibleName (loc ("AN_" + key));
c.getAccessibleContext ().setAccessibleDescription (loc ("AD_" + key));
}
if (c instanceof AbstractButton) {
Mnemonics.setLocalizedText (
(AbstractButton) c,
loc ("CTL_" + key)
);
} else if (c instanceof JLabel) {
Mnemonics.setLocalizedText (
(JLabel) c,
loc ("CTL_" + key)
);
}
}
示例3: paint
import javax.swing.AbstractButton; //导入依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
AbstractButton b = (AbstractButton) c;
if (RapidLookTools.isToolbarButton(b)) {
RapidLookTools.drawToolbarButton(g, b);
super.paint(g, c);
return;
}
int w = c.getWidth();
int h = c.getHeight();
if (w <= 0 || h <= 0) {
return;
}
if (b.isContentAreaFilled()) {
RapidLookTools.drawButton(b, g, RapidLookTools.createShapeForButton(b));
}
if (b.isBorderPainted()) {
RapidLookTools.drawButtonBorder(b, g, RapidLookTools.createBorderShapeForButton(b));
}
super.paint(g, c);
}
示例4: transformValue
import javax.swing.AbstractButton; //导入依赖的package包/类
@Override
public Object transformValue(Object value) {
if (value instanceof OutlineViewOutlineColumn) {
OutlineViewOutlineColumn c = (OutlineViewOutlineColumn) value;
String dn = c.getRawColumnName ();
if (dn == null) {
dn = c.getHeaderValue ().toString ();
}
String desc = c.getShortDescription (null);
if (desc == null) {
return dn;
}
return NbBundle.getMessage (OutlineView.class, "OutlineViewOutline_NameAndDesc", dn, desc); // NOI18N
} else if (COLUMNS_SELECTOR_HINT.equals (value)) {
return NbBundle.getMessage (OutlineView.class, COLUMNS_SELECTOR_HINT);
} else if (value instanceof AbstractButton) {
AbstractButton b = (AbstractButton) value;
Mnemonics.setLocalizedText (b, b.getText ());
return b;
} else if (value instanceof VisualizerNode) {
return Visualizer.findNode (value);
}
return PropertiesRowModel.getValueFromProperty(value);
}
示例5: mouseReleased
import javax.swing.AbstractButton; //导入依赖的package包/类
public void mouseReleased( MouseEvent evt ) {
if( evt.isControlDown() ) {
dragWindow = false;
return;
} else if (dragMap) {
dragMap = false;
zoomToRect();
map.repaint();
}
else if( dragWindow ) {
dragWindow = false;
map.repaint();
}
if (profileEnabled) {
AbstractButton b = map.getMapTools().profileB;
b.doClick();
profileEnabled=false;
}
}
示例6: testSetValueObject
import javax.swing.AbstractButton; //导入依赖的package包/类
@Test
public void testSetValueObject() {
final AbstractButton buttonA = new JButton();
buttonA.setActionCommand("iqGfVwJDLd");
final AbstractButton buttonB = new JButton();
buttonB.setActionCommand("ouzioKGsKi");
final AbstractButton buttonC = new JButton();
buttonC.setActionCommand("pKVEAoQzmr");
group.add(buttonA);
group.add(buttonB);
group.add(buttonC);
ButtonGroupHelper.setValue(group, new Object() {
@Override
public String toString() {
return "ouzioKGsKi";
}
});
assertThat(buttonB.isSelected()).isTrue();
}
示例7: mouseExited
import javax.swing.AbstractButton; //导入依赖的package包/类
@Override
public void mouseExited(MouseEvent me) {
boolean res = true;
try {
if (MenuUI.this.menuItem.getParent().getParent() != null) {
if (((JMenu) MenuUI.this.menuItem).getParent().getParent() instanceof InternalFrameTitlePane) {
res = false;
}
}
} catch (Exception exp) {
// do nothing
}
if (res && ((AbstractButton) me.getSource()).isRolloverEnabled()) {
((AbstractButton) me.getSource()).getModel().setRollover(false);
((JComponent) me.getSource()).repaint();
}
}
示例8: addGenericButton
import javax.swing.AbstractButton; //导入依赖的package包/类
/**
* Adds a button deriving all properties from specified action
* @param action action associated to the button
* @return created button
* @see AbstractJMTAction#setSelectable(boolean)
* @see AbstractJMTAction#setGroup(int)
*/
public AbstractButton addGenericButton(AbstractJMTAction action) {
Boolean selectable = (Boolean) action.getValue(AbstractJMTAction.SELECTABLE);
Integer group = (Integer) action.getValue(AbstractJMTAction.GROUP);
if (selectable != null && selectable.booleanValue()) {
// This is a toggle button
if (group != null) {
return this.addToggleButton(action, group.intValue());
} else {
return this.addToggleButton(action);
}
} else {
// This is a button
return this.addButton(action);
}
}
示例9: selectABrowser
import javax.swing.AbstractButton; //导入依赖的package包/类
private void selectABrowser() {
String browser = getPreviouslySelectedBrowser();
if (browser == null) {
browser = RunManager.getGlobalSettings().getBrowser();
}
if (browser != null) {
for (Enumeration<AbstractButton> buttons = browserSelectButtonGroup.getElements(); buttons.hasMoreElements();) {
AbstractButton button = buttons.nextElement();
if (button.getActionCommand().equals(browser)) {
button.setSelected(true);
}
}
} else {
browserSelectButtonGroup.setSelected(browserSelectButtonGroup.getElements().nextElement().getModel(), true);
}
}
示例10: paint
import javax.swing.AbstractButton; //导入依赖的package包/类
public void paint(Graphics g, JComponent c) {
ColorUtil.setupAntialiasing(g);
AbstractButton button = (AbstractButton)c;
hiddenToggle.setBorderPainted(true);
// hiddenToggle.setBorderPainted(button.isBorderPainted());
hiddenToggle.setRolloverEnabled(button.isRolloverEnabled());
hiddenToggle.setFocusable(button.isFocusable());
hiddenToggle.setFocusPainted(button.isFocusPainted());
hiddenToggle.setMargin(button.getMargin());
// hiddenToggle.setBorder(button.getBorder());
hiddenToggle.getModel().setRollover(button.getModel().isRollover());
hiddenToggle.getModel().setPressed(button.getModel().isPressed());
hiddenToggle.getModel().setArmed(button.getModel().isArmed());
hiddenToggle.getModel().setSelected(button.getModel().isSelected());
hiddenToggle.setBounds(button.getBounds());
super.paint(g, c);
}
示例11: makeToolbar
import javax.swing.AbstractButton; //导入依赖的package包/类
/**
* @return the toolbar for the exact wizard. Shamelessly uses icon from the main jmt frame
*/
protected JMTToolBar makeToolbar() {
JMTToolBar tb = new JMTToolBar(JMTImageLoader.getImageLoader());
tb.setFloatable(false);
//null values add a gap between toolbar icons
AbstractJMTAction[] actions = { FILE_NEW, FILE_OPEN, FILE_SAVE, null, ACTION_SOLVE, SWITCH_TO_SIMULATOR, ACTION_RANDOMIZE_MODEL, null, HELP,null };
String[] htext = { "Creates a new model", "Opens a saved model", "Saves the current model", "Solves the current model",
"Import current model to JSIMwiz to solve it with the simulator", "Randomize model data", "Show help"};
ArrayList<AbstractButton> buttons = new ArrayList<AbstractButton>();
buttons.addAll(tb.populateToolbar(actions));
//adds the algorithm selection box
amvaPanel = new AMVAPanel(this);
tb.add(amvaPanel);
// Adds help
for (int i = 0; i < buttons.size(); i++) {
AbstractButton button = buttons.get(i);
help.addHelp(button, htext[i]);
}
return tb;
}
示例12: BugReportViewerDialog
import javax.swing.AbstractButton; //导入依赖的package包/类
public BugReportViewerDialog(Window owner) {
super(owner, "send_bugreport_info", ModalityType.APPLICATION_MODAL, new Object[] {});
final JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
Collection<AbstractButton> buttons = new LinkedList<AbstractButton>();
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.insets = new Insets(GAP * 2, GAP, GAP * 2, GAP);
gbc.fill = GridBagConstraints.BOTH;
propArea = new JTextArea();
propArea.setEditable(false);
scrollPanePropArea = new JScrollPane(propArea);
panel.add(scrollPanePropArea, gbc);
buttons.add(makeCloseButton());
layoutDefault(panel, LARGE, buttons);
}
示例13: propertyChange
import javax.swing.AbstractButton; //导入依赖的package包/类
/** Requests refresh of our lookup everytime component is chagned.
*/
public void propertyChange(java.beans.PropertyChangeEvent evt) {
if (TopComponent.Registry.PROP_ACTIVATED.equals (evt.getPropertyName())) {
org.openide.util.Utilities.actionsGlobalContext ().lookup (javax.swing.ActionMap.class);
}
if ("permanentFocusOwner".equals(evt.getPropertyName())) {
Component[] arr = { (Component)evt.getNewValue() };
if (arr[0] instanceof AbstractButton) {
Action a = ((AbstractButton)arr[0]).getAction();
if (a instanceof ContextAwareAction) {
// ignore focus change into a button with our action
return;
}
}
blickActionMap(null, arr);
}
}
示例14: switchModes
import javax.swing.AbstractButton; //导入依赖的package包/类
private void switchModes(AbstractButton newSelection)
{
PrivilegeListEditor editor = editors.get(newSelection);
PrivilegeList privList = getCurrentPrivilegeList();
if( !editor.canHandle(privilegeNode, privList) )
{
String message = CurrentLocale.get("security.editor.mayLoseEntries");
int result = JOptionPane.showConfirmDialog(this, message, null, JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
if( result == JOptionPane.NO_OPTION )
{
lastSelected.setSelected(true);
return;
}
}
lastSelected = newSelection;
setContainer(editor.createView(domainObj, privilegeNode, privList));
}
示例15: actionPerformed
import javax.swing.AbstractButton; //导入依赖的package包/类
@Override
public void actionPerformed( ActionEvent ae ) {
if ("pressed".equals(ae.getActionCommand())) { //NOI18N
JComponent jc = (JComponent) ae.getSource();
Point p = new Point(jc.getWidth(), jc.getHeight());
SwingUtilities.convertPointToScreen(p, jc);
if (!ButtonPopupSwitcher.isShown()) {
ButtonPopupSwitcher.showPopup(jc, controller, p.x, p.y);
} else {
ButtonPopupSwitcher.hidePopup();
}
//Other portion of issue 37487, looks funny if the
//button becomes pressed
if (jc instanceof AbstractButton) {
AbstractButton jb = (AbstractButton) jc;
jb.getModel().setPressed(false);
jb.getModel().setRollover(false);
jb.getModel().setArmed(false);
jb.repaint();
}
}
}