Hi,all
I Want to Kow How can I delete a rectangle in SWT?
delete rectangle in SWT
Started by eman ahmed, Oct 15 2010 02:07 AM
4 replies to this topic
#1
Posted 15 October 2010 - 02:07 AM
|
|
|
#2
Posted 17 October 2010 - 02:44 AM
What do you mean "delete" a Rectangle in SWT? If you drop all references to a Rectangle object, the garbage collector will clean it up on it's own just like every other Java object, so the best way would be to simply remove the reference to the rectangle.
import org.eclipse.swt.graphics.Rectangle;
public class Main
{
public static void main(String[] args)
{
Rectangle r = new Rectangle(0, 0, 100, 100);
r = null; // GC will soon collect the now dereferenced Rectangle.
}
}
Wow I changed my sig!
#3
Posted 19 October 2010 - 10:44 AM
if I declacre new gc an write gc.drawrecangle(rectangle) ,the rectangle will drawn. after that if I write rectangle=null .I obsrved that the rectangle still in shell and doesn't deleted from the shell.
I want t o ask another question how can I make event when mouse scroll move
I want t o ask another question how can I make event when mouse scroll move
Edited by eman ahmed, 19 October 2010 - 01:18 PM.
#4
Posted 19 October 2010 - 11:09 AM
Just use an addMouseWheeelListener to the component you want to listen to;
How to Write a Mouse-Wheel Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
How to Write a Mouse-Wheel Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners)
#5
Posted 19 October 2010 - 11:09 AM
*double post*
Edited by Metalhead, 19 October 2010 - 11:11 AM.
Deleted duplicate post


Sign In
Create Account


Back to top









