use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug4361477 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() {
@Override
public void run() {
createAndShowUI();
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
bounds = tabbedPane.getUI().getTabBounds(tabbedPane, 0);
}
});
Point location = bounds.getLocation();
SwingUtilities.convertPointToScreen(location, tabbedPane);
robot.mouseMove(location.x + 1, location.y + 1);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
if (!bStateChanged) {
throw new RuntimeException("Tabbed pane state is not changed");
}
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug7161568 method main.
public static void main(String[] args) throws Exception {
UIManager.put("TabbedPane.selectionFollowsFocus", Boolean.FALSE);
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Robot robot = new Robot();
robot.setAutoDelay(50);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
createAndShowUI();
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
tabbedPane.requestFocus();
}
});
toolkit.realSync();
for (int i = 0; i < N; i++) {
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
toolkit.realSync();
}
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug7170310 method main.
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
SwingUtilities.invokeAndWait(bug7170310::createAndShowUI);
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
toolkit.realSync();
for (int i = 0; i < TABS_NUMBER; i++) {
SwingUtilities.invokeAndWait(bug7170310::addTab);
toolkit.realSync();
}
SwingUtilities.invokeAndWait(bug7170310::check);
if (exception != null) {
System.out.println("Test failed: " + exception.getMessage());
throw exception;
} else {
System.out.printf("Test passed");
}
} finally {
frame.dispose();
}
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug4530474 method main.
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
final Robot robot = new Robot();
robot.setAutoDelay(50);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
createAndShowGUI();
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
boolean passed = false;
Point p = jep.getLocationOnScreen();
Dimension d = jep.getSize();
int x0 = p.x;
int y = p.y + d.height / 3;
StringBuilder builder = new StringBuilder("Test color: ");
builder.append(TEST_COLOR.toString());
builder.append(" resut colors: ");
for (int x = x0; x < x0 + d.width; x++) {
Color color = robot.getPixelColor(x, y);
builder.append(color);
if (TEST_COLOR.equals(color)) {
passed = true;
break;
}
}
if (!passed) {
throw new RuntimeException("Test Fail. " + builder.toString());
}
}
});
}
use of sun.awt.SunToolkit in project jdk8u_jdk by JetBrains.
the class bug7165725 method execute.
public void execute(final String urlStr, final GoldenElement goldenElement) throws Exception {
System.out.println();
System.out.println("***** TEST: " + urlStr + " *****");
System.out.println();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
editorPane = new JEditorPane();
editorPane.setEditorKit(new HTMLEditorKit() {
public Document createDefaultDocument() {
AbstractDocument doc = (AbstractDocument) super.createDefaultDocument();
doc.setAsynchronousLoadPriority(-1);
return doc;
}
});
editorPane.setPage(new URL(urlStr));
} catch (IOException ex) {
throw new RuntimeException("Test failed", ex);
}
editorPane.setEditable(false);
JScrollPane scroller = new JScrollPane();
JViewport vp = scroller.getViewport();
vp.add(editorPane);
add(scroller, BorderLayout.CENTER);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(400, 400);
setLocationRelativeTo(null);
setVisible(true);
}
});
((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
HTMLDocument doc = (HTMLDocument) editorPane.getDocument();
doc.dump(System.out);
goldenElement.checkStructureEquivalence((AbstractElement) doc.getDefaultRootElement());
dispose();
}
});
System.out.println();
System.out.println("*********************************");
System.out.println();
}
Aggregations