• 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

Swing App Design Question

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
If I want to dyamically build a GUI from an XML file where the number of containers will not be known untill runtime, what is the best method for tracking them? I currently am adding the created containers to a hash map. With a key deliminated in the XML file.
Is this a good solution? Are there better ways?
Many thanks.
Tom
 
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess you can store your containers in any collections you want: arrays, hashes, Vectors etc. It all comes down to which one is the fastest. Don't you think so?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As an exercise, I'm building something myself to specify a Swing GUI in XML. If a name='aname' attribute is found on any component I put it into a Map. I can create the UI and then get or set values for any of the components. I can also create a listener or model component and reference it by Map key in multiple components.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you seen:
http://www.swixml.org/
http://www.jeasy.de/
Even if you want to design your own and not use those, they should be able to give you some hints as to the best methods to use.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
see how it is done in JEasy. The hole GUI is stored in XML. To build panels and other components dynamically, JEasy offers a XML-Syntax to create new compnentns at runtime.
To test it, run the Example from www.jeasy.de and chose the tabbedpane dynamic panel. Change the xml string at the left and build a form.
Harry
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic