/[svn]/jsampler/trunk/src/org/jsampler/view/std/JSInstrumentChooser.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/std/JSInstrumentChooser.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1352 by iliev, Sun Sep 16 23:24:15 2007 UTC revision 1480 by iliev, Wed Nov 14 21:39:45 2007 UTC
# Line 92  public class JSInstrumentChooser extends Line 92  public class JSInstrumentChooser extends
92          private final JComboBox cbInstruments = new JComboBox();          private final JComboBox cbInstruments = new JComboBox();
93                    
94                    
95          private final JComboBox cbDbInstrument = new JComboBox();          private final JComboBox cbDbInstrument = createComboBox();
96          private final JButton btnBrowseDb;          private final JButton btnBrowseDb;
97                    
98          private final JLabel lFilename = new JLabel(i18n.getLabel("JSInstrumentChooser.lFilename"));          private final JLabel lFilename = new JLabel(i18n.getLabel("JSInstrumentChooser.lFilename"));
99          private final JLabel lIndex = new JLabel(i18n.getLabel("JSInstrumentChooser.lIndex"));          private final JLabel lIndex = new JLabel(i18n.getLabel("JSInstrumentChooser.lIndex"));
100                    
101          private final JComboBox cbFilename = new JComboBox();          private final JComboBox cbFilename = createComboBox();
102          private final JSpinner spinnerIndex = new JSpinner(new SpinnerNumberModel(0, 0, 500, 1));          private final JSpinner spinnerIndex = new JSpinner(new SpinnerNumberModel(0, 0, 500, 1));
103                    
104          private final JButton btnBrowse;          private final JButton btnBrowse;
# Line 280  public class JSInstrumentChooser extends Line 280  public class JSInstrumentChooser extends
280                  return p;                  return p;
281          }          }
282                    
283            protected JComboBox
284            createComboBox() { return new JComboBox(); }
285            
286          protected JSPrefs          protected JSPrefs
287          preferences() { return CC.getViewConfig().preferences(); }          preferences() { return CC.getViewConfig().preferences(); }
288                    
# Line 468  public class JSInstrumentChooser extends Line 471  public class JSInstrumentChooser extends
471                  String s = preferences().getStringProperty("lastInstrumentLocation");                  String s = preferences().getStringProperty("lastInstrumentLocation");
472                  JFileChooser fc = new JFileChooser(s);                  JFileChooser fc = new JFileChooser(s);
473                  int result = fc.showOpenDialog(this);                  int result = fc.showOpenDialog(this);
474                  if(result == JFileChooser.APPROVE_OPTION) {                  if(result != JFileChooser.APPROVE_OPTION) return;
475                          cbFilename.setSelectedItem(toEscapedString(fc.getSelectedFile().getPath()));                  
476                          btnOk.requestFocusInWindow();                  String path = fc.getSelectedFile().getAbsolutePath();
477                                            if(java.io.File.separatorChar == '\\') {
478                          String path = fc.getCurrentDirectory().getAbsolutePath();                          path.replace('\\', '/');
                         preferences().setStringProperty("lastInstrumentLocation", path);  
479                  }                  }
480                    cbFilename.setSelectedItem(toEscapedString(path));
481                    btnOk.requestFocusInWindow();
482                    
483                    path = fc.getCurrentDirectory().getAbsolutePath();
484                    preferences().setStringProperty("lastInstrumentLocation", path);
485          }          }
486                    
487          private void          private void

Legend:
Removed from v.1352  
changed lines
  Added in v.1480

  ViewVC Help
Powered by ViewVC