use of java.awt.Dimension in project jdk8u_jdk by JetBrains.
the class Test6524757 method addSize.
private static void addSize(List<Object> list, Component component, int x, int y, int w, int h) {
Dimension size = component.getPreferredSize();
int width = (size.width + 1) / w - x;
int height = (size.height + 1) / h - y;
list.add(new Dimension(width, height));
}
use of java.awt.Dimension in project jdk8u_jdk by JetBrains.
the class bug8136998 method runTest.
public void runTest() throws Exception {
try {
SwingUtilities.invokeAndWait(this::setupUI);
robot.waitForIdle();
SwingUtilities.invokeAndWait(() -> scrollPane.getViewport().scrollRectToVisible(comboBox.getBounds()));
robot.waitForIdle();
// Move mouse pointer to the center of the combo box
Point p = comboBox.getLocationOnScreen();
Dimension d = comboBox.getSize();
robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2);
// The currently visible rectangle in scrollPane
Rectangle viewRect0 = Util.invokeOnEDT(scrollPane.getViewport()::getViewRect);
// Scroll the scrollPane with mouse wheel
robot.mouseWheel(1);
robot.waitForIdle();
// The updated rectangle
Rectangle viewRect1 = Util.invokeOnEDT(scrollPane.getViewport()::getViewRect);
if (viewRect0.y == viewRect1.y) {
throw new RuntimeException("Mouse wheel should have scrolled the JScrollPane");
}
} finally {
if (frame != null) {
frame.dispose();
}
}
System.out.println("Test passed");
}
use of java.awt.Dimension in project jdk8u_jdk by JetBrains.
the class MaximizedNormalBoundsUndecoratedTest method doTest.
boolean doTest() {
Dimension beforeMaximizeCalled = new Dimension(300, 300);
frame = new Frame("Test Frame");
frame.setUndecorated(true);
frame.setFocusable(true);
frame.setSize(beforeMaximizeCalled);
frame.setVisible(true);
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setExtendedState(Frame.NORMAL);
Dimension afterMaximizedCalled = frame.getBounds().getSize();
frame.dispose();
if (beforeMaximizeCalled.equals(afterMaximizedCalled)) {
return true;
}
return false;
}
use of java.awt.Dimension in project jdk8u_jdk by JetBrains.
the class bug8032667 method getCheckBox.
static JCheckBox getCheckBox(String text, boolean selected) {
JCheckBox checkBox = new JCheckBox(text);
checkBox.setSelected(selected);
checkBox.setSize(new Dimension(width, height));
return checkBox;
}
use of java.awt.Dimension in project jdk8u_jdk by JetBrains.
the class Test6910490 method init.
@Override
public void init() {
Insets insets = new Insets(10, 10, 10, 10);
Dimension size = new Dimension(getWidth() / 2, getHeight());
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, create("Color", size, new MatteBorder(insets, RED)), create("Icon", size, new MatteBorder(insets, this)));
pane.setDividerLocation(size.width - pane.getDividerSize() / 2);
add(pane);
}
Aggregations