Java Swing is a flash-flash effect, but the idea is simply to create a thread that constantly switches through the images you want to display to achieve flicker. The main code is attached below.
Class Twinkledthread extends thread{public boolean twinkledflag=false;
Private long Currenttimemillis;
Public Twinkledthread (Long Currenttimemillis) {this.currenttimemillis=currenttimemillis;
@Override public void Run () {while (!twinkledflag) {try {
Markstationimg= markstation;
Thread.Sleep (100);
The hint picture of the flashing message markstationimg=null;
Thread.Sleep (100);
This controls the blinking length of if (System.currenttimemillis ()-currenttimemillis>2000) {
Twinkledflag=true; A catch (Interruptedexception e) {//TODO auto-generated catch bloc
K E.printstacktrace ();
}
} }
}
class MyLabel extends jlabel{/** * * * * private static final lo
ng serialversionuid = 1L;
@Override public void Paint (Graphics g) {super.paint (g);
Graphics2D g2= (graphics2d) G;
G2.setrenderinghint (renderinghints.key_antialiasing,renderinghints.value_antialias_on); if (twinkledbs!=null) {if (markstationimg!=null) {g2.drawimage (Markstationimg.getimage ()
, Twinkledbs.getx (), twinkledbs.gety (), this); }
}
}
}