import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
The import manager. LianJie;
Public class NNN extends JFrame {
JButton button;
//data table;
JPanel panel;
int amount;
Int the column;
//String oo1 [] [];
//String o1 [];//={" ni ", "ni", "ni", "ni"};
AL AL=new AL ();
Public void nnn1 () {data table; String oo2 [] []; O2 String []; The button=new JButton (" button ");//oo=new String [amount] [columnnumber]; Oo2=al. Oo1; O2=al. O1; Table=new series (oo2, o2); The panel=new JPanel (); The panel. SetLayout (new BorderLayout ()); A panel. The add (button, BorderLayout. NORTH); A panel. The add (new JScrollPane (table), BorderLayout. CENTER); Add (panel); Button. AddActionListener (al);
}
The class AL implements ActionListener {String oo1 [] []; String o1 [];
Public void actionPerformed (an ActionEvent e) {Connection con=null; Con=LianJie. LianJie (); If (con==null) return; The Statement st. The ResultSet re; Int columnnumber; Try {st=con. CreateStatement (ResultSet. TYPE_SCROLL_SENSITIVE, ResultSet. CONCUR_READ_ONLY); Re=st. executeQuery (" select * from the UserInfo "); Re. The last (); The ResultSetMetaData RSMD=re. For getMetaData (); Columnnumber=RSMD. GetColumnCount (); O1=new String (columnnumber); for(int i=0; i
}
CodePudding user response:
Would you like to see such a format codeCodePudding user response:
The first post, copied to show like this, the original is not the case,