javax.swing.plaf.MenuItemUI Java Examples

The following examples show how to use javax.swing.plaf.MenuItemUI. 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: GtkPaintingUtil.java    From consulo with 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
Source File: JMenuItemOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 File: ScrollableMenu.java    From jaamsim with 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 File: DockingCheckboxMenuItemUI.java    From ghidra with 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 File: DockingMenuUI.java    From ghidra with 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 File: DockingMenuItemUI.java    From ghidra with 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 File: ActionMenu.java    From consulo with 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 File: ActionMenuItem.java    From consulo with 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 File: GtkMenuUI.java    From consulo with 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 File: GtkMenuUI.java    From consulo with 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 File: GtkPaintingUtil.java    From consulo with 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 File: IconWrapper.java    From consulo with 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 File: GtkMenuItemUI.java    From consulo with 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 File: GtkMenuItemUI.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static boolean isUiAcceptable(final MenuItemUI ui) {
  return ui instanceof BasicMenuItemUI && GtkPaintingUtil.isSynthUI(ui);
}