javax.swing.plaf.ButtonUI Java Examples
The following examples show how to use
javax.swing.plaf.ButtonUI.
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: WindowsIconFactory.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #2
Source File: StripeTabPanel.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @RequiredUIAccess public TabInfo addTab(@Nonnull String tabName, @Nonnull JComponent component, @Nullable JComponent preferredFocusableComponent) { StaticAnchoredButton button = new StaticAnchoredButton(tabName, ToolWindowAnchor.LEFT); button.addItemListener(myItemListener); button.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL)); button.setBackground(new Color(247, 243, 239)); button.setUI((ButtonUI)DesktopStripeButtonUI.createUI(button)); myTabPanel.add(button); TabInfo tabInfo = new TabInfo(button, component, preferredFocusableComponent); button.putClientProperty(TabInfo.class, tabInfo); myButtonGroup.add(button); myContentPanel.add(component, tabName); if(myButtonGroup.getSelection() == null) { tabInfo.select(); } return tabInfo; }
Example #3
Source File: WindowsIconFactory.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #4
Source File: WindowsIconFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #5
Source File: WindowsIconFactory.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #6
Source File: WindowsIconFactory.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #7
Source File: WindowsIconFactory.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #8
Source File: WindowsIconFactory.java From hottub with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #9
Source File: WindowsIconFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #10
Source File: WindowsIconFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #11
Source File: WindowsIconFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #12
Source File: ThemeValue.java From netbeans with Apache License 2.0 | 6 votes |
private static SynthContext getSynthContext () { try { JButton dummyButton = getDummyButton(); ButtonUI bui = dummyButton.getUI(); if (bui instanceof SynthUI) { return ((SynthUI) bui).getContext(dummyButton); } else { throw new IllegalStateException ("I don't have a SynthButtonUI to play with"); //NOI18N } } catch (Exception e) { functioning = Boolean.FALSE; if (log) { e.printStackTrace(); } return null; } }
Example #13
Source File: WindowsIconFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #14
Source File: WindowsIconFactory.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #15
Source File: WindowsIconFactory.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #16
Source File: WindowsIconFactory.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #17
Source File: WindowsIconFactory.java From JDKSourceCode1.8 with MIT License | 6 votes |
private static WindowsMenuItemUIAccessor getAccessor( JMenuItem menuItem) { WindowsMenuItemUIAccessor rv = null; ButtonUI uiObject = (menuItem != null) ? menuItem.getUI() : null; if (uiObject instanceof WindowsMenuItemUI) { rv = ((WindowsMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsMenuUI) { rv = ((WindowsMenuUI) uiObject).accessor; } else if (uiObject instanceof WindowsCheckBoxMenuItemUI) { rv = ((WindowsCheckBoxMenuItemUI) uiObject).accessor; } else if (uiObject instanceof WindowsRadioButtonMenuItemUI) { rv = ((WindowsRadioButtonMenuItemUI) uiObject).accessor; } return rv; }
Example #18
Source File: SubstanceCoreUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Uninstalls the specified menu item. * * @param menuItem Menu item. */ public static void uninstallMenu(JMenuItem menuItem) { if (menuItem instanceof JMenu) { JMenu menu = (JMenu) menuItem; for (Component comp : menu.getMenuComponents()) if (comp instanceof JMenuItem) SubstanceCoreUtilities.uninstallMenu((JMenuItem) comp); } ButtonUI menuItemUI = menuItem.getUI(); if (menuItemUI instanceof SubstanceMenu) { SubstanceMenu sMenu = (SubstanceMenu) menuItemUI; if (sMenu.getAssociatedMenuItem() != null) { menuItemUI.uninstallUI(menuItem); } } for (ActionListener actionListener : menuItem.getActionListeners()) menuItem.removeActionListener(actionListener); menuItem.removeAll(); }
Example #19
Source File: BasicSlidingTabDisplayerUI.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void updateUI () { SlidingTabDisplayerButtonUI ui = null; try { ui = (SlidingTabDisplayerButtonUI) UIManager.getUI(this); setUI (ui); return; } catch (Error e) { System.err.println ("Error getting sliding button UI: " + e.getMessage()); } catch (Exception ex) { System.err.println ("Exception getting button UI: " + ex.getMessage()); } setUI ((ButtonUI) SlidingTabDisplayerButtonUI.createUI(this)); }
Example #20
Source File: TextSearchBar.java From pumpernickel with MIT License | 5 votes |
/** * Sets the ButtonUI for all the non-checkbox buttons in this search bar. * * @param ui * the button UI to use for all non-checkbox buttons. */ public void setButtonUI(ButtonUI ui) { for (int a = 0; a < getComponentCount(); a++) { if (getComponent(a) instanceof JButton) { ((JButton) getComponent(a)).setUI(ui); } else if (getComponent(a) instanceof JCheckBox) { // do nothing } else if (getComponent(a) instanceof JToggleButton) { ((JToggleButton) getComponent(a)).setUI(ui); } } updateLayout(); // must update the UI of the close button correctly }
Example #21
Source File: OutlookBarMain.java From orbit-image-analysis with GNU General Public License v3.0 | 5 votes |
void addTab(JOutlookBar tabs, String title) { JPanel panel = new JPanel(); panel.setLayout(new PercentLayout(PercentLayout.VERTICAL, 0)); panel.setOpaque(false); String[] buttons = new String[] {"Inbox", "icons/outlook-inbox.gif", "Outbox", "icons/outlook-outbox.gif", "Drafts", "icons/outlook-inbox.gif", "Templates", "icons/outlook-inbox.gif", "Deleted Items", "icons/outlook-trash.gif",}; for (int i = 0, c = buttons.length; i < c; i += 2) { JButton button = new JButton(buttons[i]); try { button.setUI((ButtonUI)Class.forName( (String)UIManager.get("OutlookButtonUI")).newInstance()); } catch (Exception e) { e.printStackTrace(); } button.setIcon(new ImageIcon(OutlookBarMain.class .getResource(buttons[i + 1]))); panel.add(button); } JScrollPane scroll = tabs.makeScrollPane(panel); tabs.addTab("", scroll); // this to test the UI gets notified of changes int index = tabs.indexOfComponent(scroll); tabs.setTitleAt(index, title); tabs.setToolTipTextAt(index, title + " Tooltip"); }
Example #22
Source File: ImageToggleButton.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void setUI( final ButtonUI ui ) { super.setUI( ui ); if ( alignment != null ) { setAlignmentX( alignment ); } }
Example #23
Source File: JBCheckBox.java From consulo with Apache License 2.0 | 5 votes |
/** * Sets given icon to display between checkbox icon and text. * * @return true in case of success and false otherwise */ public boolean setTextIcon(@Nonnull Icon icon) { ButtonUI ui = getUI(); if (ui instanceof BasicRadioButtonUI) { Icon defaultIcon = ((BasicRadioButtonUI) ui).getDefaultIcon(); if (defaultIcon != null) { MergedIcon mergedIcon = new MergedIcon(defaultIcon, 10, icon); setIcon(mergedIcon); return true; } } return false; }
Example #24
Source File: StickyButton.java From consulo with Apache License 2.0 | 5 votes |
@Override public void setUI(ButtonUI ui) { if (ui instanceof StickyButtonUI) { super.setUI(ui); } else { super.setUI(createUI()); } }
Example #25
Source File: AbstractButtonOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code AbstractButton.setUI(ButtonUI)} through queue */ public void setUI(final ButtonUI buttonUI) { runMapping(new MapVoidAction("setUI") { @Override public void map() { ((AbstractButton) getSource()).setUI(buttonUI); } }); }
Example #26
Source File: AbstractButtonOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code AbstractButton.getUI()} through queue */ public ButtonUI getUI() { return (runMapping(new MapAction<ButtonUI>("getUI") { @Override public ButtonUI map() { return ((AbstractButton) getSource()).getUI(); } })); }
Example #27
Source File: MenuUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns the layout metrics of the specified popup menu. * * @param popupMenu * Popup menu. * @return Layout metrics of the specified popup menu. */ public static MenuLayoutMetrics getMetrics(JPopupMenu popupMenu, boolean forPainting) { MenuLayoutMetrics metrics = new MenuLayoutMetrics(); for (int i = 0; i < popupMenu.getComponentCount(); i++) { Component comp = popupMenu.getComponent(i); if (comp instanceof JMenuItem) { JMenuItem childMenuItem = (JMenuItem) comp; ButtonUI bui = childMenuItem.getUI(); if (!(bui instanceof SubstanceMenu)) continue; SubstanceMenu ui = (SubstanceMenu) bui; MenuLayoutInfo mli = MenuUtilities.getMenuLayoutInfo(forPainting, childMenuItem, ui.getAcceleratorFont(), ui.getCheckIcon(), ui.getArrowIcon(), ui.getDefaultTextIconGap()); metrics.maxIconWidth = Math.max(metrics.maxIconWidth, mli.iconRect.width); metrics.maxCheckIconWidth = Math.max(metrics.maxCheckIconWidth, mli.checkIconRect.width); metrics.maxTextWidth = Math.max(metrics.maxTextWidth, mli.textRect.width); metrics.maxAcceleratorWidth = Math.max(metrics.maxAcceleratorWidth, mli.acceleratorRect.width); metrics.maxArrowIconWidth = Math.max(metrics.maxArrowIconWidth, mli.arrowIconRect.width); metrics.maxIconTextGap = Math.max(metrics.maxIconTextGap, ui.getDefaultTextIconGap()); } } return metrics; }
Example #28
Source File: MenuUtilities.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns the layout metrics of the popup menu of the specified menu item. * * @param menuItem * Menu item. * @return Layout metrics of the popup menu of the specified menu item. */ public static MenuLayoutMetrics getPopupLayoutMetrics(JMenuItem menuItem, boolean forPainting) { Component comp = menuItem.getParent(); if (comp instanceof JPopupMenu) { JPopupMenu popupMenu = (JPopupMenu) comp; return getPopupLayoutMetrics(popupMenu, forPainting); } // fix for issue 347 - menu item in menu bar is not // covered by the code above if (!(comp instanceof JMenu)) { ButtonUI bui = menuItem.getUI(); if (bui instanceof SubstanceMenu) { SubstanceMenu ui = (SubstanceMenu) bui; MenuLayoutInfo mli = MenuUtilities.getMenuLayoutInfo(forPainting, menuItem, ui.getAcceleratorFont(), ui.getCheckIcon(), ui.getArrowIcon(), ui.getDefaultTextIconGap()); MenuLayoutMetrics metrics = new MenuLayoutMetrics(); metrics.maxIconWidth = mli.iconRect.width; metrics.maxCheckIconWidth = mli.checkIconRect.width; metrics.maxTextWidth = mli.textRect.width; metrics.maxAcceleratorWidth = mli.acceleratorRect.width; metrics.maxArrowIconWidth = mli.arrowIconRect.width; metrics.maxIconTextGap = ui.getDefaultTextIconGap(); return metrics; } } // If here, the parent is not popup menu - this is a top-level menu // in a menu bar. No need to align the different rectangles return null; }
Example #29
Source File: StickyButton.java From consulo with Apache License 2.0 | 4 votes |
protected ButtonUI createUI() { return new StickyButtonUI(); }
Example #30
Source File: JSplitButton.java From Juicebox with MIT License | 4 votes |
@Override public void updateUI() { setUI((ButtonUI) UIManager.getUI(this)); }