Control the direction of Gradients : Gradient Paint « 2D Graphics GUI « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JDK 6
25.JNDI LDAP
26.JPA
27.JSP
28.JSTL
29.Language Basics
30.Network Protocol
31.PDF RTF
32.Reflection
33.Regular Expressions
34.Scripting
35.Security
36.Servlets
37.Spring
38.Swing Components
39.Swing JFC
40.SWT JFace Eclipse
41.Threads
42.Tiny Application
43.Velocity
44.Web Services SOA
45.XML
Java » 2D Graphics GUI » Gradient PaintScreenshots 
Control the direction of Gradients
    

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;

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

public class GradientsDirection extends JPanel {

  public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2Dg;

    GradientPaint gp1 = new GradientPaint(525, Color.yellow, 202, Color.black, true);

    g2d.setPaint(gp1);
    g2d.fillRect(208030040);

  }

  public static void main(String[] args) {

    JFrame frame = new JFrame("GradientsDirection");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new GradientsDirection());
    frame.setSize(350350);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }
}

   
    
    
    
  
Related examples in the same category
1.Gradients: a smooth blending of shades from light to dark or from one color to another
2.Gradient Shapes
3.GradientPaint demoGradientPaint demo
4.GradientPaint EllipseGradientPaint Ellipse
5.Another GradientPaint DemoAnother GradientPaint Demo
6.Text effect: rotation and transparentText effect: rotation and transparent
7.Text effect: image texture
8.Texture paint Texture paint
9.Round GradientPaint Fill demoRound GradientPaint Fill demo
10.GradientPaint: ironGradientPaint: iron
11.Color gradientColor gradient
12.Drawing with a Gradient Color
13.A non-cyclic gradient
14.A cyclic gradient
15.PaintsPaints
16.Horizontal Gradients
17.Vertical Gradient Paint
18.Gradients in the middle
19.Returns true if the two Paint objects are equal OR both null.
20.Gradient effects
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.