java swing 可以画一个透明的矩形吗?(或多边形) 找了找好像只有 fillRect...fillPolygon...之类的。。没发现透明 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 透明的不是图形,是Composite。 最新的jdk-6u10版本已经在进行beta测试,对于swing来说,在此版本中增加了两个重要的功能:透明窗体和不规则窗体。这两个功能使得swing也可以做出vista下的玻璃效果来了, jdk-6u10还没有正式发布,可以在http://download.java.net/jdk6/binaries/进行下载publicclassTranslucentWindowextendsJFrame{ publicTranslucentWindow(){ super("透明窗体"); this.setLayout(newFlowLayout()); this.add(newJButton("按钮")); this.add(newJCheckBox("复选按钮")); this.add(newJRadioButton("单选按钮")); this.add(newJProgressBar(20,100)); this.setSize(newDimension(400,300)); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } publicstaticvoidmain(String[]args){ JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater(newRunnable(){ publicvoidrun(){ Windoww=newTranslucentWindow(); w.setVisible(true); com.sun.awt.AWTUtilities.setWindowOpacity(w,0.6f); } }); } }publicclassTranslucentWindowextendsJFrame{ publicTranslucentWindow(){ super("透明窗体"); this.setLayout(newFlowLayout()); this.add(newJButton("按钮")); this.add(newJCheckBox("复选按钮")); this.add(newJRadioButton("单选按钮")); this.add(newJProgressBar(20,100)); this.setSize(newDimension(400,300)); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } publicstaticvoidmain(String[]args){ JFrame.setDefaultLookAndFeelDecorated(true); SwingUtilities.invokeLater(newRunnable(){ publicvoidrun(){ Windoww=newTranslucentWindow(); w.setVisible(true); com.sun.awt.AWTUtilities.setWindowOpacity(w,0.6f); } }); } }来自http://wenwen.soso.com/z/q131333431.htm drawRect/drawPolygon 绘制的图形只有边,算透明吗?使用带alpha分量的Color fill算透明不? Java打开txt文件时显示错误 求助 如何设定Calendar,使其月份1代表1月而不是2月 如何用javac编译一个文件夹下的所有*.java文件呢? 一个JTablle事件,困扰很久. [急]符合Java Package 规则的正则表达式怎样写? 讨论个不起眼的问题 help File 带输入参数的存储过程的问题(回答者给分) jb5.0和6.0有什么区别啊? 求一个多线程结构 【疑问】内存分析,在Java程序中的作用
jdk-6u10还没有正式发布,可以在http://download.java.net/jdk6/binaries/进行下载
publicclassTranslucentWindowextendsJFrame{
publicTranslucentWindow(){
super("透明窗体");
this.setLayout(newFlowLayout());
this.add(newJButton("按钮"));
this.add(newJCheckBox("复选按钮"));
this.add(newJRadioButton("单选按钮"));
this.add(newJProgressBar(20,100));
this.setSize(newDimension(400,300));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
publicstaticvoidmain(String[]args){
JFrame.setDefaultLookAndFeelDecorated(true);
SwingUtilities.invokeLater(newRunnable(){
publicvoidrun(){
Windoww=newTranslucentWindow();
w.setVisible(true);
com.sun.awt.AWTUtilities.setWindowOpacity(w,0.6f);
}
});
}
}
publicclassTranslucentWindowextendsJFrame{
publicTranslucentWindow(){
super("透明窗体");
this.setLayout(newFlowLayout());
this.add(newJButton("按钮"));
this.add(newJCheckBox("复选按钮"));
this.add(newJRadioButton("单选按钮"));
this.add(newJProgressBar(20,100));
this.setSize(newDimension(400,300));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
publicstaticvoidmain(String[]args){
JFrame.setDefaultLookAndFeelDecorated(true);
SwingUtilities.invokeLater(newRunnable(){
publicvoidrun(){
Windoww=newTranslucentWindow();
w.setVisible(true);
com.sun.awt.AWTUtilities.setWindowOpacity(w,0.6f);
}
});
}
}来自http://wenwen.soso.com/z/q131333431.htm
使用带alpha分量的Color fill算透明不?