import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.UIManager.LookAndFeelInfo;
/**
@author netarrow
*/
class SetOptions
extends javax.
swing.
JDialog {
private JavArrow frame;
private boolean isFirstSet;
public SetOptions(JavArrow frame, LookAndFeelInfo[] uim, boolean b) {
super(frame);
for(int i = 0; i < uim.length; i++) {
v.add(uim[i].getName());
}
initGUI();
centerFrame();
this.frame = frame;
setVisible(true);
isFirstSet = b;
}
public void centerFrame() {
win=getSize();
setLocation(d.width/2-(win.width/2)-1,d.height/2-(win.height/2)-1);
}
private void initGUI() {
try {
this.setSize(385, 207);
this.setTitle("Opzioni di JavArrow MicroEdition");
this.getContentPane().setLayout(null);
this.setModal(true);
if(isFirstSet)
else
setVisible(false);
}
});
{
this.getContentPane().add(pathsdk);
pathsdk.setBounds(10, 47, 213, 19);
pathsdk.setEditable(false);
}
{
this.getContentPane().add(cerca);
cerca.setText("Cerca");
cerca.setBounds(263, 47, 96, 20);
final SetOptions jf = this;
int i = jfc.showOpenDialog(jf);
pathsdk.
setText(jfc.
getSelectedFile().
toString().
substring(0, jfc.
getSelectedFile().
toString().
lastIndexOf(File.
separator)));
}
}
});
}
{
this.getContentPane().add(InPath);
InPath.setText("Inserire il path del jdk");
InPath.setBounds(12, 31, 203, 14);
}
{
this.getContentPane().add(SelectLaF);
SelectLaF.setText("Slezionare il LookAndFeel(aspetto grafico)");
SelectLaF.setBounds(9, 80, 246, 21);
}
{
for(int i = 0; i < v.size(); i++) {
LAFList.addItem(v.get(i));
}
this.getContentPane().add(LAFList);
LAFList.setBounds(263, 81, 95, 19);
}
{
this.getContentPane().add(ok);
ok.setText("Ok");
ok.setBounds(169, 144, 84, 21);
if(!pathsdk.getText().endsWith("bin")) {
JOptionPane.
showMessageDialog(null,
"Inserire il path dell'sdk, bisogna trovarsi all'interno della cartella bin",
"Errore",
JOptionPane.
ERROR_MESSAGE);
return;
}
JavArrow.pathsdk = pathsdk.getText().replace('\\', '/');
try {
JavArrow.saveOption(JavArrow.pathsdk, LAFList.getSelectedIndex());
JOptionPane.
showMessageDialog(null,
"Al prossimo avvio le opzioni saranno caricate",
"Configurazione riuscita",
JOptionPane.
INFORMATION_MESSAGE);
setVisible(false);
e.printStackTrace();
}
}
});
}
{
this.getContentPane().add(annulla);
annulla.setText("Annulla");
annulla.setBounds(266, 144, 84, 21);
if(isFirstSet)
else
setVisible(false);
}
});
}
e.printStackTrace();
}
}
}