A
Andreas Bauer
Hi,
I want to load a properties file. I have a class, which returns
a hashtable with all the value. Then in my gui I have
loadActionPerformed-method
private void loadActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser jfc = new JFileChooser();
jfc.showDialog(workingwindow,"Open");
FileFilters filter = new FileFilters();
File file = jfc.getSelectedFile();
LoadProperties lp = new LoadProperties(file);
JPanel jp = new JPanel();
workingwindow.addTab(jfc.getName(),jp);
Hashtable ht = (Hashtable) lp.loadProperties();
Enumeration props = ht.elements();
while(props.hasMoreElements()){
String key = (String) props.nextElement().toString();
String value = (String) ht.get(key);
jp.add(new JLabel(value));
jp.add(new JTextField(value));
}
But that doesn't work. I get a nullpointerexception.
What have I forgotten?
Thanks in advance for any hint.
Regards,
Andi
I want to load a properties file. I have a class, which returns
a hashtable with all the value. Then in my gui I have
loadActionPerformed-method
private void loadActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser jfc = new JFileChooser();
jfc.showDialog(workingwindow,"Open");
FileFilters filter = new FileFilters();
File file = jfc.getSelectedFile();
LoadProperties lp = new LoadProperties(file);
JPanel jp = new JPanel();
workingwindow.addTab(jfc.getName(),jp);
Hashtable ht = (Hashtable) lp.loadProperties();
Enumeration props = ht.elements();
while(props.hasMoreElements()){
String key = (String) props.nextElement().toString();
String value = (String) ht.get(key);
jp.add(new JLabel(value));
jp.add(new JTextField(value));
}
But that doesn't work. I get a nullpointerexception.
What have I forgotten?
Thanks in advance for any hint.
Regards,
Andi