So i ve managed to create different shapes in my GUI window. But how would i go about deleting a certain shape or line from the window when I press delete on my GUI screen?

7 Years
Discussion Span
Last Post by Katana24

I managed to solve this myself but thanks to masijade for his help.
What you have to do is delete the value from the binary search tree and then update the tree.
Here's the code that I have which is attached to a "Delete" button on my GUI:

JButton delete = new JButton("Delete");
delete.addActionListener(new ActionListener()
		public void actionPerformed(ActionEvent e)
	        deleteIt(checkTree());	// Get item to be deleted
		Shapes widget;		// Update the BST with the info
		widget = new Shapes();


myFrame is actually the name of the frame for my GUI. The shapes class draws all the shapes that I need.

Hope this helps anyone that needs it. If you need more help send me a message :P

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.