Results 1 to 3 of 3
  1. #1
    xSkittlesx is offline Member
    Join Date
    May 2010
    Posts
    7
    Rep Power
    0

    Question Changing an Applet to a JPanel

    Hi.. i made an applet but i want to put it into a JPanel container.

    any1 can help me? wer do i start?? sorry,im noob with java..

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,463
    Rep Power
    25

    Default

    Why? What are you going to do with the JPanel?
    See the API doc for JPanel to see how to "add" components to it.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    JApplets have contentPanes which I believe are usually JPanels (though they could be set to be any object derived from Container). So one way to derive a JPanel from a JApplet is to call getContentPane() on the JApplet object. Having said this, I'm not recommending that you do this, but rather you probably should re-write the app to create a JPanel from the beginning. Then if you want to place this JPanel in a JApplet or JFrame (or JDialog), you do so easily by calling getContentPane().add(myJPanel).

Similar Threads

  1. Changing default Applet Viewer Size?
    By dsym@comcast.net in forum Java Applets
    Replies: 6
    Last Post: 08-27-2010, 06:42 PM
  2. Replies: 3
    Last Post: 02-06-2010, 03:28 PM
  3. display a new jpanel in an applet
    By toymachiner62 in forum Java Applets
    Replies: 6
    Last Post: 10-18-2009, 11:10 PM
  4. Changing JPanel sizes
    By Basit in forum Java Applets
    Replies: 2
    Last Post: 08-12-2009, 06:48 PM
  5. how to draw x-y graph in Jpanel.--not in APPLET.
    By vincent2001@gmail.com in forum New To Java
    Replies: 2
    Last Post: 08-24-2008, 05:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •