zoukankan      html  css  js  c++  java
  • Java——表格

    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    
    //=================================================
    // File Name       :	JTable_demo
    //------------------------------------------------------------------------------
    // Author          :	Common
    
    
    
    //主类
    //Function        : 	JTable_demo
    public class JTable_demo {
    
    	public static void main(String[] args) {
    		// TODO 自动生成的方法存根
    		JFrame frame = new JFrame("窗体");					//定义窗体
    		String[] titles = {"姓名","年龄","性别","成绩","是否及格"};
    		Object[][] userInfo = {{"张三",22,"男",99,true},{"张三",22,"男",99,true}
    		,{"张三",22,"男",99,true},{"张三",22,"男",99,true},{"张三",22,"男",99,true}};
    		
    		JTable table = new JTable(userInfo,titles);
    		
    		JScrollPane scr = new JScrollPane(table); 
    		
    		frame.add(scr);
    		frame.setSize(330,100);
    		frame.setVisible(true);
    		frame.addWindowListener(new WindowAdapter(){	//加入事件监听
    			public void windowClosing(WindowEvent arg0) {			//窗口关闭时触发,按下关闭按钮
    			// TODO 自动生成的方法存根
    			System.out.println("windowClosing-->窗口关闭");
    			System.exit(1);
    			}
    		});
    	}
    
    }
    
  • 相关阅读:
    NFS服务
    SSH服务
    DNS服务器
    FTP服务器
    linux(磁盘配额)
    linux(ACL权限控制)
    linux(日志)
    linux(系统安全)
    linux(进程和计划任务)
    linux(引导)
  • 原文地址:https://www.cnblogs.com/tonglin0325/p/5320669.html
Copyright © 2011-2022 走看看