Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Advanced-java] JApplet is Flashing and blinking
- From: nadia@xxxxxxxxx (Nadia Ebrahim)
- Subject: [Advanced-java] JApplet is Flashing and blinking
- Date: Tue, 27 Mar 2001 10:14:45 +0200
This is a multi-part message in MIME format.
--Boundary_(ID_L3SMF5i26DQCZATCo/nMmQ)
Content-type: text/plain; charset="iso-8859-1"
Content-transfer-encoding: quoted-printable
Hi there friends
I have made a JApplet and when I load it in Internet Explorer and try to =
scroll down it.It flashes,blinks and dark black lines come over it .I =
have heard about double buffering and have tried to implement it within =
my JApplet.
I have no idea what the problem can be ......
I am displaying JLabels and a Canvas with graphics on it.
I am not sure if my paint method is maybe the problem .In my paint =
method all I do is set the Text of the labels .
my constructer looks like the following:
public init{
try{
image=3Dthis.createImage(size().width,size().height);
MediaTracker mt=3Dnew MediaTracker(this);
mt.addImage(image,0)
mt.waitForAll();
}catch(Exception e){}
int iw =3D image.getWidth(this);
int ih =3D image.getHeight(this);
bi =3D new BufferedImage(iw, ih, =
BufferedImage.TYPE_INT_RGB);
Graphics2D big =3D bi.createGraphics();
big.drawImage(image,0,0,this);
=20
}
My update class looks like this:
public void update(Graphics g)
{=20
Graphics2D gr=3D(Graphics2D)g;
if(image=3D=3Dnull)
{
image=3Dthis.createImage(size().width,size().height);
try{ =20
MediaTracker mtsec=3Dnew MediaTracker(this); =20
mtsec.addImage(image,1); =20
mtsec.waitForAll();
}catch(Exception e){}
} =20
int iw =3D image.getWidth(this);
int ih =3D image.getHeight(this);
bi =3D new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
gr =3D bi.createGraphics();
paint(gr); =20
gr.drawImage(image,0,0,this);
}
My paint method looks like this..
public void paint(Graphics2D g)
{
currenttargetlabel.setText(" "+formatlabel.format(curtarget));
gantryangle.setText(formatlabel.format(gangle));
ratioab.setText((formatNumber.format(relab)));
ratiocd.setText((formatNumber.format(relcd)));
straybeamlabel.setText(formatlabel.format(straybeam)+"nA");
firstlabel.setText(formatsome.format(firstdoub));
secondlabel.setText(formatsome.format(seconddoub));
secondxlabel.setText(formatsome.format(thirddoub));
thirdlabel.setText(formatsome.format(secondx));
paintstatus();
paintntframe();
paintconsole();
paintvariable(number);=20
}
Please help..
If you have any suggestions or comments .I am a beginner with Java and =
not sure where the problem is.
Thanking you in advance
Nadia
--Boundary_(ID_L3SMF5i26DQCZATCo/nMmQ)
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 content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi there friends</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have made a JApplet and when I load =
it in=20
Internet Explorer and try to scroll down it.It flashes,blinks and dark =
black=20
lines come over it .I have heard about double buffering and have =
tried to=20
implement it within my JApplet.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I have no idea what the problem can be=20
......</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am displaying JLabels and a Canvas =
with graphics=20
on it.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I am not sure if my paint method is =
maybe the=20
problem .In my paint method all I do is set the Text of the labels =
.</FONT><FONT=20
face=3DArial size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> my constructer looks like the=20
following:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>public init{</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>try{<BR> =20
image=3Dthis.createImage(size().width,size().height);<BR> &nbs=
p; =20
MediaTracker mt=3Dnew=20
MediaTracker(this);<BR> =
mt.addImage(image,0)</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbs=
p;mt.waitForAll();<BR> =20
}catch(Exception e){}</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
int iw =3D=20
image.getWidth(this);<BR> =
=20
int ih =3D image.getHeight(this);<BR> =
=20
bi =3D new BufferedImage(iw, ih,=20
BufferedImage.TYPE_INT_RGB);<BR>  =
; =20
Graphics2D big =3D=20
bi.createGraphics();<BR> &=
nbsp; big.drawImage(image,0,0,this);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>My update class looks like =
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>public void update(Graphics =
g)<BR> =20
{ <BR> Graphics2D gr=3D(Graphics2D)g;<BR> =20
if(image=3D=3Dnull)<BR> {<BR> =
=20
image=3Dthis.createImage(size().width,size().height);<BR> try{ =
<BR> MediaTracker=20
mtsec=3Dnew=20
MediaTracker(this); <BR> mtsec.addImage(image=
,1); <BR> mtsec.waitForAll();<BR> =
=20
}catch(Exception e){}<BR> } =20
<BR> int iw =3D=20
image.getWidth(this);<BR> =
int=20
ih =3D image.getHeight(this);<BR> =
bi =3D new=20
BufferedImage(iw, ih,=20
BufferedImage.TYPE_INT_RGB);<BR>  =
; gr=20
=3D=20
bi.createGraphics();<BR> p=
aint(gr); =20
<BR> =20
gr.drawImage(image,0,0,this);<BR> }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>My paint method looks like =
this..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> public void paint(Graphics2D =
g)<BR> =20
{<BR> =20
currenttargetlabel.setText(" =20
"+formatlabel.format(curtarget));<BR> =20
gantryangle.setText(formatlabel.format(gangle));<BR> =20
ratioab.setText((formatNumber.format(relab)));<BR> =20
ratiocd.setText((formatNumber.format(relcd)));<BR> =20
straybeamlabel.setText(formatlabel.format(straybeam)+"nA");<BR> &nbs=
p; =20
firstlabel.setText(formatsome.format(firstdoub));<BR> =20
secondlabel.setText(formatsome.format(seconddoub));<BR> =
=20
secondxlabel.setText(formatsome.format(thirddoub));<BR> =
=20
thirdlabel.setText(formatsome.format(secondx));<BR> =20
paintstatus();<BR> =
paintntframe();<BR> =20
paintconsole();<BR> =
paintvariable(number); <BR> =20
}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Please help..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>If you have any suggestions or comments =
.I=20
am a beginner with Java and not sure where the problem =
is.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanking you in advance</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Nadia</DIV></FONT></BODY></HTML>
--Boundary_(ID_L3SMF5i26DQCZATCo/nMmQ)--
- Prev by Date: [Advanced-java] Character set support
- Next by Date: [Advanced-java] Message queue and JNDI (cont)
- Previous by thread: [Advanced-java] Character set support
- Next by thread: [Advanced-java] Message queue and JNDI (cont)
- Index(es):