Total members 10261 | Gratitudes |It is currently Tue May 22, 2012 5:17 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Code Snippet
 Code subject: Use Alpha values to draw
PostPosted: Tue Nov 11, 2008 5:59 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2279
Location: Earth
Has thanked: 39 time
Have thanks: 61 time

Use Alpha values to draw
Code:
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);
  }
}


Attachments:
File comment: output ,
layers.gif
layers.gif [ 6.35 KiB | Viewed 733 times ]

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )
TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  

 Similar topics
 Draw rectangle on image
 Draw 3d cube using openGL
 Draw a solid sphere using openGL
 draw a horizontal line in your html page
 What is Alpha Reseller Master Reseller Hosting?
 Super Alpha Master Reseller Hosting
 Read an image bitmap (.bmp) file and draw it as texture
 How can i Get Brightness and Contrast values of img
 i want to draw a circle on a image(any format bmp,jpeg etc.)
 Default Initial Values in java

All times are UTC [ DST ]


Users browsing similar codes

Users browsing this forum: No registered users and 2 guests



Jump to:  
Previous Code Snippet | Next Code Snippet 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team