《Java2图形设计卷II:Swing》配套光盘源码

源代码在线查看: test.java

软件大小: 4504 K
上传用户: guigong
关键词: Java2 Swing 图形 光盘
下载地址: 免注册下载 普通下载 VIP

相关代码

				import javax.swing.*;
				import java.awt.*;
				import java.awt.event.*;
				
				public class Test extends JFrame {
					public Test() {
						super("An Application");
				
						Container contentPane = getContentPane();
				
						Icon icon = new ImageIcon("swing.gif", 
										"An animated GIF of Duke on a swing");
				
						JLabel label = new JLabel("Swing!", icon,
										SwingConstants.CENTER);
				
						contentPane.add(label, BorderLayout.CENTER);
					}
					public static void main(String args[]) {
						final JFrame f = new Test();
				
						f.setBounds(100,100,300,250);
						f.setVisible(true);
						f.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
				
						f.addWindowListener(new WindowAdapter() {
							public void windowClosed(WindowEvent e) {
								System.exit(0);
							}
						});
					}
				}
							

相关资源