javax.swing.AbstractButton Java Examples

The following examples show how to use javax.swing.AbstractButton. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BECheckBoxMenuItemUI.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
public void paintIcon(Component c, Graphics g, int x, int y) 
    	{
    		AbstractButton b = (AbstractButton) c;
    		ButtonModel model = b.getModel();
    		
    		Image selectedImg = __IconFactory__.getInstance().getCheckboxMenuItemSelectedNormalIcon().getImage();
    		boolean isSelected = model.isSelected();
//    		boolean isArmed = model.isArmed();
    		if (isSelected) 
    		{
//    			if(isArmed)
//    				selectedImg = __IconFactory__.getInstance().getCheckboxMenuItemSelectedRoverIcon().getImage();
    		}
    		else
    			selectedImg = __IconFactory__.getInstance().getCheckboxMenuItemNoneIcon().getImage();

    		g.drawImage(selectedImg
    				, x+(usedForVista?5:-4)//* 注意:当用于windows平台专用主类且处于Vista及更高版win时要做不一样的处理哦
    				, y - 3
    				, null);
    	}
 
Example #2
Source File: FlatButtonBorder.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
public Insets getBorderInsets( Component c, Insets insets ) {
	if( FlatButtonUI.isToolBarButton( c ) ) {
		// In toolbars, use button margin only if explicitly set.
		// Otherwise use toolbar margin specified in UI defaults.
		Insets margin = (c instanceof AbstractButton)
			? ((AbstractButton)c).getMargin()
			: null;

		FlatUIUtils.setInsets( insets, UIScale.scale( FlatUIUtils.addInsets( toolbarSpacingInsets,
			(margin != null && !(margin instanceof UIResource)) ? margin : toolbarMargin ) ) );
	} else {
		insets = super.getBorderInsets( c, insets );

		// use smaller left and right insets for icon-only or single-character buttons (so that they are square)
		if( FlatButtonUI.isIconOnlyOrSingleCharacterButton( c ) && ((AbstractButton)c).getMargin() instanceof UIResource )
			insets.left = insets.right = Math.min( insets.top, insets.bottom );
	}

	return insets;
}
 
Example #3
Source File: GradientButton.java    From jclic with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected AbstractButton buildButton() {
  return new JButton() {
    @Override
    public void paintComponent(Graphics g) {
      super.paintComponent(g);
      Gradient gradient = getGradient();
      if (gradient != null) {
        Rectangle r = new Rectangle(0, 0, getWidth(), getHeight());
        r.grow(-3, -3);
        Graphics2D g2 = (Graphics2D) g;
        RenderingHints rh = g2.getRenderingHints();
        g2.setRenderingHints(edu.xtec.jclic.Constants.DEFAULT_RENDERING_HINTS);
        gradient.paint(g2, r);
        g2.setRenderingHints(rh);
      }
    }
  };
}
 
Example #4
Source File: MacOSAboutHandler.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/** This is called when the user does Application->Quit */
@Override
public void handleQuit(ApplicationEvent event) {
    // TODO this should not be hardcoded --> look up by menuitem name
    
    Component[] sampleFile = parent.getJMenuBar().getMenu(0).getMenuComponents();
    for (Component sampleFile1 : sampleFile) {
        if (sampleFile1.getClass().getName().equalsIgnoreCase("javax.swing.JMenuItem")) {
            if (((AbstractButton) sampleFile1).getText().equalsIgnoreCase("Exit")) {
                ((AbstractButton) sampleFile1).doClick();
                event.setHandled(true);
            }
        }
    }
    
}
 
Example #5
Source File: ToolAdapterTabbedEditorDialog.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected JPanel createParametersPanel() {
    JPanel paramsPanel = new JPanel();
    BoxLayout layout = new BoxLayout(paramsPanel, BoxLayout.PAGE_AXIS);
    paramsPanel.setLayout(layout);
    AbstractButton addParamBut = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addParamBut.setText("New Parameter");
    addParamBut.setMaximumSize(new Dimension(150, controlHeight));
    addParamBut.setAlignmentX(Component.LEFT_ALIGNMENT);
    addParamBut.setAlignmentY(Component.TOP_ALIGNMENT);
    paramsPanel.add(addParamBut);
    JScrollPane tableScrollPane = new JScrollPane(paramsTable);
    tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    paramsPanel.add(tableScrollPane);
    addParamBut.addActionListener(e -> paramsTable.addParameterToTable());
    return paramsPanel;
}
 
Example #6
Source File: DomGui.java    From DominionSim with MIT License 6 votes vote down vote up
public ArrayList<DomPlayer> initPlayers() {
    myPlayers = new HashMap<DomPlayer, JButton>();
    ArrayList<DomPlayer> thePlayers = new ArrayList<DomPlayer>();
    for (JButton theSelector : myBotSelectors ) {
      if (getSelectedPlayer(theSelector) == null)
        continue;
      DomPlayer theSelectedBot = getSelectedPlayer(theSelector);
      DomPlayer thePlayer = theSelectedBot.getCopy( theSelectedBot + "(Plr " + (myBotSelectors.indexOf( theSelector )+1) + ")" );
      int j=0;
      for (Enumeration< AbstractButton > theEnum = myStartStateButtonGroups.get( theSelector ).getElements(); theEnum.hasMoreElements(); j++) {
        if (theEnum.nextElement().isSelected() ){
          if (j==1)
            thePlayer.forceStart( 43 );
          if (j==2)
            thePlayer.forceStart( 52 );
        }
      }
      myPlayers.put(thePlayer, theSelector);
      thePlayers.add(thePlayer);
    }
    return thePlayers;
}
 
Example #7
Source File: CreateBranchForm.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * @noinspection ALL
 */
private void $$$loadButtonText$$$(AbstractButton component, String text) {
    StringBuffer result = new StringBuffer();
    boolean haveMnemonic = false;
    char mnemonic = '\0';
    int mnemonicIndex = -1;
    for (int i = 0; i < text.length(); i++) {
        if (text.charAt(i) == '&') {
            i++;
            if (i == text.length()) break;
            if (!haveMnemonic && text.charAt(i) != '&') {
                haveMnemonic = true;
                mnemonic = text.charAt(i);
                mnemonicIndex = result.length();
            }
        }
        result.append(text.charAt(i));
    }
    component.setText(result.toString());
    if (haveMnemonic) {
        component.setMnemonic(mnemonic);
        component.setDisplayedMnemonicIndex(mnemonicIndex);
    }
}
 
Example #8
Source File: RestoreDefaultValueTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private AbstractButton findButton(Container c, String s) {
    if (c instanceof AbstractButton && s.equals(((AbstractButton) c).getText())) {
        return ((AbstractButton) c);
    } else {
        Component[] cs = c.getComponents();
        for (int i=0; i < cs.length; i++) {
            if (cs[i] instanceof Container) {
                AbstractButton result = findButton((Container) cs[i], s);
                if (result != null) {
                    return result;
                }
            }
        }
    }
    return null;
}
 
Example #9
Source File: ButtonHelper.java    From javamoney-examples with Apache License 2.0 6 votes vote down vote up
/**
 * This method builds the specified button according to the specified
 * parameters.
 *
 * @param button The button to build.
 * @param text The text displayed on the button.
 * @param icon The icon to use.
 * @param handler The action listener that monitors the buttons events.
 * @param command The action command used when the button is clicked.
 * @param group The group the button should belong to.
 * @param selected The initial selected state of the button.
 * @param tip The tool tip to display.
 */
public
static
void
buildButton(AbstractButton button, String text, Icon icon,
    ActionListener handler, String command, ButtonGroup group,
    boolean selected, String tip)
{
  button.addActionListener(handler);
  button.setActionCommand(command);
  button.setIcon(icon);
  button.setSelected(selected);
  button.setText(text);
  button.setToolTipText(tip);

  if(group != null)
  {
    group.add(button);
  }
}
 
Example #10
Source File: BreakpointsViewButtons.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NbBundle.Messages({"CTL_DeactivateAllBreakpoints=Deactivate all breakpoints in current session",
                    "CTL_ActivateAllBreakpoints=Activate all breakpoints in current session",
                    "CTL_NoDeactivation=The current session does not allow to deactivate breakpoints",
                    "CTL_NoSession=No debugger session"})
public static AbstractButton createActivateBreakpointsActionButton() {
    ImageIcon icon = ImageUtilities.loadImageIcon(DEACTIVATED_LINE_BREAKPOINT, false);
    final JToggleButton button = new JToggleButton(icon);
    // ensure small size, just for the icon
    Dimension size = new Dimension(icon.getIconWidth() + 8, icon.getIconHeight() + 8);
    button.setPreferredSize(size);
    button.setMargin(new Insets(1, 1, 1, 1));
    button.setBorder(new EmptyBorder(button.getBorder().getBorderInsets(button)));
    button.setToolTipText(Bundle.CTL_DeactivateAllBreakpoints());
    button.setFocusable(false);
    final BreakpointsActivator ba = new BreakpointsActivator(button);
    button.addActionListener(ba);
    DebuggerManager.getDebuggerManager().addDebuggerListener(DebuggerManager.PROP_CURRENT_ENGINE, new DebuggerManagerAdapter() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            DebuggerEngine de = (DebuggerEngine) evt.getNewValue();
            ba.setCurrentEngine(de);
        }
    });
    ba.setCurrentEngine(DebuggerManager.getDebuggerManager().getCurrentEngine());
    return button;
}
 
Example #11
Source File: SwingStrategyUI.java    From atdl4j with MIT License 6 votes vote down vote up
@Override
protected void applyRadioGroupRules() {
	if ( radioGroupMap != null )
	{
		for ( ButtonGroup tempSwingRadioButtonListener : radioGroupMap.values() )
		{
			// -- If no RadioButtons within the radioGroup are selected, then first one in list will be selected --
			if (tempSwingRadioButtonListener.getSelection() == null){
				AbstractButton ab = tempSwingRadioButtonListener.getElements().nextElement();
				if (ab != null) {
					ab.setSelected(true);
				}
			}
		}
	}
}
 
Example #12
Source File: Test4619792.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IntrospectionException {
    Class[] types = {
            Component.class,
            Container.class,
            JComponent.class,
            AbstractButton.class,
            JButton.class,
            JToggleButton.class,
    };
    // Control set. "enabled" and "name" has the same pattern and can be found
    String[] names = {
            "enabled",
            "name",
            "focusable",
    };
    for (String name : names) {
        for (Class type : types) {
            BeanUtils.getPropertyDescriptor(type, name);
        }
    }
}
 
Example #13
Source File: BlueishButtonUI.java    From orbit-image-analysis with GNU General Public License v3.0 6 votes vote down vote up
public void paint(Graphics g, JComponent c) {
  AbstractButton button = (AbstractButton)c;
  if (button.getModel().isRollover()
    || button.getModel().isArmed()
    || button.getModel().isSelected()) {
    Color oldColor = g.getColor();
    if (button.getModel().isSelected()) {
      g.setColor(blueishBackgroundSelected);
    } else {
      g.setColor(blueishBackgroundOver);
    }
    g.fillRect(0, 0, c.getWidth() - 1, c.getHeight() - 1);

    if (button.getModel().isSelected()) {
      g.setColor(blueishBorderSelected);
    } else {
      g.setColor(blueishBorderOver);
    }
    g.drawRect(0, 0, c.getWidth() - 1, c.getHeight() - 1);

    g.setColor(oldColor);
  }

  super.paint(g, c);
}
 
Example #14
Source File: CampaignEditor.java    From open-ig with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Create a imaged button for the given menu item.
 * @param graphicsResource the graphics resource location.
 * @param tooltip the tooltip text
 * @param inMenu the menu item to relay the click to.
 * @param toggle create a toggle button?
 * @return the button
 */
AbstractButton createFor(String graphicsResource, String tooltip, final JMenuItem inMenu, boolean toggle) {
	AbstractButton result = toggle ? new JToggleButton() : new JButton();
	URL res = CampaignEditor.class.getResource("/hu/openig/editors/" + graphicsResource);
	if (res != null) {
		ImageIcon icon = new ImageIcon(res);
		result.setIcon(icon);
		inMenu.setIcon(icon);
	}
	result.setToolTipText(tooltip);
	result.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			inMenu.doClick();
		}
	});
	return result;
}
 
Example #15
Source File: FlatToggleButtonUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
protected void installDefaults( AbstractButton b ) {
	super.installDefaults( b );

	if( !defaults_initialized ) {
		selectedBackground = UIManager.getColor( "ToggleButton.selectedBackground" );
		selectedForeground = UIManager.getColor( "ToggleButton.selectedForeground" );
		disabledSelectedBackground = UIManager.getColor( "ToggleButton.disabledSelectedBackground" );

		toolbarSelectedBackground = UIManager.getColor( "ToggleButton.toolbar.selectedBackground" );

		tabUnderlineHeight = UIManager.getInt( "ToggleButton.tab.underlineHeight" );
		tabUnderlineColor = UIManager.getColor( "ToggleButton.tab.underlineColor" );
		tabDisabledUnderlineColor = UIManager.getColor( "ToggleButton.tab.disabledUnderlineColor" );
		tabSelectedBackground = UIManager.getColor( "ToggleButton.tab.selectedBackground" );
		tabHoverBackground = UIManager.getColor( "ToggleButton.tab.hoverBackground" );
		tabFocusBackground = UIManager.getColor( "ToggleButton.tab.focusBackground" );

		defaults_initialized = true;
	}
}
 
Example #16
Source File: XDMToolBarButtonUI.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
protected void paintButtonRollOver(Graphics g, AbstractButton b) {

		Graphics2D g2 = (Graphics2D) g;
		g2.setPaint(rolloverColor);
		g2.fillRect(0, 0, b.getWidth() - 1, b.getHeight() - 1);
		// g2.setColor(Color.LIGHT_GRAY);
		// g2.drawRect(0, 0, b.getWidth() - 1, b.getHeight() - 1);
	}
 
Example #17
Source File: ChartPagePanel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private JPanel createTopPanel() {
    refreshButton = ToolButtonFactory.createButton(
            UIUtils.loadImageIcon("icons/ViewRefresh22.png"),
            false);
    refreshButton.setToolTipText("Refresh View");
    refreshButton.setName("refreshButton");
    refreshButton.addActionListener(e -> {
        updateChartData();
        refreshButton.setEnabled(false);
    });

    AbstractButton switchToTableButton = ToolButtonFactory.createButton(
            UIUtils.loadImageIcon("icons/Table24.png"),
            false);
    switchToTableButton.setToolTipText("Switch to Table View");
    switchToTableButton.setName("switchToTableButton");
    switchToTableButton.setEnabled(hasAlternativeView());
    switchToTableButton.addActionListener(e -> showAlternativeView());

    final TableLayout tableLayout = new TableLayout(6);
    tableLayout.setColumnFill(2, TableLayout.Fill.HORIZONTAL);
    tableLayout.setColumnWeightX(2, 1.0);
    tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0));
    JPanel buttonPanel = new JPanel(tableLayout);
    buttonPanel.add(refreshButton);
    tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0));
    buttonPanel.add(switchToTableButton);
    buttonPanel.add(new JPanel());

    return buttonPanel;
}
 
Example #18
Source File: NavlinkUI.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
protected void paintButtonPressed(Graphics g, AbstractButton b) {
	if (b.isContentAreaFilled()) {
		if (b instanceof RPNavlink) {
			RPNavlink link = (RPNavlink) b;
			if (link.isLeftNode()) {
				float width = link.getWidth();
				float height = link.getHeight();
				int arc = link.getNavbar().getArc();

				Graphics2D g2 = (Graphics2D) g.create();
				g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
				g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);

				RoundRectangle2D rect = new RoundRectangle2D.Float(0, 0, width, height, link.getNavbar().getArc(),
						arc);
				g2.setColor(getSelectColor());
				g2.fill(rect);

				Rectangle2D rectFix = new Rectangle((int) width - arc, 0, (int) arc, (int) height);
				g2.fill(rectFix);

				g2.dispose();
			} else {
				Dimension size = b.getSize();
				g.setColor(getSelectColor());
				g.fillRect(0, 0, size.width, size.height);
			}
		}
	}
}
 
Example #19
Source File: XDMMenuUI.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void installUI(JComponent c) {
	super.installUI(c);
	if (c instanceof AbstractButton) {
		AbstractButton btn = (AbstractButton) c;
		// btn.setMargin(new Insets(10,10,10,10));
		btn.setBorder(new EmptyBorder(getScaledInt(5), getScaledInt(10), getScaledInt(5), getScaledInt(10)));
		// btn.setIcon(new XDMBlankIcon(15, 10));
		btn.setBorderPainted(false);
		// btn.setMargin(new Insets(10, 10, 10, 10));
		// btn.setFont(new Font(Font.DIALOG, Font.PLAIN, 12));
	}
}
 
Example #20
Source File: ToggleLayoutAction.java    From JPPF with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize this action with the specified tree table panel.
 * @param panel the graph panel to which this action applies.
 */
public ToggleLayoutAction(final GraphOption panel) {
  super(panel);
  setupIcon("/org/jppf/ui/resources/layout.gif");
  setupNameAndTooltip("graph.toggle.layout.on");
  button = (AbstractButton) panel.findFirstWithName("/graph.toggle.layout").getUIComponent();
  button.setSelected(true);
}
 
Example #21
Source File: BasePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** this is likely to be called off the awt thread
 *
 * @param name
 * @param data
 */
public void initializeData(final String name, final Map<String, String> data) {
    Mutex.EVENT.readAccess(new Runnable(){

        @Override
        public void run() {
            for (Component c : getDataComponents()) {
                c.setEnabled(true);
                // fill in the blanks...
                String compName = c.getName();
                if (compName != null) {
                    // construct the key
                    String key = getPrefix() + name + "." + compName;
                    String value = data.get(key);
                    if (null == value) {
                        value = NbBundle.getMessage(this.getClass(), "ERR_DATA_NOT_FOUND", key);
                    } else {
                        c.setName(key); // for writing the field value back to the server
                    }
                    if (c instanceof JComboBox) {
                        final JComboBox jcb = (JComboBox) c;
                        new ComboBoxSetter(jcb, value, data).run();
                    } else if (c instanceof JTextComponent) {
                        final JTextComponent jtc = (JTextComponent) c;
                        new TextFieldSetter(jtc, value).run();
                    } else if (c instanceof AbstractButton) {
                        AbstractButton ab = (AbstractButton) c;
                        new ButtonSetter(ab, value).run();
                    } else if (c instanceof JTable) {
                        JTable table = (JTable) c;
                        new TableSetter(name, table, data).run();
                    }
                }
            }
        }
    });

}
 
Example #22
Source File: AbstractButtonOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps {@code AbstractButton.setMargin(Insets)} through queue
 */
public void setMargin(final Insets insets) {
    runMapping(new MapVoidAction("setMargin") {
        @Override
        public void map() {
            ((AbstractButton) getSource()).setMargin(insets);
        }
    });
}
 
Example #23
Source File: JButtonBar.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
public void propertyChange(PropertyChangeEvent evt) {
  if (evt.getSource() instanceof AbstractButton) {
    AbstractButton button = (AbstractButton)evt.getSource();
    if (button.getParent() instanceof JButtonBar
      && !(button.getUI() instanceof ButtonBarButtonUI)) {
      (
        (ButtonBarUI)
          ((JButtonBar)button.getParent()).ui).installButtonBarUI(
        button);
    }
  }
}
 
Example #24
Source File: XDMMenuItemUI.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void installUI(JComponent c) {
	super.installUI(c);
	c.setBorder(null);
	if (c instanceof AbstractButton) {
		AbstractButton btn = (AbstractButton) c;
		btn.setBorder(new EmptyBorder(getScaledInt(5), getScaledInt(10), getScaledInt(5), getScaledInt(10)));
		btn.setBorderPainted(false);
	}
}
 
Example #25
Source File: AbstractTopLevelController.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void updateClientPresentersEnabling(AbstractButton[] clientPresenters) {
    int disabledPresenterIndex = -1;

    int selectedPresenterIndex = -1;
    int unselectedPresentersCount = 0;

    for (int i = 0; i < clientPresenters.length; i++) {
        if (clientPresenters[i].isSelected()) {
            selectedPresenterIndex = i;
        } else {
            unselectedPresentersCount++;
        }

        if (!clientPresenters[i].isEnabled()) {
            disabledPresenterIndex = i;
        }
    }

    if (unselectedPresentersCount == (clientPresenters.length - 1)) {
        if (disabledPresenterIndex == -1) {
            clientPresenters[selectedPresenterIndex].setEnabled(false);
        }
    } else {
        if (disabledPresenterIndex != -1) {
            clientPresenters[disabledPresenterIndex].setEnabled(true);
        }
    }
}
 
Example #26
Source File: RapidLookTools.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Creates the default {@link Shape} for the given button.
 *
 * @param b
 *            the button to create the shape for
 * @return the shape instance
 */
public static Shape createShapeForButton(AbstractButton b) {
	int w = b.getWidth();
	int h = b.getHeight();
	boolean circular = Boolean.parseBoolean(String.valueOf(b.getClientProperty(RapidLookTools.PROPERTY_BUTTON_CIRCLE)));

	if (circular) {
		return createCircle(w, h);
	} else {
		return new RoundRectangle2D.Double(1, 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
				RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
	}
}
 
Example #27
Source File: LuckRadioIcon.java    From littleluck with Apache License 2.0 5 votes vote down vote up
public void paintIcon(Component c, Graphics g, int x, int y)
{
    AbstractButton cb = (AbstractButton) c;

    ButtonModel model = cb.getModel();

    boolean isPressed = (model.isArmed() && model.isPressed());

    boolean isRollver = (model.isRollover() && cb.isRolloverEnabled());

    Graphics2D g2d = (Graphics2D) g;

    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    drawOval(g2d, x, y, (isRollver || isPressed));

    if(model.isSelected())
    {
        fillOval(g2d, x, y);
    }
    else if(isRollver && isPressed)
    {
        drawOvalShadow(g2d, x, y);
    }

    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
 
Example #28
Source File: AbstractButtonOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps {@code AbstractButton.setMnemonic(int)} through queue
 */
public void setMnemonic(final int i) {
    runMapping(new MapVoidAction("setMnemonic") {
        @Override
        public void map() {
            ((AbstractButton) getSource()).setMnemonic(i);
        }
    });
}
 
Example #29
Source File: FlatButtonUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void uninstallDefaults( AbstractButton b ) {
	super.uninstallDefaults( b );

	MigLayoutVisualPadding.uninstall( b );
	defaults_initialized = false;
}
 
Example #30
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public TransparentToolBar() {
    toolbar = needsPanel() ? null : new JToolBar();
    setOpaque(false);
    if (toolbar == null) {
        // Toolbar is a JPanel (GTK)
        setLayout(new HorizontalLayout(false));
    } else {
        // Toolbar is a JToolBar (default)
        toolbar.setBorderPainted(false);
        toolbar.setFloatable(false);
        toolbar.setRollover(true);
        toolbar.setOpaque(false);
        toolbar.setBorder(BorderFactory.createEmptyBorder());
        setLayout(new BorderLayout());
        add(toolbar, BorderLayout.CENTER);
    }
    addHierarchyListener(new HierarchyListener() {
        public void hierarchyChanged(HierarchyEvent e) {
            if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
                if (isShowing()) {
                    removeHierarchyListener(this);
                    for (Component c : getComponents()) {
                        if (c instanceof AbstractButton) {
                            listener.refresh((AbstractButton)c);
                        }
                    }
                }
            }
        }
    });
}