PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms 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
 1commandoHIST_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
 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 file");
23	listener = new ActionListener()
24	{
25		actionPerformed(evt)
26		{
27			files = GUIUtilities.showVFSFileDialog(view,
28				entry.getText(),VFSBrowser.OPEN_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}