use of javax.swing.RootPaneContainer in project spring-framework by spring-projects.
the class ProxyFactoryTests method testExclusionOfNonPublicInterfaces.
@Test
@Disabled("Not implemented yet, see https://jira.springframework.org/browse/SPR-5708")
public void testExclusionOfNonPublicInterfaces() {
JFrame frame = new JFrame();
ProxyFactory proxyFactory = new ProxyFactory(frame);
Object proxy = proxyFactory.getProxy();
assertThat(proxy instanceof RootPaneContainer).isTrue();
assertThat(proxy instanceof Accessible).isTrue();
}
use of javax.swing.RootPaneContainer in project n2a by frothga.
the class Lay method setHints.
private static void setHints(Component cmp, HintList hints) {
HintList finalHints = new HintList();
finalHints.addHints(globalHints);
finalHints.addHints(hints);
for (HintPair hint : finalHints) {
String key = hint.key;
String value = hint.value;
String lowerKey = key.toLowerCase();
if (hintProcessors.containsKey(lowerKey)) {
HintProcessor hp = hintProcessors.get(lowerKey);
Component cmpSelected = null;
try {
// itself to which to apply the hint.
if (hp.applicableTo == HintProcessor.WIN) {
cmpSelected = cmp;
if (isContentPane(cmpSelected)) {
while (!(cmpSelected instanceof Window)) {
cmpSelected = cmpSelected.getParent();
}
}
// If this hint is allowed to be applied to either
// windows or non-windows, make sure content panes
// are replaced with their parent windows. This
// assumes however that a developer would never
// explicitly send in a content pane panel wanting
// these types of hints applied (this could be
// thought out better). However, right now this
// meets the need of 'visible' being applied to
// both Windows and non-content pane panels inside
// contained by the window.
} else if (hp.applicableTo == HintProcessor.BOTH) {
cmpSelected = cmp;
if (isContentPane(cmpSelected)) {
while (!(cmpSelected instanceof Window)) {
cmpSelected = cmpSelected.getParent();
}
}
// If this hint is for non-window components only,
// Make sure we apply it to the window's content pane
// IF original component is a window.
} else {
cmpSelected = cmp;
if (isContentPaneHolder(cmpSelected)) {
cmpSelected = ((RootPaneContainer) cmpSelected).getContentPane();
}
}
hp.process(value, cmpSelected, hints);
if (debugOn) {
System.out.println("Applied hint (" + lowerKey + "=" + value + ") to [" + cmpSelected + "]");
}
} catch (Exception e) {
// Soft fail (ClassCastException, NumberFormatException most common)
if (debugOn) {
System.err.println("Hint error (" + lowerKey + "=" + value + ") to [" + cmpSelected + "]");
e.printStackTrace();
}
}
}
}
}
use of javax.swing.RootPaneContainer in project jodd by oblac.
the class SwingSpy method showSpyDialog.
/**
* Shows spy dialog or reload existing one.
*
* @param rootComponent root component
* @param component current component
*/
public void showSpyDialog(final Component rootComponent, final Component component) {
if (spyDialog != null) {
spyDialog.setVisible(true);
spyGlass.setVisible(true);
spyPanel.reload(rootComponent, component);
return;
}
if (rootComponent instanceof RootPaneContainer) {
RootPaneContainer rootPane = (RootPaneContainer) rootComponent;
spyGlass = new SwingSpyGlassPane(rootPane);
rootPane.setGlassPane(spyGlass);
rootPane.getGlassPane().setVisible(true);
Toolkit.getDefaultToolkit().addAWTEventListener(spyGlass, AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
initSpyDialog(rootComponent, component);
}
});
}
use of javax.swing.RootPaneContainer in project intellij-community by JetBrains.
the class ScrollSettings method isInterpolationEligibleFor.
/* A heuristics that disables scrolling interpolation in diff / merge windows.
We need to to make scrolling synchronization compatible with the interpolation first.
NOTE: The implementation is a temporary, ad-hoc heuristics that is needed solely to
facilitate testing of the experimental "true smooth scrolling" feature. */
static boolean isInterpolationEligibleFor(JScrollBar scrollbar) {
Window window = (Window) scrollbar.getTopLevelAncestor();
if (window instanceof JDialog && "Commit Changes".equals(((JDialog) window).getTitle())) {
return false;
}
if (!(window instanceof RootPaneContainer)) {
return true;
}
Component[] components = ((RootPaneContainer) window).getContentPane().getComponents();
if (components.length == 1 && components[0].getClass().getName().contains("DiffWindow")) {
return false;
}
if (components.length == 2 && components[0] instanceof Container) {
Component[] subComponents = ((Container) components[0]).getComponents();
if (subComponents.length == 1) {
String name = subComponents[0].getClass().getName();
if (name.contains("DiffWindow") || name.contains("MergeWindow")) {
return false;
}
}
}
return true;
}
use of javax.swing.RootPaneContainer in project pcgen by PCGen.
the class CursorControlUtilities method startWaitCursor.
public static void startWaitCursor(JComponent component) {
RootPaneContainer root = ((RootPaneContainer) component.getTopLevelAncestor());
root.getGlassPane().setCursor(WAIT_CURSOR);
root.getGlassPane().addMouseListener(CLICK_CONSUMER);
root.getGlassPane().setVisible(true);
root.getRootPane().validate();
}
Aggregations