Tue Nov 11, 2008 5:59 pm
import java.awt.*;
import javax.swing.*;
public class UseAlphaValues extends JFrame {
int width, height;
UseAlphaValues(String st) {
this(st, 350, 300);
}
UseAlphaValues(String st, int w, int h) {
setTitle(st);
setSize(width = w, height = h);
setBackground(Color.black);
}
public void paint(Graphics g) {
Color color1 = new Color(150, 100, 100, 70);
Color color2 = new Color(75, 150, 200, 125);
Color color3 = new Color(120, 150, 200, 200);
g.setColor(color1);
g.fillOval(0, 0, width / 2, height / 2);
g.setColor(color2);
g.fillOval(width / 4, height / 4, width / 2, height / 2);
g.setColor(color3);
g.fillOval(width / 3, height / 3, width / 4, height / 4);
}
public static void main(String[] args) {
new UseAlphaValues("Use Alpha values to draw in layers.")
.setVisible(true);
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.