當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。