use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class Dialog method modalityPushed.
final void modalityPushed() {
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof SunToolkit) {
SunToolkit stk = (SunToolkit) tk;
stk.notifyModalityPushed(this);
}
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class JPopupMenu method canPopupOverlapTaskBar.
/**
* Returns whether popup is allowed to be shown above the task bar.
*/
static boolean canPopupOverlapTaskBar() {
boolean result = true;
Toolkit tk = Toolkit.getDefaultToolkit();
if (tk instanceof SunToolkit) {
result = ((SunToolkit) tk).canPopupOverlapTaskBar();
}
return result;
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class MaximizedToMaximized method main.
public static void main(String[] args) throws Exception {
Frame frame = new Frame();
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();
final Dimension screenSize = toolkit.getScreenSize();
final Insets screenInsets = toolkit.getScreenInsets(graphicsDevice.getDefaultConfiguration());
final Rectangle availableScreenBounds = new Rectangle(screenSize);
availableScreenBounds.x += screenInsets.left;
availableScreenBounds.y += screenInsets.top;
availableScreenBounds.width -= (screenInsets.left + screenInsets.right);
availableScreenBounds.height -= (screenInsets.top + screenInsets.bottom);
frame.setBounds(availableScreenBounds.x, availableScreenBounds.y, availableScreenBounds.width, availableScreenBounds.height);
frame.setVisible(true);
Rectangle frameBounds = frame.getBounds();
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
((SunToolkit) toolkit).realSync();
Rectangle maximizedFrameBounds = frame.getBounds();
if (maximizedFrameBounds.width < frameBounds.width || maximizedFrameBounds.height < frameBounds.height) {
throw new RuntimeException("Maximized frame is smaller than non maximized");
}
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug7129742 method main.
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frame = new JFrame("Test");
TextArea textArea = new TextArea("Non-editable textArea");
textArea.setEditable(false);
frame.setLayout(new FlowLayout());
frame.add(textArea);
frame.pack();
frame.setVisible(true);
try {
Class XTextAreaPeerClzz = textArea.getPeer().getClass();
System.out.println(XTextAreaPeerClzz.getName());
if (!XTextAreaPeerClzz.getName().equals("sun.awt.X11.XTextAreaPeer")) {
fastreturn = true;
return;
}
Field jtextField = XTextAreaPeerClzz.getDeclaredField("jtext");
jtextField.setAccessible(true);
JTextArea jtext = (JTextArea) jtextField.get(textArea.getPeer());
caret = (DefaultCaret) jtext.getCaret();
textArea.requestFocusInWindow();
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
/* These exceptions mean the implementation of XTextAreaPeer is
* changed, this testcase is not valid any more, fix it or remove.
*/
frame.dispose();
throw new RuntimeException("This testcase is not valid any more!");
}
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
try {
if (fastreturn) {
return;
}
boolean passed = caret.isActive();
System.out.println("is caret visible : " + passed);
if (!passed) {
throw new RuntimeException("The test for bug 71297422 failed");
}
} finally {
frame.dispose();
}
}
});
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class TestDispose method testDispose.
public void testDispose() throws InvocationTargetException, InterruptedException {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frame = new JFrame("Test");
textField = new TextField("editable textArea");
textField.setEditable(true);
// textField.setEditable(false); // this testcase passes if textField is non-editable
frame.setLayout(new FlowLayout());
frame.add(textField);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
frame.dispose();
}
});
toolkit.realSync();
}
Aggregations