标题:大侠帮忙看看有什么问题
只看楼主
bear
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2005-6-11
 问题点数:0 回复次数:2 
大侠帮忙看看有什么问题
import java.*;
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class UseJTable extends JFrame
{
public UseJTable()
{
super("学生信息表");
setSize(300,200);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent windowevent)
{
Window window=windowevent.getWindow();
window.dispose();
System.exit(0);
}
});
JTable jtable=new JTable(new String[][]
{
{"王军","24"},{"李庚","26"}
//{"张堂","25"},{"刘关","27"}
},
new String[]{"姓名","年龄"});
jtable.setRowHeight(25);//设置table每行的高度
jtable.setGridColor(Color.BLUE);
JScrollPane jScrollPane=new JScrollPane(jtable);
getContentPane().add(jScrollPane,BorderLayout.CENTER);
}
public static void main(String args[])
{
UseJTable st=new UseJTable();
st.setVisible(true);
}
}

搜索更多相关主题的帖子: public window import super java 
2005-12-14 16:13
bagger
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:33
帖 子:891
专家分:0
注 册:2005-8-16
得分:0 

import java.*;
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.*;
public class UseJTable extends JFrame
{
public UseJTable()
{
super("学生信息表");
setSize(300,200);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent windowevent)
{
Window window=windowevent.getWindow();
window.dispose();
System.exit(0);
}
});
JTable jtable=new JTable(new String[][]
{
{"王军","24"},{"李庚","26"}
//{"张堂","25"},{"刘关","27"}
},
new String[]{"姓名","年龄"});
jtable.setRowHeight(25);//设置table每行的高度
jtable.setGridColor(Color.BLUE);
JScrollPane jScrollPane=new JScrollPane(jtable);
getContentPane().add(jScrollPane,BorderLayout.CENTER);
}
public static void main(String args[])
{
UseJTable st=new UseJTable();
st.setVisible(true);
}
}


程序中:
BorderLayout
Color都是java.awt包中的,所以只要import java.awt.*;就OK了

我也犯过这样的问题,所以深有体会啊!


【三元毕业设计论文】
三元论文真的只有三元钱
客服QQ:742670649
http://shop35094218./
2005-12-14 20:32
bear
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2005-6-11
得分:0 

谢谢!

2005-12-14 21:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-38140-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.130799 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved