Total members 11892 |It is currently Mon Sep 16, 2024 9:35 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Stroke with Effect in java
Code:
import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;

public class EffectsOfStroke extends JPanel{
  public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    double p = 12, q = 45, width = 65, height = 65;
    Rectangle2D rectangle = new Rectangle2D.Double(p, q, width, height);
    GradientPaint gradientPaint= new GradientPaint(65, 65, Color.red,
      90, 90,Color.cyan, true);
    g2d.setPaint(gradientPaint);
    g2d.fill(rectangle);
    rectangle.setFrame(+ 90, q, width, height);
    g2d.setPaint(gradientPaint);
    g2d.setStroke(new BasicStroke(10));
    g2d.draw(rectangle);
    rectangle.setFrame(+ 180, q, width, height);
    g2d.setPaint(Color.black);
    g2d.draw(rectangle);
  }

  public static void main(String[] args) {
    JFrame frame = new JFrame("Show Effect");
    frame.getContentPane().add(new EffectsOfStroke());
    frame.setSize(350, 200);
    frame.show();
  }
}
 





Attachments:
File comment: the output
effect.gif
effect.gif [ 7.61 KiB | Viewed 5627 times ]

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada
Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Stroke with Effect in java
 photoshop Glass Effect     -  
 Lightning Text Effect     -  
 Text Effect Using Photoshop     -  
 photoshop Glass Effect     -  
 make Water mark Effect in php     -  
 Text Effect Using Add Layer Style     -  
 2d game in java-Monster-Java 2D Game Graphics and Animation     -  
 Java course     -  
 Using FTP in java     -  
 What is Java API?!!!     -  



Topic Tags

Java Graphics
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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