Only when I deselect the figure, I get the the desired effect :-( [message #209297] |
Mon, 13 February 2006 19:56 |
Eclipse User |
|
|
|
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 #209875 is a reply to message #209450] |
Mon, 20 February 2006 18:26 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03754 seconds