Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2010
    Location
    Jamshoro, Satabo Khairpur Mirs
    Posts
    21
    Rep Power
    0

    Default Problem in setting headers of jTable

    Hi there Im facing problem of setting headers of jTable component
    my code looks like

    XML Code:
    String[] columnNames = {"First Name",
                            "Last Name",
                            "Nick Name"}
      Object[][] data = {"Arshad","Soomro","Ali"},
                               {"Asad","Soomro","Ali"}
    but it only shows the contents of rows not headers

    help me in this case...!

  2. #2
    NRitH is offline Senior Member
    Join Date
    Feb 2011
    Posts
    118
    Rep Power
    0

    Default

    Did you pass the column names to the JTable?

  3. #3
    Join Date
    Jul 2010
    Location
    Jamshoro, Satabo Khairpur Mirs
    Posts
    21
    Rep Power
    0

    Default

    yes I passed like this

    JTable myTable = new JTable (data, columnNames);

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,197
    Rep Power
    19

    Default

    How are you displaying the JTable? Have you gone through any tutorial on how to use tables?
    How to Use Tables (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

    To get better help sooner, post a SSCCE that clearly demonstrates your problem.

    db

  5. #5
    Join Date
    Jul 2010
    Location
    Jamshoro, Satabo Khairpur Mirs
    Posts
    21
    Rep Power
    0

    Default

    Thanks Darryl.Burke from your suggestion finally I did it and succeeded
    it was Problem in adding to container

    thank you.....

Similar Threads

  1. Setting jTable cell?
    By greatmajestics in forum New To Java
    Replies: 5
    Last Post: 04-22-2010, 05:33 PM
  2. Sorting in JTable without clicking on column headers
    By ProgrammingPup in forum Advanced Java
    Replies: 6
    Last Post: 11-04-2009, 05:26 AM
  3. tooltips for JTable column headers
    By fossildoc in forum AWT / Swing
    Replies: 2
    Last Post: 12-18-2008, 11:42 AM
  4. Problem in setting Eclipse
    By Crisanto in forum New To Java
    Replies: 3
    Last Post: 10-29-2008, 06:48 PM
  5. Replies: 2
    Last Post: 05-15-2008, 10:15 AM

Tags for this Thread

Posting Permissions

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