Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Only when I deselect the figure, I get the the desired effect :-(
Only when I deselect the figure, I get the the desired effect :-( [message #209297] Mon, 13 February 2006 19:56 Go to next message
Eclipse UserFriend
Originally posted by: ddv.certi.org.br

The code bellow is suppose to draw this figure

name |
------

When I change "name" to "n", this is what I get

n |
------

When I deselect the label, I get the desired behaviour

n |
--

If I call repaint, the desired behaviour also is achieved.

Any clues to why the horizontal line is wrong, but the vertical is
right? They both share the coordinate that is not working right.

thanks


protected void paintFigure(Graphics graphics) {
Rectangle nameLabelBounds = getNameLabel().getBounds();
Rectangle textBounds = getNameLabel().getTextBounds();

graphics.drawLine(bounds.x, nameLabelBounds.height + bounds.y,
textBounds.width + bounds.x, nameLabelBounds.height + bounds.y);
// repaint(); //XXX ddv solution to substitute repaint();
graphics.drawLine(textBounds.width + bounds.x,
nameLabelBounds.height + bounds.y, textBounds.width + bounds.x,
bounds.y);
}
Re: Only when I deselect the figure, I get the the desired effect :-( [message #209450 is a reply to message #209297] Tue, 14 February 2006 20:16 Go to previous messageGo to next message
Tomáš Studva is currently offline Tomáš StudvaFriend
Messages: 9
Registered: July 2009
Junior Member
Hi,
really some strange behaviour.
Check if is not thrown exception. (I presume you have done.)
I can only see problem in draw2d or in bad use of draw2d. Where?

first is painted horizontal line

second is painted vertical line

first is badly drawn and second OK. Why? Maybe after first line is draw, textbounds changes to correct value(by some internal draw 2D update) and second line is drawn OK.

Try to compare textbounds before and after by console or by log or by debugging.
T.S.
Re: Only when I deselect the figure, I get the the desired effect :-( [message #209875 is a reply to message #209450] Mon, 20 February 2006 18:26 Go to previous message
Eclipse UserFriend
Originally posted by: ddv.certi.org.br

Tryed that, but couldn't find the reason. Went for another solution that
worked for me.

thanks
Tomas Studva wrote:
> Hi,
> really some strange behaviour.
> Check if is not thrown exception. (I presume you have done.)
> I can only see problem in draw2d or in bad use of draw2d. Where?
>
> first is painted horizontal line
>
> second is painted vertical line
>
> first is badly drawn and second OK. Why? Maybe after first line is draw, textbounds changes to correct value(by some internal draw 2D update) and second line is drawn OK.
>
> Try to compare textbounds before and after by console or by log or by debugging.
> T.S.
Previous Topic:Accessibility deviation
Next Topic:How can I slant the figure ?
Goto Forum:
  


Current Time: Thu Apr 25 19:59:15 GMT 2024

Powered by FUDForum. Page generated in 0.02965 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top