Re: java GUI problems
"summer_haven" <gingercrock@hotmail.com> wrote in message
news:1164820780.918069.43350@14g2000cws.googlegroups.com...
Hey guys,
I've created two seperate GUIs in Java, one of which simply outputs the
current time while the other shows squares moving across the screen.. I
am aiming to to put both GUIs onto one window, so that in the upper box
is the current time and in the lower box is the moving squares. Is this
possible?
Yes, it's possible.
Any ideas how to go about it?
Here is the current code:
[most of the code snipped]
public class clock extends Applet implements Runnable
{
[...]
public void paint(Graphics g)
{g.setFont(f);g.drawString(d.toString(),10,50);}
[...]
The Square Box java code is very long so i will leave it out for now
unless it is needed by you?
Thanks for any help: )
Assuming your Square drawing program is also an applet and structured
similarly, you could just combine the two paint() methods together into one,
making the appropriate modifications so that the squares are below the
clock, instead of in the same location.
Alternatively, you could refactor the code so that instead of drawing
inside of an applet, you're drawing inside of a panel which is the sole
component inside the original applet. Then simply create a new applet which
adds these two panels to its main content frame.
- Oliver