Java Code Examples for javax.swing.plaf.MenuItemUI

The following examples show how to use javax.swing.plaf.MenuItemUI. These examples are extracted from open source projects. 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 Project: consulo   Source File: GtkPaintingUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static boolean isSynthUI(final MenuItemUI ui) {
  Class<?> aClass = ui.getClass();

  while (aClass != null && aClass.getSimpleName().contains("Synth")) {
    final Class<?>[] interfaces = aClass.getInterfaces();
    for (int i = 0, length = interfaces.length; i < length; i++) {
      final Class<?> anInterface = interfaces[i];
      if (V6_SYNTH_UI_CLASS.equals(anInterface.getName()) || V7_SYNTH_UI_CLASS.equals(anInterface.getName())) {
        return true;
      }
    }
    aClass = aClass.getSuperclass();
  }

  return false;
}
 
Example 2
/**
 * Maps {@code JMenuItem.setUI(MenuItemUI)} through queue
 */
public void setUI(final MenuItemUI menuItemUI) {
    runMapping(new MapVoidAction("setUI") {
        @Override
        public void map() {
            ((JMenuItem) getSource()).setUI(menuItemUI);
        }
    });
}
 
Example 3
Source Project: jaamsim   Source File: ScrollableMenu.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void updateUI() {
	setUI((MenuItemUI) UIManager.getUI(this));
	if (popupMenu != null) {
		popupMenu.setUI((PopupMenuUI) UIManager.getUI(popupMenu));
	}
}
 
Example 4
Source Project: ghidra   Source File: DockingCheckboxMenuItemUI.java    License: Apache License 2.0 4 votes vote down vote up
public static ComponentUI createUI(JComponent c) {
	LookAndFeel underlying = UIManager.getLookAndFeel();
	DockingCheckboxMenuItemUI result = new DockingCheckboxMenuItemUI();
	result.ui = (MenuItemUI) underlying.getDefaults().getUI(c);
	return result;
}
 
Example 5
Source Project: ghidra   Source File: DockingMenuUI.java    License: Apache License 2.0 4 votes vote down vote up
public static ComponentUI createUI(JComponent c) {
	LookAndFeel underlying = UIManager.getLookAndFeel();
	DockingMenuUI result = new DockingMenuUI();
	result.ui = (MenuItemUI) underlying.getDefaults().getUI(c);
	return result;
}
 
Example 6
Source Project: ghidra   Source File: DockingMenuItemUI.java    License: Apache License 2.0 4 votes vote down vote up
public static ComponentUI createUI(JComponent c) {
	LookAndFeel underlying = UIManager.getLookAndFeel();
	DockingMenuItemUI result = new DockingMenuItemUI();
	result.ui = (MenuItemUI) underlying.getDefaults().getUI(c);
	return result;
}
 
Example 7
Source Project: consulo   Source File: ActionMenu.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setUI(final MenuItemUI ui) {
  final MenuItemUI newUi = !myTopLevel && UIUtil.isUnderGTKLookAndFeel() && GtkMenuUI.isUiAcceptable(ui) ? new GtkMenuUI(ui) : ui;
  super.setUI(newUi);
}
 
Example 8
Source Project: consulo   Source File: ActionMenuItem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setUI(final MenuItemUI ui) {
  final MenuItemUI newUi = UIUtil.isUnderGTKLookAndFeel() && GtkMenuItemUI.isUiAcceptable(ui) ? new GtkMenuItemUI(ui) : ui;
  super.setUI(newUi);
}
 
Example 9
Source Project: consulo   Source File: GtkMenuUI.java    License: Apache License 2.0 4 votes vote down vote up
public GtkMenuUI(final MenuItemUI originalUI) {
  assert isUiAcceptable(originalUI) : originalUI;
  myOriginalUI = (BasicMenuUI)originalUI;
}
 
Example 10
Source Project: consulo   Source File: GtkMenuUI.java    License: Apache License 2.0 4 votes vote down vote up
public static boolean isUiAcceptable(final MenuItemUI ui) {
  return ui instanceof BasicMenuUI && GtkPaintingUtil.isSynthUI(ui);
}
 
Example 11
Source Project: consulo   Source File: GtkPaintingUtil.java    License: Apache License 2.0 4 votes vote down vote up
public static SynthContext getSynthContext(final MenuItemUI ui, final JComponent item) {
  return GTKPlusUIUtil.getSynthContext(ui, item);
}
 
Example 12
Source Project: consulo   Source File: IconWrapper.java    License: Apache License 2.0 4 votes vote down vote up
public IconWrapper(final Icon icon, final MenuItemUI originalUI) {
  myIcon = icon;
  myOriginalUI = originalUI;
}
 
Example 13
Source Project: consulo   Source File: GtkMenuItemUI.java    License: Apache License 2.0 4 votes vote down vote up
public GtkMenuItemUI(final MenuItemUI originalUI) {
  assert isUiAcceptable(originalUI) : originalUI;
  myOriginalUI = (BasicMenuItemUI)originalUI;
}
 
Example 14
Source Project: consulo   Source File: GtkMenuItemUI.java    License: Apache License 2.0 4 votes vote down vote up
public static boolean isUiAcceptable(final MenuItemUI ui) {
  return ui instanceof BasicMenuItemUI && GtkPaintingUtil.isSynthUI(ui);
}