Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » paintFigure() problem
paintFigure() problem [message #196845] Tue, 27 September 2005 14:11 Go to next message
Eclipse UserFriend
Originally posted by: dan.nicolici.nexource.ro

This is a multi-part message in MIME format.

------=_NextPart_000_0027_01C5C386.83CF6BD0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Why does the painting that I do in a Figure's paintFigure() does not =
show?

This:

public void paintFigure(Graphics g) {
//g.drawImage(image, 0, 0);
g.drawLine(0, 0, 10, 10);
super.paintFigure(g);
}

has no effect on the figure (no line is drawn).
------=_NextPart_000_0027_01C5C386.83CF6BD0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Why does the painting that I do in a =
Figure's=20
paintFigure() does not show?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;public void paintFigure(Graphics =
g)=20
{<BR>&nbsp;&nbsp;//g.drawImage(image, 0, =
0);<BR>&nbsp;&nbsp;g.drawLine(0, 0, 10,=20
10);<BR>&nbsp;&nbsp;super.paintFigure(g);<BR>&nbsp;} </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>has no effect on the figure (no line is =

drawn).</FONT></DIV></BODY></HTML>

------=_NextPart_000_0027_01C5C386.83CF6BD0--
Re: paintFigure() problem [message #196853 is a reply to message #196845] Tue, 27 September 2005 15:30 Go to previous messageGo to next message
Fabian Wolf is currently offline Fabian WolfFriend
Messages: 96
Registered: July 2009
Member
Dan Nicolici wrote:

> Why does the painting that I do in a Figure's paintFigure() does not show?
>
> This:
>
> public void paintFigure(Graphics g) {
> //g.drawImage(image, 0, 0);
> g.drawLine(0, 0, 10, 10);
> super.paintFigure(g);
> }
>
> has no effect on the figure (no line is drawn).

Are painting inside the bounds of your Figure? Shouldn't it be

g.drawLine(getBounds().x, getBounds().y, getBounds().x + 10, getBounds().y +
10); ?
Re: paintFigure() problem [message #196860 is a reply to message #196845] Tue, 27 September 2005 15:30 Go to previous message
Eclipse UserFriend
Originally posted by: none.unknown.com

This is a multi-part message in MIME format.

------=_NextPart_000_004F_01C5C356.E3C66140
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Your figure is most likely opaque, and super.paintFigure() is painting =
the background (and hence painting over the line you're drawing). You =
need to draw the line after invoking super.paintFigure().
"Dan Nicolici" <dan.nicolici@nexource.ro> wrote in message =
news:dhbju8$lvt$1@news.eclipse.org...
Why does the painting that I do in a Figure's paintFigure() does not =
show?

This:

public void paintFigure(Graphics g) {
//g.drawImage(image, 0, 0);
g.drawLine(0, 0, 10, 10);
super.paintFigure(g);
}

has no effect on the figure (no line is drawn).
------=_NextPart_000_004F_01C5C356.E3C66140
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1515" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Your figure is most likely opaque, and=20
super.paintFigure() is painting the background (and hence painting over =
the line=20
you're drawing).&nbsp; You need to draw the line after invoking=20
super.paintFigure().</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Dan Nicolici" &lt;<A=20
=
href=3D"mailto:dan.nicolici@nexource.ro">dan.nicolici@nexource.ro</A>&gt;=
wrote=20
in message <A=20
=
href=3D"news:dhbju8$lvt$1@news.eclipse.org">news:dhbju8$lvt$1@news.eclips=
e.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Why does the painting that I do in a =
Figure's=20
paintFigure() does not show?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;public void =
paintFigure(Graphics g)=20
{<BR>&nbsp;&nbsp;//g.drawImage(image, 0, =
0);<BR>&nbsp;&nbsp;g.drawLine(0, 0,=20
10, 10);<BR>&nbsp;&nbsp;super.paintFigure(g);<BR>&nbsp;} </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>has no effect on the figure (no line =
is=20
drawn).</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_004F_01C5C356.E3C66140--
Previous Topic:Drag and Drop
Next Topic:Problem with setOpaque()
Goto Forum:
  


Current Time: Thu Jan 16 23:25:55 GMT 2025

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

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

Back to the top