JavaSwing匆妾凩岻屈?桟桟?耗
扮寂:2011-06-19 BlogJava Swing
匯、會冱
購噐“Java恂音挫彑中”議尸胎厮将喇栖厮消。埋隼Swing才Java2D厮将嗤階 狛噴定議煽雰?匆嗤JIDE、JGoodies、TWaver吉音富蝕坿Swing怏周?徽頁喘 Java恂彑中殻會挽隼音頁匯周煤防議並。云ゞJava匆妾凩〃狼双猟嫗?祥頁?宥 狛匯乂酒汽伏強議箭徨?才寄社匯軟範紛Java、冥沫Swing。凪糞低峪俶勣謹匯 泣幹吭、謹匯泣塚伉?低議Java殻會匆辛參“妾凩”?云猟祥揮艇匯軟序秘Java 議妾凩岻唾。
屈、羨悶耗砿丼惚
壓利大宥儷嶄?将械勣燕器亅咏岻寂議“覚墮”購狼。箭泌?IP亅咏恬葎互 蚊亅咏辛參覚墮壓SDH貧?匆辛參覚墮壓ATM亅咏貧。揖劔?IP恬葎亅咏珊辛參覚 墮厚謹議互蚊亅咏?箭泌Voice over IP?封崛窮佚嶄Everything over IP議古 廷。壓燕?貧?喘?札廼耗議羨悶耗砿栖燕?亅咏議“覚墮”頁壅栽癖音狛阻? 泌和夕?。
醤悶糞?載酒汽?麼勣旗鷹泌和?
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
import twaver.*;
public class PipleComponent extends JComponent {
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint (RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Shape parentHollowShape=createPiple (g2d,100,100,200,200,TWaverUtil.getRandomColor(),null);
createPiple (g2d,120,120,280,40,TWaverUtil.getRandomColor (),parentHollowShape);
createPiple (g2d,130,170,310,40,TWaverUtil.getRandomColor (),parentHollowShape);
createPiple (g2d,140,220,290,50,TWaverUtil.getRandomColor (),parentHollowShape);
createPiple (g2d,130,190,300,30,TWaverUtil.getRandomColor (),parentHollowShape);
}
private Shape createPiple(Graphics2D g2d,int x, int y, int width, int height,Color color,Shape parentHollowShape) {
if(parentHollowShape!=null){
Rectangle bounds=parentHollowShape.getBounds();
Rectangle rightClip=new Rectangle (bounds.x+bounds.width/2,bounds.y,3000,bounds.height);
Area clip=new Area (parentHollowShape);
clip.add(new Area(rightClip));
g2d.setClip(clip);
}
int circleWidth = height/3;
GradientPaint paint = new GradientPaint(x,
y,
color.brighter(),
x,
y + (int) (height * 0.65),
color.darker(),
|