File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Turning app from JFrame to JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Turning app from JFrame to JPanel " Watch "Turning app from JFrame to JPanel " New topic
Author

Turning app from JFrame to JPanel

Dave Johnson
Ranch Hand

Joined: May 25, 2003
Posts: 111
Got this app that is clock. I want to put the clock into my program as part of the exsisting layout. The clock is currently a JFrame I want to the clock as a JPanel instead.
Here is the code:

Could anyone show me what alterations are necessary to the code? Also what code is needed to add it to the JFrame on the main program i.e. will I need to setSize() or anything?
Thanks, Dave.
[ January 07, 2004: Message edited by: Dave Johnson ]
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
If you look at the code carefully, you will see it is actually already a panel (ClockPanel). There are many ways to change it. Here is one:

[ January 08, 2004: Message edited by: Brian Pipa ]

My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
Dave Johnson
Ranch Hand

Joined: May 25, 2003
Posts: 111
Sorry I am so late but thankyou very much Brian!!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Turning app from JFrame to JPanel
 
Similar Threads
Cannot Convert String to Int. Clock question.
Continously updated date field in GridBagLayout does not work
displaying time
anyone good at math?
Clock