当前位置: 首页>>代码示例>>Java>>正文


Java Frame.setSize方法代码示例

本文整理汇总了Java中java.awt.Frame.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java Frame.setSize方法的具体用法?Java Frame.setSize怎么用?Java Frame.setSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Frame的用法示例。


在下文中一共展示了Frame.setSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: OverScrollTest

import java.awt.Frame; //导入方法依赖的package包/类
OverScrollTest() {
    try {
        robot = new Robot();
    } catch (Exception ex) {
        throw new RuntimeException(ex.getMessage());
    }

    mainFrame = new Frame();
    mainFrame.setSize(400, 200);
    mainFrame.setLocation(200, 200);
    mainFrame.setLayout(new FlowLayout());

    textArea = new TextArea(2, 10);
    textArea.setSize(300, 100);
    textArea.setText("123456 789123");
    mainFrame.add(textArea);
    mainFrame.setVisible(true);
    textArea.requestFocusInWindow();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:OverScrollTest.java

示例2: doTest

import java.awt.Frame; //导入方法依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:MaximizedNormalBoundsUndecoratedTest.java

示例3: main

import java.awt.Frame; //导入方法依赖的package包/类
public static void main(final String[] args) {
  // final Visualization visualization = new Visualization();
  // visualization.showModel();
  // visualization.showMetamodel();

  try {
    JPanel panel = GraphMaker.produceGraph(createFileSystemExample());
    Frame frame = new JFrame("");
    frame.add(panel);
    frame.setVisible(true);
    frame.setSize(600, 600);
  } catch (ErrorFatal e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }

}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:Test.java

示例4: createPartControl

import java.awt.Frame; //导入方法依赖的package包/类
@Override
public void createPartControl(final Composite parent) {
  final Object viewer = Test.getViewer();

  final Composite composite = new Composite(parent, SWT.EMBEDDED);
  final Frame frame = SWT_AWT.new_Frame(composite);
  frame.setTitle("Antlr AST");

  scrollPane = new JScrollPane();
  scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setBounds(0, 0, 500, 500);

  scrollPane.getViewport().add((Component) viewer);

  frame.add(scrollPane);
  // frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame.setSize(Toolkit.getDefaultToolkit().getScreenSize().width, 500);
  frame.setVisible(true);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:21,代码来源:ParseTreeView.java

示例5: main

import java.awt.Frame; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    GraphicsDevice[] sds = GraphicsEnvironment.getLocalGraphicsEnvironment()
                                              .getScreenDevices();
    for (final GraphicsDevice gd : sds) {
        fail = true;
        Robot robot = new Robot(gd);
        robot.setAutoDelay(100);
        robot.setAutoWaitForIdle(true);

        Frame frame = new Frame(gd.getDefaultConfiguration());
        frame.setUndecorated(true);
        frame.setSize(400, 400);
        frame.setVisible(true);
        robot.waitForIdle();

        frame.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                System.out.println("e = " + e);
                fail = false;
            }
        });

        Rectangle bounds = frame.getBounds();
        robot.mouseMove(bounds.x + bounds.width / 2,
                        bounds.y + bounds.height / 2);
        robot.mousePress(MouseEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(MouseEvent.BUTTON1_DOWN_MASK);
        frame.dispose();
        if (fail) {
            System.err.println("Frame bounds = " + bounds);
            throw new RuntimeException("Click in the wrong location");
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:36,代码来源:MultiScreenRobotPosition.java

示例6: main

import java.awt.Frame; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {


        Frame frame = new Frame();
        frame.setSize(300, 300);
        frame.setVisible(true);
        Robot robot = new Robot();
        robot.setAutoDelay(50);
        robot.waitForIdle();


        robot.keyPress(KeyEvent.VK_DELETE);
        robot.keyRelease(KeyEvent.VK_DELETE);
        robot.waitForIdle();

        frame.dispose();

        if (eventsCount != 3) {
            throw new RuntimeException("Wrong number of key events: " + eventsCount);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:KeyCharTest.java

示例7: main

import java.awt.Frame; //导入方法依赖的package包/类
public static void main(String args[]) {
    Frame f = new Frame("DrawTest");
    DrawTest drawTest = new DrawTest();
    drawTest.init();
    drawTest.start();

    f.add("Center", drawTest);
    f.setSize(300, 300);
    f.setVisible(true);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:DrawTest.java

示例8: main

import java.awt.Frame; //导入方法依赖的package包/类
/**
 * Method declaration
 *
 *
 * @param arg
 */
public static void main(String arg[]) {

    fMain = new Frame("Query Tool");

    QueryTool q = new QueryTool();

    q.bApplication = true;

    for (int i = 0; i < arg.length; i++) {
        String p = arg[i];

        if (p.equals("-?")) {
            printHelp();
        }

        if (p.charAt(0) == '-') {
            pProperties.put(p.substring(1), arg[i + 1]);

            i++;
        }
    }

    q.init();
    q.start();
    fMain.add("Center", q);

    MenuBar menu = new MenuBar();
    Menu    file = new Menu("File");

    file.add("Exit");
    file.addActionListener(q);
    menu.add(file);
    fMain.setMenuBar(menu);
    fMain.setSize(500, 400);
    fMain.show();
    fMain.addWindowListener(q);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:44,代码来源:QueryTool.java

示例9: main

import java.awt.Frame; //导入方法依赖的package包/类
public static void main(final String[] args) throws AWTException {
    final Frame frame = new Frame();
    final Component label = new PaintNativeOnUpdate();
    frame.setBackground(Color.RED);
    frame.add(label);
    frame.setSize(300, 300);
    frame.setUndecorated(true);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    sleep();
    label.repaint();// first paint
    sleep();
    label.repaint();// incremental paint
    sleep();

    Robot robot = new Robot();
    robot.setAutoDelay(50);
    Point point = label.getLocationOnScreen();
    Color color = robot.getPixelColor(point.x + label.getWidth() / 2,
                                      point.y + label.getHeight() / 2);
    if (!color.equals(Color.GREEN)) {
        System.err.println("Expected color = " + Color.GREEN);
        System.err.println("Actual color = " + color);
        throw new RuntimeException();
    }
    frame.dispose();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:PaintNativeOnUpdate.java

示例10: main

import java.awt.Frame; //导入方法依赖的package包/类
public static void main(final String[] args) {
    for (int i = 0; i < 10; ++i) {
        final Frame frame = new Frame();
        frame.setSize(300, 300);
        frame.setLocationRelativeTo(null);
        LabelRepaint label = new LabelRepaint();
        frame.add(label);
        frame.setVisible(true);
        sleep();
        label.test();
        frame.dispose();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:LabelRepaint.java

示例11: setUp

import java.awt.Frame; //导入方法依赖的package包/类
public void setUp() {
	frame = new Frame();
	panel = new Panel();
	frame.add(panel);
	frame.setSize(400,400);
	panel.setSize(400,400);
	gsys = new G3DSys(panel);
}
 
开发者ID:etomica,项目名称:etomica,代码行数:9,代码来源:G3DTest.java

示例12: run

import java.awt.Frame; //导入方法依赖的package包/类
@Override
public void run() {
    contextToDispose = SunToolkit.createNewAppContext();
    Frame f = new Frame();
    f.setSize(300, 300);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    thread = new Thread(() -> {
        while(true);
    });
    thread.start();
    sync();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ApplicationThreadsStop.java

示例13: main

import java.awt.Frame; //导入方法依赖的package包/类
public static void main(String args[]) {
    Frame f = new Frame("CardTest");
    CardTest cardTest = new CardTest();
    cardTest.init();
    cardTest.start();

    f.add("Center", cardTest);
    f.setSize(300, 300);
    f.setVisible(true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:CardTest.java

示例14: main

import java.awt.Frame; //导入方法依赖的package包/类
public static void main(final String[] args) {
    final Frame frame = new Frame();
    frame.setSize(200, 200);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    for (int i = 0; i < 1000; ++i) {
        frame.setSize(100, 100);
        frame.setSize(200, 200);
        frame.setSize(300, 300);
    }
    frame.dispose();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:FrameSetSizeStressTest.java

示例15: EOLTest

import java.awt.Frame; //导入方法依赖的package包/类
public EOLTest() {
    mainFrame = new Frame();
    mainFrame.setSize(200, 200);
    mainFrame.setVisible(true);
    testFailMessage = new StringBuilder();
    testStrEOL = "Row1" + System.lineSeparator() + "Row2\nRow3";
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:EOLTest.java


注:本文中的java.awt.Frame.setSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。