Bom gente, tenho esse codigo aki
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
/**
-
This code was edited or generated using CloudGarden’s Jigloo
-
SWT/Swing GUI Builder, which is free for non-commercial
-
use. If Jigloo is being used commercially (ie, by a corporation,
-
company or business for any purpose whatever) then you
-
should purchase a license for each developer using Jigloo.
-
Please visit www.cloudgarden.com for details.
-
Use of Jigloo implies acceptance of these licensing terms.
-
A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
-
THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
-
LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Dados extends javax.swing.JFrame {
private JTextField dirBackups;
private JLabel jLabel1;
private JTextField localDeArmazenamento;
private JLabel jLabel2;
private JButton jButton1;
private JSpinner spinner;
private JLabel jLabel5;
private JLabel jLabel6;
private JLabel jLabel4;
private JLabel jLabel3;
private JButton b1;{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel(“com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel”);
} catch(Exception e) {
e.printStackTrace();
}
}/**
- Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Dados inst = new Dados();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
public Dados() {
super();
initGUI();
}private void initGUI() {
setLocationRelativeTo(null);
try {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
this.setTitle(“Dados essenciais para o correto funcionamento do script”);
this.setIconImage(new ImageIcon(getClass().getClassLoader().getResource(“Sem título-1 cópia.png”)).getImage());
this.setResizable(false);
{
dirBackups = new JTextField();
getContentPane().add(dirBackups);
dirBackups.setBounds(12, 83, 207, 22);
dirBackups.setToolTipText(“Coloque todo o diretorio”);
}
{
jLabel1 = new JLabel();
getContentPane().add(jLabel1);
jLabel1.setText(“Insira o local dos backups Formados”);
jLabel1.setBounds(12, 63, 218, 14);
jLabel1.setFont(new java.awt.Font(“Times New Roman”,0,14));
}
{
localDeArmazenamento = new JTextField();
getContentPane().add(localDeArmazenamento);
localDeArmazenamento.setBounds(12, 149, 207, 21);
}
{
jLabel2 = new JLabel();
getContentPane().add(jLabel2);
jLabel2.setText(“Insira o local de geracao dos logs”);
jLabel2.setBounds(12, 129, 201, 14);
jLabel2.setFont(new java.awt.Font(“Times New Roman”,0,14));
}
{
jButton1 = new JButton();
getContentPane().add(jButton1);
jButton1.setBounds(219, 149, 25, 21);
jButton1.setText("…");
}
{
b1 = new JButton();
getContentPane().add(b1);
b1.setText("…");
b1.setBounds(219, 83, 25, 22);
}
{
SpinnerNumberModel jSpinner1Model =
new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 2);
spinner = new JSpinner();
getContentPane().add(spinner);
spinner.setModel(jSpinner1Model);
spinner.setBounds(173, 195, 57, 21);
}
{
jLabel3 = new JLabel();
getContentPane().add(jLabel3);
jLabel3.setIcon(new ImageIcon(getClass().getClassLoader().getResource(“ICONE.png”)));
jLabel3.setBounds(250, 3, 275, 234);
}
{
jLabel4 = new JLabel();
getContentPane().add(jLabel4);
jLabel4.setText(“Número de arquivos”);
jLabel4.setBounds(74, 199, 107, 13);
}
{
jLabel5 = new JLabel();
getContentPane().add(jLabel5);
jLabel5.setText(“Script de Arquivos”);
jLabel5.setBounds(71, 12, 116, 14);
jLabel5.setFont(new java.awt.Font(“Times New Roman”,0,14));
}
{
jLabel6 = new JLabel();
getContentPane().add(jLabel6);
jLabel6.setText(" ");
jLabel6.setBounds(66, 32, 141, 19);
jLabel6.setFont(new java.awt.Font(“Tahoma”,0,24));
}
this.setSize(533, 271);
} catch (Exception e) {
e.printStackTrace();
}
}
} - Auto-generated main method to display this JFrame
como podem ver, fiz o codigo em jigloo, mas eu quero uma coisa, tem os dois botoes ai, eu queria que quando o usuario clicasse nele, pudesse escolher diretorio, nao o arquivo, mas sim o diretorio. tentei usar o jFileChooser, mas como o nome ja diz, ele so pega o arquivo.
E alem disso eu tbm n conseguia executar ele, nem sabia como pegar o arquivo encontrado, o botao do fileChooser de cancelar tb m n funcionava, alguem poderia me explicar esses detalhes