Sign in to follow this  

Java layout

Recommended Posts

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?

Share this post

Link to post
Share on other sites

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!

Share this post

Link to post
Share on other sites
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");
// blah blah blah
Dimension d = b.getPreferredSize();

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?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this