Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2008
    Posts
    25
    Rep Power
    0

    Smile Code Customiser on Swing Table

    Hi :),
    How may I use the code customiser (in netbeans) to alter a table such that it has comboboxes or a little button with "..." next to the text (like the property sheet used by netbeans)?

    There seems to be a lack of tutorials on this one the net.

    Thank you.

    Q

  2. #2
    Dieter's Avatar
    Dieter is offline Member
    Join Date
    Sep 2009
    Posts
    91
    Rep Power
    0

    Default

    what you mean with use the code customiser (in netbeans) to alter a table?

    you want the designview?

    sorry if i didn't understand your question.

    all the best,

    Dieter
    Programming today is a race between software engineers striving to build bigger and better idiot proof programs,and the Universe trying to produce bigger and better idiots...

  3. #3
    Join Date
    Dec 2008
    Posts
    25
    Rep Power
    0

    Default

    Hi Dieter. Thanks for the reply. I added a table to the form. I right-click it and select "customise code" option. Then a dialog box pops up showing the code which designs the table which is alterable:

    [code]

    jTable1 = new javax.swing.JTable();

    jTable1.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {
    {null, null, null, null},
    {null, null, null, null},
    {null, null, null, null},
    {null, null, null, null}
    },
    new String [] {
    "Title 1", "Title 2", "Title 3", "Title 4"
    }
    ));

    jScrollPane1.setViewportView(jTable1);

    [code]

    I would like to add a combox or some other control to the table instead of the default cells.

  4. #4
    Dieter's Avatar
    Dieter is offline Member
    Join Date
    Sep 2009
    Posts
    91
    Rep Power
    0

    Default

    a table is someting like a datagridview. you display valuys in it. you can also use that for displaying values or objects from a SQL DB. dont know if you will be able to drag and drop other objects there. you can make ur table smaller and just drag comboboxes onto the mainpanel. I never used it in java tbh, so dont know if it has the same function as VB.Net.

    hope this is what you mean.

    All the best,

    Dieter

    all the best,

    Dieter
    Programming today is a race between software engineers striving to build bigger and better idiot proof programs,and the Universe trying to produce bigger and better idiots...

  5. #5
    Dieter's Avatar
    Dieter is offline Member
    Join Date
    Sep 2009
    Posts
    91
    Rep Power
    0

    Default

    You get an "all the best, Dieter" twice from me! :D
    Programming today is a race between software engineers striving to build bigger and better idiot proof programs,and the Universe trying to produce bigger and better idiots...

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

    Default

    If you would like your JTable cells to display JComboBoxes on click, then you will need to create a custom cell editor. Please have a look at the Sun Swing tutorials section on JTables and it will show you how to do this.

    Much luck.

  7. #7
    Join Date
    Dec 2008
    Posts
    25
    Rep Power
    0

    Default

    Thanks for the help guys. NP Dieter. Hope you lose the weight you would like :)

Similar Threads

  1. Convert THE APPLET CODE TO SWING USING JPANEL
    By jammyjamsticy in forum AWT / Swing
    Replies: 2
    Last Post: 12-22-2011, 10:16 AM
  2. Replies: 0
    Last Post: 08-15-2009, 09:30 AM
  3. EventHandling code for Swing application
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-07-2007, 01:06 PM
  4. code for making a java swing program a demo verson
    By fakhruddin in forum AWT / Swing
    Replies: 1
    Last Post: 11-27-2007, 09:54 PM
  5. jdbc/ swing code problem
    By sami in forum Advanced Java
    Replies: 1
    Last Post: 08-13-2007, 03:26 PM

Posting Permissions

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