SwingJD πίνακες μέρος 2
Friday, November 30, 2012SwingJD tables part 2
StandardCurvedPanel is a custom swing JPanel. This extends the JPanel and replaces the method paintComponent (). StandardCurvedPanel looks like this

RoundedRectangle background + figure + OuterRectangle = StandardCurvedPanel.
Now allows us to discuss how each is created from it.
//Create the roundRect table
Shape shape = new RoundRectangle2D. Double (0, 0, width, height, 26, 26);
//Create color variation
Painting new GradientPaint GradientPaint = (0, 0, bgColor (color), 0, 2 *
getHeight (), WHITE Color);
//Add the color table roundRect
g2d. setPaint (Paint);
//Fill the shape
g2d.Fill (SHAPE);

>
Figure//CurvedShape = shape createShape (width);
Painting new GradientPaint GradientPaint = (0, 2, new color (255, 255, 255, 200), 0, 50, fgColor. getColor2 ()),
g2d. setPaint (Paint);
g2d.Fill (SHAPE);
private {shape createShape (int width)
Shape shape = new GeneralPath ()?
.MoveTo (figure (GeneralPath)) (15.1308, 1.8172914);
.CurveTo (figure (GeneralPath)) (6.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);
return shape?
}
//External contour
g2d. setStroke (new BasicStroke (3))?
shape = new RoundRectangle2D. Double (1, 1,-3, width height-3, 11.2, 11.2);
g2d. setPaint (new color (255, 255, 255,100));
g2d.Draw (SHAPE);
For more information and source code click on the following location
SwingJD works Panels Part2
Posted by Jeeru (Nov 30, 2011, 12: 01: 16 PM EST) Permalink
View the original article here
Posted By Unknown
Blog Rating 5 dari 5
0 comments:
Post a Comment