?
hello
import java.awt.*; //this will be used to access graphics,color, and alpha composite import java.awt.geom.Rectangle2D;// used to create a 2-Dimensional Rectangle import javax.swing.*;//used to have JPanel and JFrame
private float fade_rectangle = 1f;
super.paint(g); //paint the frame g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, fade_rectangle)); //fading effects of the rectangle g2d.fill(rect);//fill the rectangle }
public void run() { while (fade_rectangle >= 0) { repaint(); fade_rectangle += -0.01f; if (fade_rectangle < 0) { fade_rectangle = 0; } try { } } }
public RectRunnable() { runner.start(); //starts the fading }
public ColorFading() { new RectRunnable(); }
frame.getContentPane().add(new ColorFading()); frame.setSize(250, 150); frame.setVisible(true); }
import java.awt.*; //this will be used to access graphics,color, and alpha composite import java.awt.geom.Rectangle2D;// used to create a 2-Dimensional Rectangle import javax.swing.*;//used to have JPanel and JFrame private float fade_rectangle = 1f; public ColorFading() { new RectRunnable(); } super.paint(g); //paint the frame g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, fade_rectangle)); //fading effects of the rectangle g2d.fill(rect);//fill the rectangle } frame.getContentPane().add(new ColorFading()); frame.setSize(250, 150); frame.setVisible(true); } public RectRunnable() { runner.start(); } public void run() { while (fade_rectangle >= 0) { repaint(); fade_rectangle += -0.01f; if (fade_rectangle < 0) { fade_rectangle = 0; } try { } } } } }