PageRenderTime 51ms CodeModel.GetById 30ms app.highlight 1ms RepoModel.GetById 19ms app.codeStats 0ms

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

#
Unknown | 40 lines | 34 code | 6 blank | 0 comment | 0 complexity | 41b125acd854165a8249ab59736f878e MD5 | raw file
 1commandoDIR_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
 8	valueChanged()
 9	{
10		ns.setVariable(var,entry.getText());
11	}
12
13	dim = entry.getPreferredSize();
14	dim.width = Integer.MAX_VALUE;
15	entry.setMaximumSize(dim);
16
17	box = new Box(BoxLayout.X_AXIS);
18	box.add(entry);
19	box.add(Box.createHorizontalStrut(12));
20
21	btn = new RolloverButton(GUIUtilities.loadIcon("Open.png"));
22	btn.setToolTipText("Choose a directory");
23	listener = new ActionListener()
24	{
25		actionPerformed(evt)
26		{
27			files = GUIUtilities.showVFSFileDialog(view,
28				entry.getText(),VFSBrowser.CHOOSE_DIRECTORY_DIALOG,
29				false);
30			if(files != null)
31				entry.setText(files[0]);
32		}
33	};
34	btn.addActionListener(listener);
35	box.add(btn);
36
37	pane.addComponent(label,box);
38
39	return this;
40}