Java layout
I want to do away with Layout Managers in my applet, and manually position the controls myself. The default layout manager, I think, is a FlowLayout. When I try the following code (that was suggested to me in an earlier post):
this.setLayout(NULL); // "this" is the applet
javac complains that it doesn't know what 'variable NULL' is. SO for now I'm stuck with the FlowLayout. I've tried to manually override this manager by specifying certain buttons and relocating them with the setLocation method, but it seems to ignore them due to the default layout manager.
Does anybody have any ideas?
Quote:javac complains that it doesn't know what 'variable NULL' is
In Java, it is defined as null, no caps.
Hi,
I've had the same problem with layout managers myself. Until you get used to working with them, its a lot easier to get rid of it and just nail everything down where you want it.
Your problem is that Java uses 'null' while C++ generally uses 'NULL', Java is very case sensitive. Other than that small difference, that command should do what you need it to.
Good luck!
I've had the same problem with layout managers myself. Until you get used to working with them, its a lot easier to get rid of it and just nail everything down where you want it.
Your problem is that Java uses 'null' while C++ generally uses 'NULL', Java is very case sensitive. Other than that small difference, that command should do what you need it to.
Good luck!
okay wow so now i have an entirely different problem altogether...
i am writing the applet on my laptop, and have manually positioned all the controls without a layout manager. I have done so using the follow method for all the controls:
JButton b = new JButton("To Heck with Layout Managers");
b.add(this);
// blah blah blah
Dimension d = b.getPreferredSize();
b.setBounds(45,35,d.width,d.height);
And so - on my laptop = everything looks perfect, just the way I want it. SO far so good...
So I save the applet to disc and then run it off my desktop, which has a much larger monitor, and guess what...everything is now distorted.
The applet doesn't fit on the desktop's screen. :-(
I fear the problem is stemming from the resolution/pixel differential between my laptop's and desktop's monitors. The problem is, I absolutely need a homogenous look and appearance amongst all the controls, regardless of what size monitor the applet user is using. How can I get such uniformity?
i am writing the applet on my laptop, and have manually positioned all the controls without a layout manager. I have done so using the follow method for all the controls:
JButton b = new JButton("To Heck with Layout Managers");
b.add(this);
// blah blah blah
Dimension d = b.getPreferredSize();
b.setBounds(45,35,d.width,d.height);
And so - on my laptop = everything looks perfect, just the way I want it. SO far so good...
So I save the applet to disc and then run it off my desktop, which has a much larger monitor, and guess what...everything is now distorted.
The applet doesn't fit on the desktop's screen. :-(
I fear the problem is stemming from the resolution/pixel differential between my laptop's and desktop's monitors. The problem is, I absolutely need a homogenous look and appearance amongst all the controls, regardless of what size monitor the applet user is using. How can I get such uniformity?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement