1个回答
2009-06-13
展开全部
//JDK6U10以上适用,否则请不要测试了
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class JFrameTest {
public static void main(String[] args) throws Exception {
JLabel l = new JLabel(new ImageIcon(new URL("http://www.baidu.com/img/baidu_logo.gif")));
l.setHorizontalAlignment(JLabel.CENTER);
l.setVerticalAlignment(JLabel.CENTER);
JFrame f = new JFrame();
f.setSize(50,50);
f.setLocationRelativeTo(null);
f.setContentPane(l);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
com.sun.awt.AWTUtilities.setWindowOpacity(f, .5f);
}
}
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class JFrameTest {
public static void main(String[] args) throws Exception {
JLabel l = new JLabel(new ImageIcon(new URL("http://www.baidu.com/img/baidu_logo.gif")));
l.setHorizontalAlignment(JLabel.CENTER);
l.setVerticalAlignment(JLabel.CENTER);
JFrame f = new JFrame();
f.setSize(50,50);
f.setLocationRelativeTo(null);
f.setContentPane(l);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
com.sun.awt.AWTUtilities.setWindowOpacity(f, .5f);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询