Pages

Subscribe:

Ads 468x60px

♪ ♥ Get Paid Daily - The Best Sites PTC ♥ ♪
DonkeyMails.com: No Minimum Payout
AyuWage Services - Get Paid to Visits Sites and Complete Surveys

Rabu, 04 Juli 2012

Program Java SolidPaintFill

Program ini menggunakan aplikasi JCreator, berikut listing programnya.

import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;

class SolidPaintFill extends GrafikaKomputer
{
   public static void main (String[] args)
       {
           SolidPaintFill g= new SolidPaintFill();
           g.setTitle("Solid Paint Fill");
           g.setBackground(Color.white);
           g.setVisible(true);
       }
      
    public void paint(Graphics g)
    {
        Color[]colors=
            {Color.red,
                Color.pink,
                    Color.orange,
                        Color.yellow,
                        Color.green,
                            Color.cyan,
                                Color.magenta,
                                    Color.blue};
    Graphics2D g2= (Graphics2D) g;
    float rw = (float)getBounds().getWidth()/colors.length;
    float rh = (float)getBounds().getHeight();
    Rectangle2D rect;
   
    for (int i=0; i<colors.length; i++)
    {
        rect = new Rectangle2D.Float(rw*i,0,rw,rh);
        g2.setPaint(colors[i]);
        g2.fill(rect);
    }
    }
    }

Output :
Semoga Bermanfaat.

0 komentar:

Posting Komentar

Please Give Your Feedback Or Message.
Thank You!!?

Unique 1:1 Traffic Exchange

♪ ♥ Ma liste de blogs ♥ ♪

♪ ♥ Please Votes! Thanks. ♪ ♥
×