sw5.java

来自「swing.rar」· Java 代码 · 共 37 行

JAVA
37
字号
/*
JTable
	Class

	Used to show the informations as Row,Col format
cons:
	JTable(String datas[][],String title[])

Note:
	If we run this program we can't see the Title

	To see the title we have to attach the JTable to JScrollPane
*/

import java.awt.*;
import javax.swing.*;

class sw5 extends JFrame
{
	JTable t1;

	public sw5()
	{
		Container con = getContentPane();
		String d[][] = { {"1","Rin","20"},{"2","Lux","30"},{"3","Det","50"} };
		String t[] = {"Pno","Pname","Qty"};
		t1 = new JTable(d,t);
		con.add(t1);
		setSize(300,300);
		setVisible(true);
	}

	public static void main(String args[])
	{
		new sw5();
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?