Java Code Examples for java.awt.ScrollPane#setSize()

The following examples show how to use java.awt.ScrollPane#setSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScrollPanePreferredSize.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 2
Source File: ScrollPanePreferredSize.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 3
Source File: ScrollPanePreferredSize.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 4
Source File: ScrollPanePreferredSize.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 5
Source File: ScrollPanePreferredSize.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 6
Source File: ScrollPanePreferredSize.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 7
Source File: ScrollPanePreferredSize.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 8
Source File: ScrollPanePreferredSize.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 9
Source File: ScrollPanePreferredSize.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 10
Source File: VncClient.java    From cosmic with Apache License 2.0 6 votes vote down vote up
private Frame createVncClientMainWindow(final BufferedImageCanvas canvas, final String title) {
    // Create AWT windows
    final Frame frame = new Frame(title + " - VNCle");

    // Use scrolling pane to support screens, which are larger than ours
    final ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
    scroller.add(canvas);
    scroller.setSize(this.screen.getFramebufferWidth(), this.screen.getFramebufferHeight());

    frame.add(scroller);
    frame.pack();
    frame.setVisible(true);

    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(final WindowEvent evt) {
            frame.setVisible(false);
            shutdown();
        }
    });

    return frame;
}
 
Example 11
Source File: ScrollPanePreferredSize.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 12
Source File: ScrollPanePreferredSize.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 13
Source File: ScrollPanePreferredSize.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 14
Source File: ScrollPanePreferredSize.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(final String[] args) {
    final Dimension expected = new Dimension(300, 300);
    final Frame frame = new Frame();
    final ScrollPane sp = new ScrollPane();
    sp.setSize(expected);
    frame.add(sp);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    final Dimension size = frame.getSize();
    if (size.width < expected.width || size.height < expected.height) {
        throw new RuntimeException(
                "Expected size: >= " + expected + ", actual size: " + size);
    }
    frame.dispose();
}
 
Example 15
Source File: Client.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
protected static Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title, WindowListener windowListener) {
    // Create AWT windows
    Frame frame = new Frame(title + " - RDP");

    // Use scrolling pane to support screens, which are larger than ours
    scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
    scroller.add(canvas);
    scroller.setSize(canvas.getWidth(), canvas.getHeight());

    frame.add(scroller);
    frame.pack();
    frame.setVisible(true);

    frame.addWindowListener(windowListener);

    return frame;
}
 
Example 16
Source File: VncClient.java    From cloudstack with Apache License 2.0 6 votes vote down vote up
private Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title) {
    // Create AWT windows
    final Frame frame = new Frame(title + " - VNCle");

    // Use scrolling pane to support screens, which are larger than ours
    ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
    scroller.add(canvas);
    scroller.setSize(screen.getFramebufferWidth(), screen.getFramebufferHeight());

    frame.add(scroller);
    frame.pack();
    frame.setVisible(true);

    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent evt) {
            frame.setVisible(false);
            shutdown();
        }
    });

    return frame;
}