PageRenderTime 51ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/bundles/plugins-trunk/Console/console/bsh/commandoHIST_FILE_ENTRY.bsh

#
Unknown | 40 lines | 34 code | 6 blank | 0 comment | 0 complexity | e1b95c4ad6f195287f4a7e8e8b5dbfd8 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. commandoHIST_FILE_ENTRY(view,pane,ns,label,var,options)
  2. {
  3. entry = new JTextField(20);
  4. value = ns.getVariable(var);
  5. if(value != null)
  6. entry.setText(value.toString());
  7. valueChanged()
  8. {
  9. ns.setVariable(var,entry.getText());
  10. }
  11. dim = entry.getPreferredSize();
  12. dim.width = Integer.MAX_VALUE;
  13. entry.setMaximumSize(dim);
  14. box = new Box(BoxLayout.X_AXIS);
  15. box.add(entry);
  16. box.add(Box.createHorizontalStrut(12));
  17. btn = new RolloverButton(GUIUtilities.loadIcon("Open.png"));
  18. btn.setToolTipText("Choose a file");
  19. listener = new ActionListener()
  20. {
  21. actionPerformed(evt)
  22. {
  23. files = GUIUtilities.showVFSFileDialog(view,
  24. entry.getText(),VFSBrowser.OPEN_DIALOG,
  25. false);
  26. if(files != null)
  27. entry.setText(files[0]);
  28. }
  29. };
  30. btn.addActionListener(listener);
  31. box.add(btn);
  32. pane.addComponent(label,box);
  33. return this;
  34. }