1 21 22 25 package net.sf.launch4j.formimpl; 26 27 import javax.swing.JFileChooser ; 28 import javax.swing.JRadioButton ; 29 import javax.swing.event.ChangeEvent ; 30 import javax.swing.event.ChangeListener ; 31 32 import net.sf.launch4j.FileChooserFilter; 33 import net.sf.launch4j.binding.Bindings; 34 import net.sf.launch4j.config.Config; 35 import net.sf.launch4j.form.BasicForm; 36 37 40 public class BasicFormImpl extends BasicForm { 41 42 public BasicFormImpl(Bindings bindings, JFileChooser fc) { 43 bindings.add("outfile", _outfileField) 44 .add("dontWrapJar", _dontWrapJarCheck) 45 .add("jar", _jarField) 46 .add("icon", _iconField) 47 .add("cmdLine", _cmdLineField) 48 .add("errTitle", _errorTitleField) 49 .add("downloadUrl", _downloadUrlField, Config.DOWNLOAD_URL) 50 .add("supportUrl", _supportUrlField) 51 .add("chdir", _chdirField) 52 .add("priorityIndex", new JRadioButton [] { _normalPriorityRadio, 53 _idlePriorityRadio, 54 _highPriorityRadio }) 55 .add("customProcName", _customProcNameCheck) 56 .add("stayAlive", _stayAliveCheck); 57 58 _dontWrapJarCheck.addChangeListener(new DontWrapJarChangeListener()); 59 60 _outfileButton.addActionListener(new BrowseActionListener(true, fc, 61 new FileChooserFilter("Windows executables (.exe)", ".exe"), 62 _outfileField)); 63 _jarButton.addActionListener(new BrowseActionListener(false, fc, 64 new FileChooserFilter("Jar files", ".jar"), _jarField)); 65 _iconButton.addActionListener(new BrowseActionListener(false, fc, 66 new FileChooserFilter("Icon files (.ico)", ".ico"), _iconField)); 67 } 68 69 private class DontWrapJarChangeListener implements ChangeListener { 70 71 public void stateChanged(ChangeEvent e) { 72 boolean dontWrap = _dontWrapJarCheck.isSelected(); 73 if (dontWrap) { 74 _jarLabel.setIcon(loadImage("images/asterix-o.gif")); 75 _jarLabel.setText(Messages.getString("jarPath")); 76 _jarField.setToolTipText(Messages.getString("jarPathTip")); 77 } else { 78 _jarLabel.setIcon(loadImage("images/asterix.gif")); 79 _jarLabel.setText(Messages.getString("jar")); 80 _jarField.setToolTipText(Messages.getString("jarTip")); 81 } 82 _jarButton.setEnabled(!dontWrap); 83 } 84 } 85 } 86 | Popular Tags |