Java Code Examples for javax.swing.AbstractButton#setDisabledIcon()
The following examples show how to use
javax.swing.AbstractButton#setDisabledIcon() .
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: ButtonFactory.java From openAGV with Apache License 2.0 | 5 votes |
private static JPopupButton createStrokeWidthButton(DrawingEditor editor) { JPopupButton strokeWidthPopupButton = new JPopupButton(); strokeWidthPopupButton.setIcon(ImageDirectory.getImageIcon("/toolbar/attributeStrokeWidth.png")); strokeWidthPopupButton.setText(null); strokeWidthPopupButton.setToolTipText(BUNDLE.getString("buttonFactory.button_strokeWidth.tooltipText")); strokeWidthPopupButton.setFocusable(false); NumberFormat formatter = NumberFormat.getInstance(); if (formatter instanceof DecimalFormat) { ((DecimalFormat) formatter).setMaximumFractionDigits(1); ((DecimalFormat) formatter).setMinimumFractionDigits(0); } double[] widths = new double[] {0.5d, 1d, 2d, 3d, 5d, 9d, 13d}; for (int i = 0; i < widths.length; i++) { String label = Double.toString(widths[i]); Icon icon = new StrokeIcon(new BasicStroke((float) widths[i], BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); AttributeAction action = new AttributeAction( editor, AttributeKeys.STROKE_WIDTH, new Double(widths[i]), label, icon); action.putValue(ActionUtil.UNDO_PRESENTATION_NAME_KEY, BUNDLE.getString("buttonFactory.action_strokeWidth.undo.presentationName")); AbstractButton btn = strokeWidthPopupButton.add(action); btn.setDisabledIcon(icon); } return strokeWidthPopupButton; }
Example 2
Source File: NavigationButtons.java From pumpernickel with MIT License | 5 votes |
public static void formatPrev(AbstractButton button) { button.setIcon(createIcon(false, .75f)); button.setRolloverIcon(createIcon(false, .85f)); button.setSelectedIcon(createIcon(false, 1f)); button.setDisabledIcon(createIcon(false, .3f)); button.setUI(new BevelButtonUI()); button.setContentAreaFilled(true); button.putClientProperty("JButton.segmentPosition", "first"); button.setBorderPainted(true); }
Example 3
Source File: NavigationButtons.java From pumpernickel with MIT License | 5 votes |
public static void formatNext(AbstractButton button) { button.setIcon(createIcon(true, .75f)); button.setRolloverIcon(createIcon(true, .85f)); button.setSelectedIcon(createIcon(true, 1f)); button.setDisabledIcon(createIcon(true, .3f)); button.setUI(new BevelButtonUI()); button.setContentAreaFilled(true); button.putClientProperty("JButton.segmentPosition", "last"); button.setBorderPainted(true); }
Example 4
Source File: LargeNavigationPanelUI.java From pumpernickel with MIT License | 5 votes |
@Override protected Component createPreviousButton() { AbstractButton button = NavigationButtons.createPrev(); format(button); button.setIcon(new TriangleIcon(SwingConstants.WEST, 24, 24, Color.lightGray)); button.setRolloverIcon(new TriangleIcon(SwingConstants.WEST, 24, 24, Color.white)); button.setDisabledIcon(new TriangleIcon(SwingConstants.WEST, 24, 24, Color.darkGray)); button.setName(PREV_BUTTON_NAME); installPreviousButtonListeners(button); return button; }
Example 5
Source File: LargeNavigationPanelUI.java From pumpernickel with MIT License | 5 votes |
@Override protected Component createNextButton() { AbstractButton button = NavigationButtons.createNext(); format(button); button.setIcon(new TriangleIcon(SwingConstants.EAST, 24, 24, Color.lightGray)); button.setRolloverIcon(new TriangleIcon(SwingConstants.EAST, 24, 24, Color.white)); button.setDisabledIcon(new TriangleIcon(SwingConstants.EAST, 24, 24, Color.darkGray)); button.setName(NEXT_BUTTON_NAME); installNextButtonListeners(button); return button; }
Example 6
Source File: LargeNavigationPanelUI.java From pumpernickel with MIT License | 5 votes |
protected AbstractButton createFirstButton() { AbstractButton button = new JButton(); format(button); button.setIcon(new FirstIcon(2, 24, 24, Color.lightGray)); button.setRolloverIcon(new FirstIcon(2, 24, 24, Color.white)); button.setDisabledIcon(new FirstIcon(2, 24, 24, Color.darkGray)); button.setName("Spinner.firstButton"); installFirstButtonListeners(button); return button; }
Example 7
Source File: LargeNavigationPanelUI.java From pumpernickel with MIT License | 5 votes |
protected AbstractButton createLastButton() { AbstractButton button = new JButton(); format(button); button.setIcon(new LastIcon(2, 24, 24, Color.lightGray)); button.setRolloverIcon(new LastIcon(2, 24, 24, Color.white)); button.setDisabledIcon(new LastIcon(2, 24, 24, Color.darkGray)); button.setName("Spinner.lastButton"); installLastButtonListeners(button); return button; }
Example 8
Source File: ButtonFactory.java From openAGV with Apache License 2.0 | 4 votes |
private static JPopupButton createStrokeDashesButton(DrawingEditor editor) { JPopupButton strokeDashesPopupButton = new JPopupButton(); strokeDashesPopupButton.setIcon(ImageDirectory.getImageIcon("/toolbar/attributeStrokeDashes.png")); strokeDashesPopupButton.setText(null); strokeDashesPopupButton.setToolTipText(BUNDLE.getString("buttonFactory.button_strokeDashes.tooltipText")); strokeDashesPopupButton.setFocusable(false); double[][] dashes = new double[][] { null, {4d, 4d}, {2d, 2d}, {4d, 2d}, {2d, 4d}, {8d, 2d}, {6d, 2d, 2d, 2d},}; for (double[] dash : dashes) { float[] fdashes; if (dash == null) { fdashes = null; } else { fdashes = new float[dash.length]; for (int j = 0; j < dash.length; j++) { fdashes[j] = (float) dash[j]; } } Icon icon = new StrokeIcon(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10f, fdashes, 0)); AbstractButton button = strokeDashesPopupButton.add( new AttributeAction(editor, AttributeKeys.STROKE_DASHES, dash, null, icon)); button.setDisabledIcon(icon); } return strokeDashesPopupButton; }
Example 9
Source File: EditorActionUtilities.java From netbeans with Apache License 2.0 | 4 votes |
static void updateButtonIcons(AbstractButton button, Icon icon, boolean useLargeIcon, String iconResource) { button.setIcon(icon); if (iconResource != null) { String base = iconResource; String suffix = ""; int dotIndex; if ((dotIndex = iconResource.lastIndexOf('.')) >= 0) { suffix = iconResource.substring(dotIndex, iconResource.length()); base = iconResource.substring(0, dotIndex); } if (useLargeIcon) { base += LARGE_ICON_SIZE_STRING; } Icon pressedIcon = ImageUtilities.loadImageIcon(base + "_pressed" + suffix, true); // NOI18N if (pressedIcon != null) { button.setPressedIcon(pressedIcon); } Icon rolloverIcon = ImageUtilities.loadImageIcon(base + "_rollover" + suffix, true); // NOI18N if (rolloverIcon != null) { button.setRolloverIcon(rolloverIcon); } Icon disabledIcon = ImageUtilities.loadImageIcon(base + "_disabled" + suffix, true); // NOI18N if (disabledIcon != null) { button.setDisabledIcon(disabledIcon); } else { // Make disabled icon from regular icon button.setDisabledIcon(ImageUtilities.createDisabledIcon(icon)); } Icon selectedIcon = ImageUtilities.loadImageIcon(base + "_selected" + suffix, true); // NOI18N if (selectedIcon != null) { button.setSelectedIcon(selectedIcon); } Icon rolloverSelectedIcon = ImageUtilities.loadImageIcon(base + "_rolloverSelected" + suffix, true); // NOI18N if (rolloverSelectedIcon != null) { button.setRolloverSelectedIcon(rolloverSelectedIcon); } Icon disabledSelectedIcon = ImageUtilities.loadImageIcon(base + "_disabledSelected" + suffix, true); // NOI18N if (disabledSelectedIcon != null) { button.setDisabledSelectedIcon(disabledSelectedIcon); } } }