Netbeans: JPanel in designer mode with code behind.

I wanted to add a JPanel to my palette so I could easily include it into a JFrame, in designer mode that is. This was the constructor of my JPanel: /** Creates new form SetupPanel */ public SetupPanel() { super(); this.initComponents(); this.jTextFieldDataDirectory.setText(Main.getProperties().getProperty(Settings.DATADIRECTORY)); this.jTextFieldOpenSSLLocation.setText(Main.getProperties().getProperty(Settings.OPENSSLLOCATION)); } This gave me a nice error when I added it to […]

Java: My FileFilter implementation

This is my javax.swing.filechooser.FileFilter implementation (for the JFileChooser): FileFilter fileFilter = new FileFilter() { @Override public boolean accept(File file) { return file.getAbsolutePath().endsWith(“.xml”) || file.isDirectory(); } @Override public String getDescription() { return “xml settings files”; } }; It accepts .xml files, but allows browsing through directories