Java Swing jCheckbox creation from an external file, and not using a "GUI Builder"??

H

henderjm

Does anyone know how to create a bunch of jCheckboxes based off of some

XML file? I'm trying to add some checkboxes in a jPanel, but can't
figure out how.
The XML file would probably look similar to:
<?xml version="1.0"?>
<SAMPLES>
<SAMPLE ID="1">
<Name>Some Name</Name>
<Description>Some Descr</Description>
<Additional_Info>Some info</Additional_Info>
<Warning_Level>0 through 5</Warning_Level>
<Warning_Description>Some Warning description</Warning_Description>

</SAMPLE>
<SAMPLE ID="2">
<Name>Some Other Name</Name>
<Description>Some Other Descr</Description>
<Additional_Info>Some Other info</Additional_Info>
<Warning_Level>0 through 5</Warning_Level>
<Warning_Description>Some Other Warning
description</Warning_Description>
</SAMPLE>
</SAMPLES>
 
J

Joshua

Does anyone know how to create a bunch of jCheckboxes based off of some

XML file? I'm trying to add some checkboxes in a jPanel, but can't
figure out how.

I don't know the details of accessing XML through Java (I've only done it
through JavaScript), but you should check out these tutorials:
http://java.sun.com/docs/books/tutorial/uiswing/index.html (Go to the
components and find the checkbox tutorial)
http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/index.html
(This is the XML Processing tutorial -- it's a lot easier than wading
through the API yourself).

Also the packages you (may) need to be concerned about:
javax.xml
javax.xml.parsers
org.w3c.dom
 
H

henderjm

thanks for the effort, but I don't think that will help me. The
example they have for DOM is a JTree which is only one object with the
leafs and nodes being the XML portion, and I need to create many
objects that are based off of the XML file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top