• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

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 :

 
What's a year in metric? Do you know this metric stuff tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic