use of javax.swing.plaf.ComponentUI in project groovy-core by groovy.
the class TextEditor method getScrollableTracksViewportWidth.
public boolean getScrollableTracksViewportWidth() {
boolean bool = super.getScrollableTracksViewportWidth();
if (unwrapped) {
Component parent = this.getParent();
ComponentUI ui = this.getUI();
int uiWidth = ui.getPreferredSize(this).width;
bool = (parent == null) || (uiWidth < parent.getSize().width);
}
return bool;
}
use of javax.swing.plaf.ComponentUI in project groovy by apache.
the class TextEditor method getScrollableTracksViewportWidth.
public boolean getScrollableTracksViewportWidth() {
boolean bool = super.getScrollableTracksViewportWidth();
if (unwrapped) {
Component parent = this.getParent();
ComponentUI ui = this.getUI();
int uiWidth = ui.getPreferredSize(this).width;
bool = (parent == null) || (uiWidth < parent.getSize().width);
}
return bool;
}
use of javax.swing.plaf.ComponentUI in project jdk8u_jdk by JetBrains.
the class bug6657138 method testUIMap.
private static void testUIMap() throws Exception {
UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();
Set<JComponent> components = componentMap.keySet();
for (JComponent c : components) {
Map<String, ComponentUI> uiMap = componentMap.get(c);
for (UIManager.LookAndFeelInfo laf : lafs) {
if ("Nimbus".equals(laf.getName())) {
// when this method is called from the new AppContext
continue;
}
String className = laf.getClassName();
UIManager.setLookAndFeel(className);
ComponentUI ui = UIManager.getUI(c);
if (ui == null) {
throw new RuntimeException("UI is null for " + c);
}
if (ui == uiMap.get(laf.getName())) {
throw new RuntimeException("Two AppContexts share the same UI delegate! \n" + c + "\n" + ui);
}
uiMap.put(laf.getName(), ui);
}
}
}
use of javax.swing.plaf.ComponentUI in project JMRI by JMRI.
the class SliderSnap method createUI.
/**
* Returns the UI as normal, but intercepts the call, so that a listener can
* be attached
*
* @param c the slider component
* @return a ComponentUI object with attached listener
*/
public static ComponentUI createUI(JComponent c) {
if (c == null || sliderClass == null) {
return null;
}
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
try {
Method m = (Method) defaults.get(sliderClass);
if (m == null) {
m = //NOI18N
sliderClass.getMethod(//NOI18N
"createUI", new Class<?>[] { JComponent.class });
defaults.put(sliderClass, m);
}
ComponentUI uiObject = (ComponentUI) m.invoke(null, new Object[] { c });
if (uiObject instanceof BasicSliderUI) {
c.addHierarchyListener(new MouseAttacher());
}
return uiObject;
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
Aggregations