Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Dynamically Creating User Selection through ResultSet

  1. #1
    Junior Member anmaston's Avatar
    Join Date
    Apr 2011
    Location
    Plymouth, UK
    Posts
    10
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Dynamically Creating User Selection through ResultSet

    Hello,

    So my question is really as simple as the title reads, I'm retrieving some customer products from database and populating a JTable through ResultSet. Using this method can I assign a radio button group for which each button has the value of productID?

    What method of approach would I take when doing this? If using JTable, how would I go about it? or are there easier approaches to the problem? At the moment I'm using a text input as user selection, which for lack of a better word is a 'crap' approach.

    Kind Regards,


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,297
    Thanks
    180
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: Dynamically Creating User Selection through ResultSet

    At what point are you stuck? Do you want to show a JRadioButton in a JTable and don't know how? I'm not sure I'm following what exactly you want to do, what data you have, etc...

  3. #3
    Junior Member anmaston's Avatar
    Join Date
    Apr 2011
    Location
    Plymouth, UK
    Posts
    10
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Dynamically Creating User Selection through ResultSet

    Sorry, I could have explained myself better.
    Thats right, my application is that of a booking system (or at least this part of it is) and the bookings are made depending on faulty products.
    Customers have many products and therefore needs a method for the user to select a product once the JTable for a customer's products is displayed.

    I'm currently reading ResultSet into JTable, that all works fine(and to be honest I skipped out the JRadioButton part because I wanted to
    get functionality sorted before i went back to 'niggly' points). I'm retrieving the primary key and a couple of strings at the moment.
    I have a class which deals with all the database queries, the method from that class passes the ResultSet to the JFrame and all the calculations
    for rows etc take place in the JFrame before my(or NetBean's) InitComponents() method is fired.

    But yeah, the top and bottom of it is that I'm not sure how to get a JRadioButton into the JTable, I did get one in there, but I'm not sure
    the method of approach behind adding one for each record(and somehow relating this to each record that I'm retrieving)

  4. #4
    Junior Member anmaston's Avatar
    Join Date
    Apr 2011
    Location
    Plymouth, UK
    Posts
    10
    My Mood
    Confused
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Dynamically Creating User Selection through ResultSet

    So, I can get an extra column at the end of my jTable, but jTable simply outputs this jRadioButton's memory location as a string, surely this must be a pretty standard thing to do.

Similar Threads

  1. ResultSet issues
    By _lithium_ in forum JDBC & Databases
    Replies: 3
    Last Post: March 4th, 2011, 02:20 PM
  2. Updating GUI dynamically
    By KrisTheSavage in forum AWT / Java Swing
    Replies: 2
    Last Post: August 29th, 2010, 08:23 AM
  3. [SOLVED] selection end and start
    By nasi in forum What's Wrong With My Code?
    Replies: 13
    Last Post: May 10th, 2010, 04:05 AM
  4. Selection Sorting
    By chronoz13 in forum Algorithms & Recursion
    Replies: 5
    Last Post: December 10th, 2009, 10:08 AM
  5. ResultSet is Closed
    By ramayya4u in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: May 24th, 2009, 03:54 AM

Tags for this Thread