本文整理匯總了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();
}
示例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;
}
示例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();
}
}
示例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);
}
示例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");
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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";
}