Query the data from the database and how to display it in JTable

Updated on technology 2024-05-26
6 answers
  1. Anonymous users2024-02-11

    Hungry, I don't know if you know the vector interface!!

    Need three things!!

    1First of all, you need to draw jscrollpanelYou can make a mistake if you only draw jtable!! There must be a scrollbar.

    2.Draw jtable on it!

    3.pour in import; Pack.

    4.pour in import; Pack.

    5.I don't know if you can write jdbc??? You want to show what's in the database! To write jdbc

    6.If it's written! , instantiation jdbc(db), defaulttablemodel(model)!!

    It's a long, long thing You need to instantiate three vectors, head, data, and v (the last one is named!). )

    Then write an SQL to query the database! Put the searched data into vector v, and then put v into vector data. Then put data and head in, head); You must put data first and then head!!

    Finally, put the model into jtable!!

    Then call this thing in the main function at the top!! Just go refresh jtable!!

    You research first, if there is anything that won't be asked, then ask me!! Huh, my.

  2. Anonymous users2024-02-10

    It's complicated to start from the beginning. Let me say it briefly.

    First, take the data out of the library, assuming you already know how to.

    Second, create a **model, DefaultTableModel model=new DefaultTableModel();

    Create a table header. object);

    Again, add the data.

    while(;}

    Finally, generate ** with the model.

    jtable table=new jtable(model);

    Of course, there are some other operations, such as displaying **, **font, line height settings, etc., etc., which will not be repeated one by one.

  3. Anonymous users2024-02-09

    If the file saved is garbled, you may need to re-encode it and program UTF-8

  4. Anonymous users2024-02-08

    You're using the wrong file stream.

  5. Anonymous users2024-02-07

    jscrollpane scrollpane = new jscrollpane(table);

    Replace the table with your table, I've used this before, it doesn't set a scrollpane to the interface, it can't display the data. You don't need to add jtable to the frame, just set this scrollpane into it.

  6. Anonymous users2024-02-06

    If nothing goes wrong, try adding one at the end.

Related questions
3 answers2024-05-26

Well, with ADO, you can directly select and output to excel, for example, insert into [excel; database='c:\''sheet1$''(Field 1, Field 2,...)from .. >>>More

8 answers2024-05-26

Bind data with listview and you're good to go.

For example:"type“ "size"is a field of the class le is the set of lists taken out of the database. >>>More

16 answers2024-05-26

resultmap="loginuser"Wrong should be resultmap="user"There is also such a write,The SQL that is tracked out is in the form of a stored procedure,Compare egg pain,select userid, username, password from t user where username= username and password= password Personally like select userid, username, password from t user where username=‘$username$' and password=‘$password$'

13 answers2024-05-26

Let's say the textbox is named textbox and the string of numbers to be displayed is strfloat: >>>More

3 answers2024-05-26

If you are using SQL Server, open Enterprise Manager.

1.Create a database. >>>More