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

How to delete components ?

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there.. does anyone out there know how to delete a button. For example if you added a button to a JPanel and then if you right click on it then it dissapears.
Or lets say youi draw a line and you want to get rid of the line , how do you do this. Lets assume that you know the cordinates of the line. Does anyone know how to do this? thanks in advance
 
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
To remove an actual component you would have to call remove( button ) and then call validate(), both on the JPanel (or other container) that holds the button.

Since a line isn't a component, but can only be painted on a component, you'll have to handle that in whatever component is painting the line on itself...

-Nate
 
reply
    Bookmark Topic Watch Topic
  • New Topic