Results 1 to 5 of 5
  1. #1
    palcente is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default Help with Jtable please

    Hi, I'm new to java, and I wanted to create really easy application using Swing. I went through the tutorials for swings and tables, I also checked arrays, as I felt that may come useful while playing with tables.

    I created the design in NetBeans, and got stuck.
    Help with Jtable please-vd2y6d.jpg

    I can figure out print and close myself.
    I want the Add button to add data from textFields to the table, and then clear the text fields.
    I also want to make it possible to add another row to the table after using Add button again (without overwriting).

    My questions are:

    Is that possible to implement?

    If yes

    Could you give me a hint, where to start, or which approach should I take?
    My textFields have different datatypes, can I use single button to upload data from them to the table ?

    Thanks in advance

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Help with Jtable please

    It's quite possible to do all. For starters though, have you gone through the Swing tutorials yet as it's all explained there with sample code.

  3. #3
    palcente is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default Re: Help with Jtable please

    Could you post the link, to the tutorial you refer to please ?

  4. #4
    Vampiricx3 is offline Member
    Join Date
    Feb 2012
    Posts
    31
    Rep Power
    0

    Default Re: Help with Jtable please

    How I would personally approach this (although I've never worked with JTable's before), is to use a FileWriter from the JTextField's to a .txt file, and then Scan from the .txt into the JTable, but this would be so the data would be still there when you reload the program. Or if you would just like to keep them there while the program is open, you could use something like this, just taking a stab at the JTextField names because you haven't posted your source code.
    Java Code:
    name = nameTF.getText();
    then you could just implement a .setText(name) in the JTable.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Help with Jtable please

    The tutorials are here: Big Index, and the JTable tutorial is here.

    The key to solving your problem is not to work on the whole thing at once, but to solve each individual problem in isolation and one at a time, and then once done, try to put it all together into a single program. Then if you get stuck on an isolated part, it's a lot easier to figure out what's wrong (or to get help from us), compared to if you get stuck in a large program.

Similar Threads

  1. JTable
    By Levian in forum AWT / Swing
    Replies: 4
    Last Post: 07-04-2011, 10:01 AM
  2. jtable
    By bonjovi4u in forum AWT / Swing
    Replies: 3
    Last Post: 08-31-2010, 03:20 PM
  3. Adding New JTable in JTable
    By anilkumar_vist in forum New To Java
    Replies: 0
    Last Post: 01-27-2010, 08:27 AM
  4. JTable help
    By FFEJ in forum New To Java
    Replies: 5
    Last Post: 10-05-2009, 11:30 PM
  5. Replies: 2
    Last Post: 05-15-2008, 10:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •