Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » highlight my node(my node is customed and want highlight it in mouseover)
highlight my node [message #1015355] Thu, 28 February 2013 05:31 Go to next message
Mokhtar Abdu is currently offline Mokhtar Abdu
Messages: 99
Registered: November 2011
Member
Hi,
can you help me with highlighting my node by mouseover action? I have traced how graph node is hghlighted like here
public void highlightNode(IFigure nodeFigure) {
		this.numberOfNodes--;
		int highlightNodePosition = getHighlightNodePosition();
		this.numberOfHighlightedNodes++;
		this.getChildren().remove(nodeFigure);
		this.getChildren().add(highlightNodePosition, nodeFigure);
		this.invalidate();
		this.repaint();
	}

this also is invoked via mouse pressed but it seems that it change the backcolor for the figure that i have filled with labels and stuff, thus i dont see the color change.
I want to highlight the border only of my node (see image) and by mouseover sothat when i press only, i can do some action.
http://oi50.tinypic.com/2h34e3a.jpg
Thanks in advance
Mok
Re: highlight my node [message #1015649 is a reply to message #1015355] Fri, 01 March 2013 09:22 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
Messages: 402
Registered: December 2009
Location: Prague
Senior Member
Hi,

sorry but I really don't understand what do you want to achieve. What in the picture you've posted do you want to highlight and when?
Re: highlight my node [message #1015698 is a reply to message #1015649] Fri, 01 March 2013 14:19 Go to previous messageGo to next message
Mokhtar Abdu is currently offline Mokhtar Abdu
Messages: 99
Registered: November 2011
Member
sorry for confusion. I want to highlight the border or the background of my graph node when the mouse is over it. so that the user knows that she can click.

Regards,
mok
Re: highlight my node [message #1015704 is a reply to message #1015698] Fri, 01 March 2013 15:14 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
Messages: 402
Registered: December 2009
Location: Prague
Senior Member
Well,

you can do that by using MouseMotionListener:

figure.addMouseMotionListener(new MouseMotionListener.Stub() {

	@Override
	public void mouseEntered(MouseEvent me) {
		final IFigure figure = (IFigure) me.getSource();
		((LineBorder) figure.getBorder()).setColor(ColorConstants.blue);
		figure.repaint();
	}

	@Override
	public void mouseExited(MouseEvent me) {
		final IFigure figure = (IFigure) me.getSource();
		((LineBorder) figure.getBorder()).setColor(ColorConstants.black);
		figure.repaint();
	}
			
});
Re: highlight my node [message #1015707 is a reply to message #1015704] Fri, 01 March 2013 15:35 Go to previous message
Mokhtar Abdu is currently offline Mokhtar Abdu
Messages: 99
Registered: November 2011
Member
Thank you!
Previous Topic:draw2d without GEF in an e4 environment
Next Topic:How to add new Layers and show specific figures in Them?
Goto Forum:
  


Current Time: Sun May 19 01:21:21 EDT 2013

Powered by FUDForum. Page generated in 0.01573 seconds