java - GUI using JLayer -
i have used jlayer decorate gui background color changed every second. here image.
in image see blue , yellow line appearing in timer. realized these line appearing because text changing in text area similar thing happens when new expression displayed in text area.
how these lines removed?
class mylayeruisubclass extends layerui<jcomponent>{ /** * */ private static final long serialversionuid = 1l; public void paint(graphics g, jcomponent c){ super.paint(g, c); graphics2d g2 = (graphics2d) g.create(); int red = (int) (math.random()*255); int green = (int) (math.random()*255); int blue = (int) (math.random()*255); color startcolor = new color(red, green, blue); red = (int) (math.random()*255); green = (int) (math.random()*255); blue = (int) (math.random()*255); color endcolor = new color(red, green, blue); int w = c.getwidth(); int h = c.getheight(); g2.setcomposite(alphacomposite.getinstance( alphacomposite.src_over, .5f)); g2.setpaint(new gradientpaint(0, 0, startcolor, 0, h, endcolor)); g2.fillrect(0, 0, w, h); g2.dispose(); } }
thanks in advance!
instead of using jtextfield used jlabel suggested trashgod .
Comments
Post a Comment