Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / November 2006

Tip: Looking for answers? Try searching our database.

Java GUI help needed

Thread view: 
java_nut - 29 Nov 2006 17:18 GMT
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? Any ideas how to go about it?
Here is the current code:

clock.java

import java.awt.*;
import java.applet.*;
import java.util.*;

public class clock extends Applet implements Runnable
{
    Font f = new Font("ComicSans",Font.ITALIC,24);
    Date d; Thread runner;

   public void init()
   {resize(300,100);}

   public void paint(Graphics g)
   {g.setFont(f);g.drawString(d.toString(),10,50);}

   public void start()
   {
      while (runner == null)
      {
          runner = new Thread(this); runner.start();
      }
   }

   public void run()
   {
      while (true)
      {
          d = new Date(); repaint();
          try {Thread.sleep(1000);}
          catch(InterruptedException e){};
      }
   }
}

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: )
Andrew Thompson - 29 Nov 2006 21:33 GMT
> Hey guys,

Are you java_nut, summer_haven or multi_post?

Please stop that (randomly changing names, as
well as multi-posting).

(X-Post to c.l.j.h./p., w/f-u to c.l.j.h. only)

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.