Stroke with iron effect : Stroke « 2D Graphics GUI « Java

Home
Java
1.2D Graphics GUI
2.2D Graphics GUI1
3.3D
4.Advanced Graphics
5.Ant
6.Apache Common
7.Chart
8.Class
9.Collections Data Structure
10.Data Type
11.Database SQL JDBC
12.Design Pattern
13.Development Class
14.EJB3
15.Email
16.Event
17.File Input Output
18.Game
19.Generics
20.GWT
21.Hibernate
22.I18N
23.J2EE
24.J2ME
25.JDK 6
26.JNDI LDAP
27.JPA
28.JSP
29.JSTL
30.Language Basics
31.Network Protocol
32.PDF RTF
33.Reflection
34.Regular Expressions
35.Scripting
36.Security
37.Servlets
38.Spring
39.Swing Components
40.Swing JFC
41.SWT JFace Eclipse
42.Threads
43.Tiny Application
44.Velocity
45.Web Services SOA
46.XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
SCJP
Java » 2D Graphics GUI » StrokeScreenshots 
Stroke with iron effect
Stroke with iron effect
      

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class PaintingAndStroking extends JPanel{
  public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2Dg;
    double x = 15, y = 50, w = 70, h = 70;
    Ellipse2D e = new Ellipse2D.Double(x, y, w, h);
    GradientPaint gp = new GradientPaint(7575, Color.white, 9595,
        Color.gray, true);
    // Fill with a gradient.
    g2.setPaint(gp);
    g2.fill(e);
    // Stroke with a solid color.
    e.setFrame(x + 100, y, w, h);
    g2.setPaint(Color.black);
    g2.setStroke(new BasicStroke(8));
    g2.draw(e);
    // Stroke with a gradient.
    e.setFrame(x + 200, y, w, h);
    g2.setPaint(gp);
    g2.draw(e);
  }

  public static void main(String[] args) {
    JFrame f = new JFrame();
    f.getContentPane().add(new PaintingAndStroking());
    f.setSize(350250);
    f.show();
  }
}

           
         
    
    
    
    
    
  
Related examples in the same category
1.Dashed rectangleDashed rectangle
2.A dashed stroke
3.Stroking or Filling with a Texture
4.Basic strokeBasic stroke
5.Thick stroke demoThick stroke demo
6.Dashed strokeDashed stroke
7.Smokey effectSmokey effect
8.Custom StrokesCustom Strokes
9.Changing the Thickness of the Stroking Pen
10.Tries to deduct the stroke-type from the given stroke object.
11.Tries to extract the stroke-width from the given stroke object.
12.A component for choosing a stroke from a list of available strokes.
13.Cancel the effects of the zoom on a particular Stroke
14.Serialises a Stroke object
15.This program demonstrates different stroke types.This program demonstrates different stroke types.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.