日期:2014-05-20  浏览次数:20736 次

高分求解.........................
import   java.awt.*;
import   java.awt.event.*;
import   javax.swing.*;
import   java.util.*;

class   studentDataTableFrame   extends   JFrame
{
private   static   final   int   WIDTH   =   300;
        private   static   final   int   HEIGHT   =   200;  

JButton   okButton;
JButton   cancelButton;
Box   selectBox;
Vector   studentData;
JTable   sutdentDataTable;
String   []   head;
JScrollPane   sutdentDataScrollPane1;
Object[][]   content;

studentDataTableFrame()
{
builderTable();
builderButton();

setLayout(new   BorderLayout());
setTitle( "学生信息 ");
setSize(WIDTH,   HEIGHT);
setLocation(WIDTH,HEIGHT);
add(sutdentDataScrollPane1,BorderLayout.CENTER);
add(selectBox,BorderLayout.SOUTH);

                setVisible(true);//显示

addWindowListener   (new   WindowAdapter   ()
{
public   void   windowClosing(WindowEvent   e)  
{
System.exit(0);
}
})   ;//关闭
}

void   builderTable()
{
studentData   =   new   Vector   ()   ;
head   =   new   String[]{ "姓名 ", "学号 ", "性别 ", "籍贯 ", "简单介绍 "};
//Object[][]   content   =   {{ " "},{ " "}};
sutdentDataTable   =   new   JTable();
sutdentDataScrollPane1   =   new   JScrollPane   (sutdentDataTable);
}

void   builderButton()
{
okButton   =   new   JButton( "增加 ");
                cancelButton   =   new   JButton( "关闭 ");
                selectBox   =   Box.createHorizontalBox();
                selectBox.add(Box.createHorizontalStrut(40));

                selectBox.add(okButton);
                selectBox.add(Box.createHorizontalGlue());
                selectBox.add(cancelButton);
                selectBox.add(Box.createHorizontalStrut(40));

okButton.addActionListener   (new   ActionListener   ()
{
public   void   actionPerformed   (ActionEvent   e)
{
new   studentMessageInputDialog(studentDataTableFrame.this);
}
})   ;

cancelButton.addActionListener   (new   ActionListener   ()
{
public   void   actionPerformed   (ActionEvent   e)
{
System.exit(0);
}

})   ;
}

void   addData(String   s)//(Vector   Data)
{
System.out.println(s);
/*studentData.add   (Data)   ;
StudentDataModel   dm   =   new   StudentDataModel   (head   ,   studentData)   ;
sutdentDataTable.setModel   (dm)   ;*/
}

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