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 / JFace and the fly likes How to delete components ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "How to delete components ?" Watch "How to delete components ?" New topic
Author

How to delete components ?

Avin Sinanan
Ranch Hand

Joined: Nov 07, 2001
Posts: 109
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


yours respectfully<br />Avin Sinanan
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4120

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


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
 
subject: How to delete components ?
 
Threads others viewed
How to display Database query in JSP?
MouseListener / Right Click ?
How to get size of AudioClip?
Writing a File and Request Dispatcher Forward
properties file editing
IntelliJ Java IDE