use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class AlwaysOnTopFieldTest method main.
public static void main(String[] args) {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Window window = new Frame("Window 1");
window.setSize(200, 200);
window.setAlwaysOnTop(true);
window.setVisible(true);
toolkit.realSync();
Dialog dialog = new Dialog(window, "Owned dialog 1");
dialog.setSize(200, 200);
dialog.setLocation(100, 100);
dialog.setVisible(true);
toolkit.realSync();
try {
if (!window.isAlwaysOnTop()) {
throw new RuntimeException("Window has wrong isAlwaysOnTop value");
}
if (!dialog.isAlwaysOnTop()) {
throw new RuntimeException("Dialog has wrong isAlwaysOnTop value");
}
} finally {
window.dispose();
dialog.dispose();
}
window = new Frame("Window 2");
window.setSize(200, 200);
window.setVisible(true);
toolkit.realSync();
dialog = new Dialog(window, "Owned dialog 2");
dialog.setSize(200, 200);
dialog.setLocation(100, 100);
dialog.setVisible(true);
toolkit.realSync();
window.setAlwaysOnTop(true);
toolkit.realSync();
try {
if (!window.isAlwaysOnTop()) {
throw new RuntimeException("Window has wrong isAlwaysOnTop value");
}
if (!dialog.isAlwaysOnTop()) {
throw new RuntimeException("Dialog has wrong isAlwaysOnTop value");
}
} finally {
window.dispose();
dialog.dispose();
}
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class MultiResolutionToolkitImageTest method testToolkitMultiResolutionImageLoad.
static void testToolkitMultiResolutionImageLoad() throws Exception {
File imageFile = new File(IMAGE_NAME_1X);
String fileName = imageFile.getAbsolutePath();
Image image = Toolkit.getDefaultToolkit().getImage(fileName);
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
toolkit.prepareImage(image, -1, -1, new LoadImageObserver());
final long time = WAIT_TIME + System.currentTimeMillis();
while ((!isImageLoaded || !isRVObserverCalled) && System.currentTimeMillis() < time) {
Thread.sleep(50);
}
if (!isImageLoaded) {
throw new RuntimeException("Image is not loaded!");
}
if (!isRVObserverCalled) {
throw new RuntimeException("Resolution Variant observer is not called!");
}
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug8032874 method main.
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
createAndShowUI();
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
table.getRowSorter().toggleSortOrder(0);
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
table.setRowSelectionInterval(1, 2);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
for (int i = 0; i < ROW_COUNT; i++) {
tableModel.remove(0);
table.getRowSorter().toggleSortOrder(0);
}
}
});
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug4908142 method main.
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Robot robot = new Robot();
robot.setAutoDelay(50);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createAndShowGUI();
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
tree.requestFocus();
tree.setSelectionRow(0);
}
});
toolkit.realSync();
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
robot.keyPress(KeyEvent.VK_D);
robot.keyRelease(KeyEvent.VK_D);
toolkit.realSync();
String sel = Util.invokeOnEDT(new Callable<String>() {
@Override
public String call() throws Exception {
return tree.getLastSelectedPathComponent().toString();
}
});
if (!"aad".equals(sel)) {
throw new Error("The selected index should be \"aad\", but not " + sel);
}
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug6263446 method main.
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
robot = new Robot();
robot.setAutoDelay(50);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createAndShowGUI();
}
});
toolkit.realSync();
Point point = getClickPoint();
robot.mouseMove(point.x, point.y);
toolkit.realSync();
click(1);
toolkit.realSync();
assertEditing(false);
click(2);
toolkit.realSync();
checkSelectedText(null);
click(3);
toolkit.realSync();
checkSelectedText(FIRST);
click(4);
toolkit.realSync();
checkSelectedText(ALL);
setClickCountToStart(1);
click(1);
toolkit.realSync();
checkSelectedText(null);
click(2);
toolkit.realSync();
checkSelectedText(FIRST);
click(3);
toolkit.realSync();
checkSelectedText(ALL);
setClickCountToStart(3);
click(1);
toolkit.realSync();
assertEditing(false);
click(2);
toolkit.realSync();
assertEditing(false);
click(3);
toolkit.realSync();
checkSelectedText(null);
click(4);
toolkit.realSync();
checkSelectedText(FIRST);
click(5);
toolkit.realSync();
checkSelectedText(ALL);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
table.editCellAt(0, 0);
}
});
toolkit.realSync();
assertEditing(true);
click(2);
toolkit.realSync();
checkSelectedText(FIRST);
}
Aggregations