The following code was generated automatically by Netbeans 6.8 Mac version
public class fileBrowser extends javax.swing.JPanel {
/** Creates new form fileBrowser */
public fileBrowser() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jFileChooser1 = new javax.swing.JFileChooser();
setName("Form"); // NOI18N
jFileChooser1.setName("jFileChooser1"); // NOI18N
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jFileChooser1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jFileChooser1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE)
);
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JFileChooser jFileChooser1;
// End of variables declaration
}
I'm trying to make a button that call it (to allow the user to select a file) with the following code:
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {
fileBrowser fileBrowser = new fileBrowser();
fileBrowser.setVisible(true);//why not working?
}
Well...when I click the button, I only get an empty form...Any idea where is the bug?