frame.setSize(width, height); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation((screenSize.width - width) / 2,
frame.setSize(screenSize);
@Override public void run() { frame.setSize(w, h); } });
public void setSize(final int width, final int height) { theFrame_.setSize(width, height); } public void show() {
boolean correctAspectRatio = ...; // check to see if new size meets aspect ratio requirements if (!correctAspectRatio) { final Frame _frame = this; final int _width = ...; // calculated width final int _height = ...; // calculated height SwingUtilities.invokeLater(new Runnable(){ public void run() { _frame.setSize(_width, _height); } }); }
private static void setInitialFrameBounds( Frame frame ) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = screenSize.width * 2 / 3; int height = width * 2 / 3; frame.setSize( width, height ); EditorUtilities.centerWindowInFrame( frame, frame ); }
public void setImageSize(int width, int height) { width = width + (width % 4); height = height + (height % 4); frame.setSize(width + WINDOW_PADDING_X, height + WINDOW_PADDING_Y); imageCopy = new GLBufferedImageCanvas(width, height); }
@Override public void actionPerformed(ActionEvent e) { String value = JOptionPane.showInputDialog("Enter dimensions, e.g. 800x400"); if (value != null) { String[] vals = value.split("x"); if (vals.length == 2) { int w = Integer.parseInt(vals[0]); int h = Integer.parseInt(vals[1]); IGV.getMainFrame().setSize(w, h); } } } };
public void appletResize(int width, int height) { checkDestroyed(); Insets insets = frame.getInsets(); frame.setSize(width + insets.left + insets.right, height + insets.top + insets.bottom); }
public static void main(String[] args) { Frame frame = new CircleDraw(); frame.addWindowListener(new WindowAdapter() { public void windowClosing (WindowEvent we) { System.exit(0); } });//end of listener frame.setSize(600,600); frame.setVisible(true); }
public void replay(IComponentEventLog component) { if(component.getType().equals(ComponentEventType.COMPONENT_RESIZED)){ Dimension size = component.getSize(); frame.setSize(size); } //log(component, " not supported"); }
public static void main(String[] args) { Frame frame = new Frame("Lab33ast"); frame.add(new GfxApp()); frame.setSize(100, 750); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); }
public static void main(String... args) { // create the cursor Toolkit t = Toolkit.getDefaultToolkit(); Image i = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); Cursor noCursor = t.createCustomCursor(i, new Point(0, 0), "none"); // try it with a normal frame Frame f = new Frame(); // create the GLCanvas and add it to the frame GLCanvas canvas = new GLCanvas(); frame.add(canvas); f.setCursor(noCursor); f.setSize(400, 200); f.setVisible(true); }
protected void popupDialog() { if(popup == null) { PasswordEditor pe = new PasswordEditor(this, name); popup = new Frame("Jigsaw Password Editor"); popup.setBackground(Color.lightGray); popup.setSize(new Dimension(300, 200)); popup.setLayout(new BorderLayout()); popup.add("Center", pe); popup.show(); pe.passwd.requestFocus(); } }
Frame f - new Frame(); Panel yourGame = new Hangman(); yourGame.init(); f.add(yourGame); f.setSize(300, 300); f.setVisible(true);
Frame f=new Frame(); //specify the layout f.setLayout(new FlowLayout()); Button b=new Button("Dummy button"); Label l=new Label("hello from java"); f.add(l); f.add(b); f.setTitle("nick's app"); //specify the size of window f.setSize(200,200); //make your frame visible f.show();
Frame frame = new Frame("test"); GLCanvas canvas; FPSAnimator animator; GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(true); caps.setHardwareAccelerated(true); canvas = new GLCanvas(caps); animator = new FPSAnimator(canvas, 60); canvas.addGLEventListener(new Renderer()); frame.add(canvas); frame.setSize(600, 600); animator.start();
public void popupDialog(String name) { if(popup == null) { AuthPopup ap = new AuthPopup(this, name); popup = new Frame("Authorization for jigadm"); popup.setBackground(Color.lightGray); popup.setSize(new Dimension(300, 200)); popup.setLayout(new BorderLayout()); popup.add("Center", ap); popup.show(); ap.user.requestFocus(); while(!ap.waitForCompletion()); } }
public static void main(final String[] args) { final Frame frame = new Frame("JOGL Version Applet"); frame.setSize(800, 600); frame.setLayout(new BorderLayout()); final VersionApplet va = new VersionApplet(); frame.addWindowListener(new ClosingWindowAdapter(frame, va)); va.init(); frame.add(va, BorderLayout.CENTER); frame.validate(); frame.setVisible(true); va.start(); }
Frame frame=new Frame("Button Frame"); Button button = new Button("Submit"); HorizontalPanel hp = new HorizontalPanel(); hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); hp.setWidth(200); hp.add(button); frame.add(hp); frame.setSize(200,100); frame.setVisible(true);