permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes Positioning many panels... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Positioning many panels..." Watch "Positioning many panels..." New topic
Author

Positioning many panels...

Martin vanPutten
Ranch Hand

Joined: Mar 26, 2006
Posts: 124
I know you can position panels by using BorderLayout or even FlowLayout... but it doesn't get my panels exactly as I want them... is there a way to set them eactly where you want them by using a from left and from top method (like css for example)?


Live And Let Learn.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
It takes some time to learn how to use what's available. For the long haul: Using Layout Managers.
For now: Doing Without a Layout Manager (Absolute Positioning).
dave taubler
Ranch Hand

Joined: May 15, 2001
Posts: 132
Also, take a look at SpringLayout. It's a new-ish layout manager, and among other things it allows you to position components relative to the top/bottom/left/right of other components (including their own containers).


Dave Taubler<br />Specializing in <a href="http://taubler.com/articles/" target="_blank" rel="nofollow">Java and Web Development</a>
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38441
    
  23
I have tried examples with SpringLayout and couldn't understand them. have a look at this tutorial about GridBagLayout, and how Cay Horstmann recommends we simplify GridBagLayout with the GBC class. I like Horstmann's method, myself.
There are several pages about Layouts in the Java Tutorial.

[edit]I appear to have given some of the same links as Craig Wood[/edit]
[ April 05, 2007: Message edited by: Campbell Ritchie ]
Martin vanPutten
Ranch Hand

Joined: Mar 26, 2006
Posts: 124
I decided to stick with the absolute positioning... I like total control of my programs... but it gets this runtime error that I can't figure out... can anybody see anything.. this is one of my classes...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38441
    
  23
Tell us what the error is, please.
Martin vanPutten
Ranch Hand

Joined: Mar 26, 2006
Posts: 124
This is the runtime error...
Exception in thread "main" java.lang.NoSuchMethodError: ViewPanel.<init>(LListener V
at ViewManager.<init>(ViewManager.java:23)
at Game.main(Game.java:15)

Process completed.
I am using JCreator as my editor... this is exactly how it represents the error.
dave taubler
Ranch Hand

Joined: May 15, 2001
Posts: 132
It looks like you have a typo somewhere; either in the code that you posted, or in your actual code that you're trying to run. Did you inadvertantly create a class called "LListener" (with two "L"s), or just mistype?

At any rate, you are trying to invoke a ViewPanel constructor that apparently existed at one point, but no longer does. Try changing the argument list tha ViewManager passes to the ViewPanel constructor.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Positioning many panels...