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 8 of 8

Thread: How to use DataGrid in Swings?

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    7
    My Mood
    Cool
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to use DataGrid in Swings?

    Hi.. I have some output results as Xml String.. and i want to display that output as DataGrid Tables... help me how to use datagrid in swings like c# Datagrid...?


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: How to use DataGrid in Swings?

    What is a DataGrid? Do you mean a JTable? Have you gone through the Swing tutorials yet?

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    7
    My Mood
    Cool
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to use DataGrid in Swings?

    yah.. actually i have seen .net code for that.. actually i am getting output xml file from web services as a string... so i want to convert it into xml then tables... how to use JTables for that? if any example pls give me....

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: How to use DataGrid in Swings?

    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    7
    My Mood
    Cool
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to use DataGrid in Swings?

    Thank u Norm.. but I want to know how to add xml data to a JTable.. and how to add Xml data as multiple rows to a table....?

  6. #6
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: How to use DataGrid in Swings?

    @ch.nagaraju: you're making a common mistake of trying to look for a tutorial for a very specific problem, one that likely doesn't exist. You must break your current problem into smaller steps, and then understand how to do the smaller steps. I suggest you read up on and learn how to extract information from XML files with Java, and then read the tutorial that Norm has linked to on how to create JTables. Then use your brain to combine the two into one finished product.

  7. #7
    Junior Member
    Join Date
    Nov 2012
    Posts
    7
    My Mood
    Cool
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to use DataGrid in Swings?

    ok. thank u Curmudgeon...

    ok i understood.... i know how to convert string to xml file.. but i want to know how to use JTable for that xml file.... i want to display that xml as a table...

  8. #8
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How to use DataGrid in Swings?

    As curmudgeon has pointed out, you need to break the problem down. XML is technically a language, and how you wish to display the contents to a user is dependent upon the data it contains, which you have given us no insight into...is it a list? Is it hierarchical? Are there multiple entries? You have provided no information regarding these questions, so we can only advise to use a JTable because you mention DataGrid (again, not defining what this is but making us guess).

    So in order to break the problem down, I would suggest the following steps (google is your friend for finding tutorials on how to accomplish each of these steps)
    1. Figure out how to read the data within the XML. You could parse it yourself or use a parser that comes with J2SE (google for information on these).
    2. When you read the data you must store it somehow...my advice would be to create classes which best represent the data. But you could structure it using the appropriate data structure
    3. Lastly, and only lastly, should you be thinking about how best to render that data to the user. Is a JTable the best? What about a JTree? Or a JList? Because we have no clue how the data is structured, we can only guess.


    Lastly, if you wish to make full use of the expertise on these forums, I recommend providing as much detail as you can in order to give context to your questions so as to prevent contributors from guessing at what might be the situation.

Similar Threads

  1. Previous Search history for JtextField in swings
    By kumaruri in forum AWT / Java Swing
    Replies: 2
    Last Post: April 18th, 2012, 08:37 PM
  2. [SOLVED] What in SWINGS name do i use to get this outcome?!
    By JonLane in forum AWT / Java Swing
    Replies: 2
    Last Post: February 25th, 2012, 04:55 PM
  3. please correct my programme on swings
    By jeevan reddy mandali in forum What's Wrong With My Code?
    Replies: 7
    Last Post: January 6th, 2012, 03:32 AM
  4. Java Swings
    By rosebrit3 in forum AWT / Java Swing
    Replies: 1
    Last Post: October 19th, 2011, 08:16 AM
  5. [SOLVED] Can anyone mail me an e-book on Swings?
    By Lord Voldemort in forum AWT / Java Swing
    Replies: 3
    Last Post: July 4th, 2011, 07:57 AM