Project SwingJD Panels Part 4: TranslucentPanel

Posted by Unknown Saturday, December 8, 2012 0 comments

20121206Thursday, December 06, 2012

Project SwingJD Panels Part 4: TranslucentPanel


TranslucentPanel is a custom JPanel.

public class Translucent extends JPanel {

@ Override

{public void paintComponent (graphics g2)
}


//Background, shape

List colors = Colors. getInStance (); getStandardColor (0, height);

Painting colors. = get (0) (Paint);

shape = new RoundRectangle2D. Double (0, 0, width, height, 26, 26);

g. setPaint (paint);

g. Fill (SHAPE);

//Curved shape

shape = new GeneralPath ()?

.MoveTo (figure (GeneralPath)) (15.1308, 1.8172914);

.CurveTo (figure (GeneralPath)) (9.820799, 1.8172914, 2.1307993, 4.507291, 2.1307993, 13.817291);

.LineTo function (figure (GeneralPath)) (2.1307993, 31.78604);

.CurveTo (figure (GeneralPath)) (39.09004, 37.30802, 86.78241, 40.69229, width/2, 40.69229);

.CurveTo (figure (GeneralPath)) (width/2, 40.69229, width/2 + 30,

38.130333, width-1, 33.84854);

.LineTo function (figure (GeneralPath)) (width-1, 11.817291);

.CurveTo (figure (GeneralPath)) (width-1, 6.507291, width-5,

2.8172914, width-13, 1.8172914)?

.LineTo function (figure (GeneralPath)) (18.1308, 1.8172914);

(Shape) closePath (GeneralPath);

g. setPaint (paint);

g. Fill (SHAPE);

//External shape Design

shape = new RoundRectangle2D. Double (1, 1,-3, width height-3, 18, 18);

g. setStroke (new BasicStroke (3))?

g. setPaint (new color (255, 255, 255));

g. Draw (SHAPE);


//Set transparency
AlphaComposite newComposite = AlphaComposite. getInstance ()
AlphaComposite. SRC _OVER, 9f);
g. setComposite (newComposite);

//Set transparency
newComposite = AlphaComposite. getInstance (AlphaComposite. SRC _OVER. 5f);
g. setComposite (newComposite);

@ Override
{public void paintComponent (graphics g2)
Graphics2D g = g2 (Graphics2D);
g. setRenderingHint (KEY _ANTIALIASING, RenderingHints.
RenderingHints. VALUE_ANTIALIAS_ON);
Shape shape = null;
Paint Painting = null;
int width = getWidth ();
int height = getHeight ();
//Set transparency
AlphaComposite newComposite = AlphaComposite. getInstance ()
AlphaComposite. SRC _OVER, 9f);
g. setComposite (newComposite);
//Background, shape
List colors = Colors. getInStance (); getStandardColor (0, height);
Painting colors. = get (0) (Paint);
shape = new RoundRectangle2D. Double (0, 0, width, height, 26, 26);
g. setPaint (paint);
g. Fill (SHAPE);
//Set transparency
newComposite = AlphaComposite. getInstance (AlphaComposite. SRC _OVER. 5f);
g. setComposite (newComposite);
Painting = new GradientPaint (0, 0, new color (255, 255, 255), 0, 0, 50,
(Colors. get (0)) getColor1 ()) (GradientPaint);
//Curved shape
shape = new GeneralPath ()?
.MoveTo (figure (GeneralPath)) (15.1308, 1.8172914);
.CurveTo (figure (GeneralPath)) (9.820799, 1.8172914, 2.1307993, 4.507291,
2.1307993, 13.817291);
.LineTo function (figure (GeneralPath)) (2.1307993, 31.78604);
.CurveTo (figure (GeneralPath)) (39.09004, 37.30802, 86.78241, 40.69229,
width/2, 40.69229);
.CurveTo (figure (GeneralPath)) (width/2, 40.69229, width/2 + 30,
38.130333, width-1, 33.84854);
.LineTo function (figure (GeneralPath)) (width-1, 11.817291);
.CurveTo (figure (GeneralPath)) (width-1, 6.507291, width-5,
2.8172914, width-13, 1.8172914)?
.LineTo function (figure (GeneralPath)) (18.1308, 1.8172914);
(Shape) closePath (GeneralPath);
g. setPaint (paint);
g. Fill (SHAPE);
//External shape Design
shape = new RoundRectangle2D. Double (1, 1,-3, width height-3, 18, 18);
g. setStroke (new BasicStroke (3))?
g. setPaint (new color (255, 255, 255));
g. Draw (SHAPE);
g. setFont (new font without flange, ("evenly" Microsoft Font. BOLD, 20));
g. setColor (new color (0, 0, 0));
g. drawString (title, width/4 + 1, 31);
g. setColor (new color (0, 255, 0));
g. drawString (title, width/4, 30);
}



Translucent panels

Posted by Jeeru (Dec 06, 2011, 10: 19: 57 AM EST) Permalink


View the original article here

THANK YOU FOR YOUR VISIT
Title: Project SwingJD Panels Part 4: TranslucentPanel
Posted By Unknown
Blog Rating 5 dari 5
Hopefully this article useful to you. If you wish to quote, either part or all of the contents of this article please include a "dofollow links" to http://izone2.blogspot.com/2012/12/project-swingjd-panels-part-4.html. Thank you for reading our articles and continue to follow this blog article.

0 comments:

Post a Comment

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of Info Zone.