frame.setLayout(layout);
public void ctor0() { theFrame_ = new MyFrame(this); theFrame_.setLayout(new BorderLayout()); }
Frame frame = new Frame("LWJGL Game Window"); frame.setLayout(new BorderLayout()); Canvas canvas = new Canvas();
public void ctor1(final String name) { theFrame_ = new MyFrame(name, this); theFrame_.setLayout(new BorderLayout()); }
public MouseClick() { Frame f = new Frame("Addition Time!"); f.setLayout(null); // add this line
/** * DefaultConstructor. */ public PaintComponentFunction() { if ( PaintComponentFunction.isHeadless() == false ) { peerSupply = new Frame(); peerSupply.setLayout( new BorderLayout() ); } this.scale = 1; }
Frame myFrame; GridLayout myLayout = new GridLayout(2,1); myFrame.setLayout(myLayout); Panel p1; Panel p2; myFrame.add(p1); myFrame.add(p2);
Frame myFrame; myFrame.setLayout(new BorderLayout() ); Panel p1; Panel p2; myFrame.add(p1, BorderLayout.NORTH); myFrame.add(p2, BorderLayout.CENTER);
/** * Helper method for serialization. * * @param in * the input stream from where to read the serialized object. * @throws IOException * when reading the stream fails. * @throws ClassNotFoundException * if a class definition for a serialized object could not be found. */ private void readObject( final ObjectInputStream in ) throws IOException, ClassNotFoundException { in.defaultReadObject(); if ( PaintComponentFunction.isHeadless() == false ) { peerSupply = new Frame(); peerSupply.setLayout( new BorderLayout() ); } } }
/** * Return a completly separated copy of this function. The copy does no longer share any changeable objects with the * original function. * * @return a copy of this function. */ public Expression getInstance() { final PaintComponentFunction pc = (PaintComponentFunction) super.getInstance(); if ( PaintComponentFunction.isHeadless() == false ) { pc.peerSupply = new Frame(); pc.peerSupply.setLayout( new BorderLayout() ); } return pc; }
import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JPanel; public class Panel extends JPanel{ public static void main(String args []) { Frame frame = new Frame(); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 500); frame.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(); f.setLayout(null); Button b=new Button("Dummy"); //setBounds() methods accepts 4 // integer parameters /* 1. Location on x axis 2. Location on y axis 3. Width 4. Height */ b.setBounds(20,30,50,30); f.add(b);
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();
/** Main: make a Frame, add a FileTree */ public static void main(String[] av) { Frame frame = new Frame("FileTree"); frame.setForeground(Color.black); frame.setBackground(Color.lightGray); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); frame.setLayout(new BoxLayout(frame, BoxLayout.X_AXIS)); if (av.length == 0) frame.add(new FileTree(new File("."))); else for (int i=0; i<av.length; i++) frame.add(new FileTree(new File(av[i]))); frame.pack(); frame.setVisible(true); } }
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()); } }
/** * Create a screenshot image of a component. * * @param component * the component which screenshot will be created. * @return the created screenshot */ public static RenderedImage createScreenshot(Component component) throws Exception { if (component instanceof Frame) { return createScreenshot((Frame) component); } else { Frame frame = new Frame(); frame.setSize(component.getPreferredSize()); frame.setLayout(new BorderLayout()); frame.add(component, BorderLayout.CENTER); frame.setVisible(true); // wait some time for the display ThreadBoostUtils.sleep(1000); RenderedImage result = createScreenshot(frame); frame.dispose(); return result; } }
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(); }
protected String getAuthFromDialog() { PasswordPopup pp = new PasswordPopup(); Frame popup = new Frame("Authorization required"); popup.setBackground(Color.lightGray); popup.setSize(new Dimension(300, 200)); popup.setLayout(new BorderLayout()); popup.add("Center", pp); popup.show(); pp.init(); while(!pp.waitForCompletion()); popup.setVisible(false); if (pp.canceled()) return null; Base64Encoder encoder = new Base64Encoder(pp.getUserName()+":"+pp.getPassword()); popup.dispose(); return encoder.processString(); }
DataTable table = new DataTable(1,4,100,30); //creates table with 1 row (30px tall) and 4 columns (100px wide each) //table extends java.awt.Panel and it consists a 2D array of Labels which contain text //class has methods for adding rows and cols, and methods for setting values etc. table.setLocation(0, 0); ScrollPane scroll = new ScrollPane();//scroll pane scroll.setBounds(10, 50, 500, 100); scroll.add(table); Frame frame = new Frame(); frame.add(scroll); frame.setLayout(null); frame.setSize(600, 500); frame.setVisible(true); for ( int i=0 ; i<20 ; i++ ) { table.addRow();//add twenty rows to table }