A
Alex
Hello all!
I need to set correct frame size by its contents (applet). I tried
pack(), it shrinks frame making it too small.
How to size frame by its content, or how to set preferred size ?
AWT (note, AWT-only, no swing!) code:
//Main method
public static void main(String[] args) {
applet = new MicroCadApplet();
frame = new ContainerFrame();
frame.add(applet, BorderLayout.CENTER);
frame.setSize(applet.getWidth()+10,
applet.getHeight()+30);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2,
(d.height - frame.getSize().height) / 2);
frame.setVisible(true);
Plz do not send me to java.sun.com tutorials, its about swing.
I need to set correct frame size by its contents (applet). I tried
pack(), it shrinks frame making it too small.
How to size frame by its content, or how to set preferred size ?
AWT (note, AWT-only, no swing!) code:
//Main method
public static void main(String[] args) {
applet = new MicroCadApplet();
frame = new ContainerFrame();
frame.add(applet, BorderLayout.CENTER);
frame.setSize(applet.getWidth()+10,
applet.getHeight()+30);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2,
(d.height - frame.getSize().height) / 2);
frame.setVisible(true);
Plz do not send me to java.sun.com tutorials, its about swing.