• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

how do I remove a JPanel from a contentPane?

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am working on a program and when it starts a splash screen appears. After 5 seconds I would like it to disappear. I have no problem making the splash screen appear but I am stumped with removing it. Here is how I have it setup:
Under the a class FrameSet(extends JFrame), I have:
Container contentPane = getContentPane();
WorkAreaPanel workArea = new WorkAreaPanel(); //extends JPanel, displays jpeg using g2d.Drawimage
contentPane.add(workArea);
this works fine.. I assume to remove it I would use:
contentPane.remove(workArea); OR
contentPane.removeAll;
no luck, simply having either of these last lines in there causes the workArea(which is my splash screen) to never appear.
help!
Are there any good tutorials on this?
Thanks!
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're going to have to have a thread to control this... something like the example below :

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic