Table2GridBag comes with a class called ConfigurablePanel which is a descendant of javax.swing.JPanel. This panel can directly take a table definition from an HTML file without the need for producing and compiling Java source code first.
The ConfigurablePanel class expects two parameters:
- An inputstream from which to read the table definition (may be a
String, aFileor anInputStreamobject). - A hashmap, mapping component names to components.
Example code:
public static void main(String[] args]) {
HashMap<String, JComponent> hm = new HashMap<String, JComponent>);
hm.put("okButton", new JButton("OK"));
hm.put("cancelButton, new JButton("Cancel"));
ConfigurablePanel panel = new ConfigurablePanel(new File(args[0]), hm);
JFrame f = new JFrame();
f.add(panel);
f.pack();
f.setVisible(true);
}
