Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Jpanels, panes, containers and other stuff  (Read 1057 times)
0 Members and 1 Guest are viewing this topic.
Offline straydoginc

Junior Devvie





« Posted 2005-12-02 15:01:29 »

Okay in theory im hoping this is going to work. I set my applet to be 640 x 480 for the game screen. This screen is sectioned into 4 panes.

I am making each pane as a seperate class and hoping to add it to the container on the main class with each pane adding its own stuff to itself (buttons, strings, images, etc) and will be using GridBag Layout as each pane is a different size and doesn't do a 2,2 layout.

But. Since I am a n00b at java and know very little cause of experience. Im not sure if this is going to work. Does this sound like a right track or do i need to use the contructor and init() stuff on the main class to build and add items to each pane?
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #1 - Posted 2005-12-02 17:59:57 »

Sounds like you are doing ti right.

Offline noblemaster

« JGO Spiffy Duke »


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #2 - Posted 2005-12-02 18:59:22 »

Yes, sounds good. However, I noticed you mentioned "GridBagLayout".
Pretty much all the layout classes provided with the Java Standard package
are rather weak!

I stopped using them some time ago. The way to go is the "FormLayout"
class. You can find it at http://www.jgoodies.com/freeware/forms/index.html.
You can very flexible define the cell sizes etc. Same if you want to add buttons
and text to a panel.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline straydoginc

Junior Devvie





« Reply #3 - Posted 2005-12-02 20:35:29 »

Holy cow that looks neat. Imma check it out and see if it'll work for me. Learning more stuff all the time!

Im sure ill have much for questions after reading more into it!
Offline noblemaster

« JGO Spiffy Duke »


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #4 - Posted 2005-12-02 21:18:52 »

Yep! It's cool. Also, it's much better than wasting your time with the standard java layout classes!
Don't use GridLayout, GridBagLayout ... they just suck.

Offline straydoginc

Junior Devvie





« Reply #5 - Posted 2005-12-07 17:58:50 »

After reading the site for this.. im not sure how to implement this system? Any pointers. all i see are free downloads which give me examples but not sure if i just use their code and change stuff or is this a language i integrate into eclipse
Offline noblemaster

« JGO Spiffy Duke »


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #6 - Posted 2005-12-07 19:30:48 »

You do NOT need Eclipse. You can use the classes by themselves. For the layout,
just put "jgoodies-forms.jar" (or something like that) into your classpath. The "forms"
jar contains the layout classes.

The article is little bit hidden, but here it is (you should skim through it so you get the
idea):
http://www.jgoodies.com/articles/forms.pdf

And here how it would look to layout some stuff:
1  
2  
3  
4  
5  
6  
7  
8  
9  
FormLayout layout = new FormLayout(
    “pref, 4dlu, 50dlu, 4dlu, min”, // columns
    “pref, 2dlu, pref, 2dlu, pref”); // rows
JPanel panel = new JPanel(layout);
CellConstraints cc = new CellConstraints();

panel.add(new JLabel(“Label1”), cc.xy (1, 1));
panel.add(textField1, cc.xyw(3, 1, 3));
...


I didn't use the "look" package for look & feel. But there should be some info on their
web site as well.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!