Hi there, i could do with a bit of help please:
Ive got 2 classes at the moment:
km (km.java)
jPanel44 (jPanel44.java)
the km.java holds most of the details, and within it, ive got a jPanel,
named ghJPanel, this is set to a border layout, so ive got components in the
west,north,south and east, and the Center bit is; at the moment empty.
Now, in the other class jPanel44(jPanel44.java) Its set like, Form JPanel,
on there is the JPanel which is also set to border, on there ive got
mainPanel44.
What i now want is a way that i can show(setVisible(true);) the mainPanel44,
on the CENTER part of the ghJPanel
I just cant work out what do do :S
Im going to use a button on the km Form, so when clicked it shows the
mainPanel44
Anyone got any ideas?
Help would be greatly apreciated
Thanks
Andrew Thompson - 04 Nov 2003 13:55 GMT
> Hi there, i could do with a bit of help please:
It sounds, from your description, that you are putting
the program logic into the GUI elements.
This is not good design.
Try to imagine how you would code your
app to work from the command line / DOS
window. In fact, _make_ it work from the
command line.
_Then_ write a GUI to interact with it.
--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/
={ Advocated }= - 05 Nov 2003 11:41 GMT
> > Hi there, i could do with a bit of help please:
>
[quoted text clipped - 15 lines]
> http://www.PhySci.org/
> http://www.1point1C.org/
i can already run the program from dos if i wish to, but this program is
really only for me, so i can test something. The GUI is the main part of it,
and the way i wanted it to work is so all the logic is actually with the GUI
components.
Ive read some articles etc, and have tried doing:
private void start44MouseClicked(java.awt.event.MouseEvent evt) {
gridHouseJPanel.add(mainPanel44, java.awt.BorderLayout.CENTER);
}
this should mean, that when the mouse is clicked, the mainPanel44 should be
loaded onto the gridHouseJPanel.
The mainPanel44 is from the JPanel44 class, and the gridHouseJPanel is from
the km class.
I assumed this would work, obviously not, i get the error:
"
Java/Assessment/Km/km.java [104:1] cannot resolve symbol
symbol : variable mainPanel44
location: class Java.Assessment.km.km
gridHouseJPanel.add(mainPanel44, java.awt.BorderLayout.CENTER);
^
1 error
Errors compiling km.
"
Anyone know what im missing, i cant work it out? i tried also making the
mainPanel44 public but it shouldnt matter as both are in the same package
Thanks all
={ Advocated }= - 05 Nov 2003 19:31 GMT
> > > Hi there, i could do with a bit of help please:
> >
[quoted text clipped - 47 lines]
>
> Thanks all
You wouldnt think this was difficult would u... :p