• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML parsing in Java Swing

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there below is the code for parsing xml in java swing now the xml is parsed properly in this is displayed in console but the issue is i have to display it in the new jframe gui with text box in it can anyone out there help regarding the same.

 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi keba,
Welcome to the Ranch!

I see that you have posted xml parsing code and some sop statements. You first need to gather this output in variable - so, declare a StringBuilder variable and keep appending to that the needed text.
Then, you have to create a JFrame, have a JTextArea in a JScrollPane and call setText on the text area to have the content printed in the GUI.

If you are new to Swing GUI programming, you can start here

Also, would like to point out 2 things:
Please do not use all caps for the subject - on the net, it is considered as shouting. And also, please UseCodeTags when posting code. I have added them this time for you.
 
keba dev
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks For your response will update code and will try resolving the way you have told also will keep in mind when posting next time the caps thing and tags.

Thank You For Your Time And Assistance.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure, you're welcome.
 
keba dev
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have to display parsed string into the text box i get required output in console by this code.

if(nameAttribute != null && !nameAttribute.equals("")){
System.out.println("Name : " +nameAttribute);

}

if (blname) {
double value = Double.parseDouble(new String(ch, start, length));
System.out.println("Value : " + value);
blname = false;
}



the code below of jtextfield
textField.setBounds(163, 77, 86, 20);
textField.setColumns(10);

like wise i have three textfields can you please help i have tried settext also append also string builder, can you post a sample for the same. Thanks in advance.

 
keba dev
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi


I am posting my code here i hope that might give you clear idea that where i am going wrong. There might be certain unwanted code please ignore it.



 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
keba dev, I added the code tags to your last post. Please do that yourself in the future.

As for where you are going wrong: Ranganathan Kaliyur Mannar suggested you should collect the data from the parser into a StringBuilder. That's still good advice, even though you have not paid any attention to it so far. Hopefully you already know that System.out.println doesn't do that.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic