/[svn]/jsampler/trunk/src/org/jsampler/view/classic/PrefsDlg.java
ViewVC logotype

Annotation of /jsampler/trunk/src/org/jsampler/view/classic/PrefsDlg.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1143 - (hide annotations) (download)
Mon Apr 2 21:18:31 2007 UTC (17 years, 1 month ago) by iliev
File size: 34952 byte(s)
* upgrading to version 0.4a

1 iliev 787 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4 iliev 1143 * Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com>
5 iliev 787 *
6     * This file is part of JSampler.
7     *
8     * JSampler is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License version 2
10     * as published by the Free Software Foundation.
11     *
12     * JSampler is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with JSampler; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20     * MA 02111-1307 USA
21     */
22    
23     package org.jsampler.view.classic;
24    
25 iliev 842 import java.awt.BorderLayout;
26     import java.awt.Color;
27 iliev 787 import java.awt.Container;
28 iliev 842 import java.awt.Cursor;
29     import java.awt.Dialog;
30 iliev 787 import java.awt.Dimension;
31     import java.awt.GraphicsEnvironment;
32     import java.awt.Font;
33     import java.awt.Frame;
34     import java.awt.GridBagConstraints;
35     import java.awt.GridBagLayout;
36     import java.awt.Insets;
37    
38     import java.awt.event.ActionEvent;
39     import java.awt.event.ActionListener;
40 iliev 842 import java.awt.event.ItemEvent;
41     import java.awt.event.ItemListener;
42     import java.awt.event.MouseAdapter;
43     import java.awt.event.MouseEvent;
44 iliev 787
45 iliev 1143 import java.io.File;
46    
47 iliev 787 import java.util.Locale;
48 iliev 842 import java.util.Vector;
49 iliev 787
50     import javax.swing.BorderFactory;
51     import javax.swing.Box;
52     import javax.swing.BoxLayout;
53 iliev 842 import javax.swing.DefaultButtonModel;
54 iliev 787 import javax.swing.JButton;
55 iliev 842 import javax.swing.JCheckBox;
56     import javax.swing.JColorChooser;
57 iliev 787 import javax.swing.JComboBox;
58 iliev 1143 import javax.swing.JFileChooser;
59 iliev 787 import javax.swing.JLabel;
60     import javax.swing.JOptionPane;
61     import javax.swing.JPanel;
62     import javax.swing.JPasswordField;
63 iliev 911 import javax.swing.JSpinner;
64 iliev 787 import javax.swing.JTabbedPane;
65     import javax.swing.JTextField;
66 iliev 911 import javax.swing.SpinnerNumberModel;
67 iliev 787
68 iliev 842 import javax.swing.event.ChangeEvent;
69     import javax.swing.event.ChangeListener;
70    
71 iliev 787 import net.sf.juife.EnhancedDialog;
72     import net.sf.juife.JuifeUtils;
73 iliev 842 import net.sf.juife.LinkButton;
74     import net.sf.juife.OkCancelDialog;
75 iliev 787
76 iliev 842 import org.jsampler.CC;
77 iliev 787 import org.jsampler.HF;
78     import org.jsampler.JSI18n;
79     import org.jsampler.JSampler;
80 iliev 911 import org.jsampler.LSConsoleModel;
81 iliev 787 import org.jsampler.Prefs;
82    
83 iliev 842 import org.jsampler.task.SetServerAddress;
84    
85 iliev 787 import static org.jsampler.view.classic.ClassicI18n.i18n;
86    
87    
88     /**
89     *
90     * @author Grigor Iliev
91     */
92     public class PrefsDlg extends EnhancedDialog {
93 iliev 911 private final GeneralPane genPane = new GeneralPane();
94 iliev 787 private final ViewPane viewPane = new ViewPane();
95 iliev 911 private final ConsolePane consolePane = new ConsolePane();
96 iliev 787 private final ConnectionPane conPane = new ConnectionPane();
97    
98     private final JButton btnApply = new JButton(i18n.getButtonLabel("apply"));
99     private final JButton btnClose = new JButton(i18n.getButtonLabel("close"));
100    
101    
102     public
103     PrefsDlg(Frame frm) {
104     super(frm, i18n.getLabel("PrefsDlg"), true);
105    
106     initPrefsDlg();
107     handleEvents();
108     initPrefs();
109    
110     setLocation(JuifeUtils.centerLocation(this, frm));
111     }
112    
113     private void
114     initPrefsDlg() {
115     JTabbedPane tp = new JTabbedPane();
116     tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane);
117     tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane);
118 iliev 911 tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane);
119 iliev 787 tp.addTab(i18n.getLabel("PrefsDlg.tabConnection"), conPane);
120     tp.setAlignmentX(RIGHT_ALIGNMENT);
121    
122     // Set preferred size for Apply & Exit buttons
123     Dimension d = JuifeUtils.getUnionSize(btnApply, btnClose);
124     btnApply.setPreferredSize(d);
125     btnClose.setPreferredSize(d);
126    
127     JPanel btnPane = new JPanel();
128     btnPane.setLayout(new BoxLayout(btnPane, BoxLayout.X_AXIS));
129     btnPane.add(btnApply);
130     btnPane.add(Box.createRigidArea(new Dimension(5, 0)));
131     btnPane.add(btnClose);
132     btnPane.setAlignmentX(RIGHT_ALIGNMENT);
133    
134     JPanel mainPane = new JPanel();
135     mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS));
136     mainPane.add(tp);
137     mainPane.add(Box.createRigidArea(new Dimension(0, 12)));
138     mainPane.add(btnPane);
139     mainPane.setBorder(BorderFactory.createEmptyBorder(11, 12, 12, 12));
140    
141     getContentPane().add(mainPane);
142    
143     pack();
144     setResizable(false);
145     }
146    
147     private void
148     handleEvents() {
149     btnApply.addActionListener(new ActionListener() {
150     public void
151     actionPerformed(ActionEvent e) { onApply(); }
152     });
153    
154     btnClose.addActionListener(new ActionListener() {
155     public void
156     actionPerformed(ActionEvent e) { onExit(); }
157     });
158     }
159    
160     protected void
161     onOk() { onApply(); }
162    
163     protected void
164     onCancel() { onExit(); }
165    
166     private void
167     initPrefs() {
168     setLSAddress(Prefs.getLSAddress());
169     setLSPort(Prefs.getLSPort());
170     }
171    
172     private void
173     onApply() {
174 iliev 842 genPane.apply();
175     viewPane.apply();
176 iliev 911 consolePane.apply();
177 iliev 787
178     // CONNECTION
179     Prefs.setLSAddress(getLSAddress());
180    
181 iliev 842 boolean b = true;
182 iliev 787 String s = getLSPort();
183     try {
184     if(s.length() > 0) {
185     int port = Integer.parseInt(s);
186     if(port > 0 && port < 0xffff)
187 iliev 842 Prefs.setLSPort(port);
188 iliev 787 else b = false;
189 iliev 842 } else Prefs.setLSPort(-1); // -1 resets to default value
190 iliev 787 } catch(NumberFormatException x) {
191     b = false;
192     }
193    
194     if(!b) {
195     JOptionPane.showMessageDialog (
196     this,
197     i18n.getError("PrefsDlg.invalidPort", s),
198     i18n.getError("error"),
199     JOptionPane.ERROR_MESSAGE
200     );
201    
202     return;
203     }
204    
205 iliev 842 CC.getTaskQueue().add (
206     new SetServerAddress(Prefs.getLSAddress(), Prefs.getLSPort())
207     );
208    
209 iliev 787 setVisible(false);
210     }
211    
212     private void
213     onExit() { setVisible(false); }
214    
215     private String
216     getLSAddress() { return conPane.getLSAddress().trim(); }
217    
218     private void
219     setLSAddress(String s) { conPane.setLSAddress(s); }
220    
221     private String
222     getLSPort() { return conPane.getLSPort().trim(); }
223    
224     private void
225     setLSPort(int port) { conPane.setLSPort(String.valueOf(port)); }
226 iliev 911
227     protected static class ColorButton extends JPanel {
228     private Color color;
229     private final Vector<ActionListener> listeners = new Vector<ActionListener>();
230    
231     ColorButton() { this(Color.WHITE); }
232    
233     ColorButton(Color c) {
234     color = c;
235    
236     //setBorderPainted(false);
237     setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
238     setPreferredSize(new Dimension(42, 16));
239     setMaximumSize(new Dimension(42, 16));
240     setBorder(BorderFactory.createLineBorder(Color.BLACK));
241    
242     addMouseListener(new MouseAdapter() {
243     public void
244     mouseClicked(MouseEvent e) {
245     if(!isEnabled()) return;
246     if(e.getButton() == e.BUTTON1) showColorChooser();
247     }
248     });
249     }
250    
251     /**
252     * Registers the specified listener to be
253     * notified when the current color is changed.
254     * @param l The <code>ActionListener</code> to register.
255     */
256     public void
257     addActionListener(ActionListener l) { listeners.add(l); }
258    
259     /**
260     * Removes the specified listener.
261     * @param l The <code>ActionListener</code> to remove.
262     */
263     public void
264     removeActionListener(ActionListener l) { listeners.remove(l); }
265    
266     /** Notifies listeners that the current color is changed. */
267     private void
268     fireActionPerformed() {
269     ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, null);
270     for(ActionListener l : listeners) l.actionPerformed(e);
271     }
272    
273     public void
274     setEnabled(boolean b) {
275     setOpaque(b);
276     if(b) setBorder(BorderFactory.createLineBorder(Color.BLACK));
277     else setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
278     //setBorderPainted(!b);
279     super.setEnabled(b);
280     }
281    
282     private void
283     showColorChooser() {
284     ColorDlg dlg = new ColorDlg (
285     (Dialog)JuifeUtils.getWindow(this), getColor()
286     );
287    
288     dlg.setVisible(true);
289     if(!dlg.isCancelled()) {
290     setColor(dlg.getColor());
291     fireActionPerformed();
292     }
293     }
294    
295     public Color
296     getColor() { return color; }
297    
298     public void
299     setColor(Color c) {
300     color = c;
301     setBackground(color);
302     }
303     }
304    
305     protected static class ColorDlg extends OkCancelDialog {
306     private final JColorChooser colorChooser = new JColorChooser();
307    
308     ColorDlg(Dialog owner) { this(owner, Color.WHITE); }
309    
310     ColorDlg(Dialog owner, Color c) {
311     super(owner);
312    
313     colorChooser.setPreviewPanel(new JPanel());
314     colorChooser.setColor(c);
315    
316     JPanel mainPane = new JPanel();
317     mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS));
318     mainPane.add(colorChooser);
319    
320     mainPane.add(Box.createRigidArea(new Dimension(0, 6)));
321    
322     final JPanel p = new JPanel();
323     p.setBackground(c);
324     p.setBorder(BorderFactory.createLineBorder(Color.BLACK));
325     mainPane.add(p);
326    
327     p.setPreferredSize(new Dimension(48, 8));
328     p.setMaximumSize(new Dimension(Short.MAX_VALUE, 8));
329    
330     setMainPane(mainPane);
331    
332     colorChooser.getSelectionModel().addChangeListener(new ChangeListener() {
333     public void
334     stateChanged(ChangeEvent e) { p.setBackground(getColor()); }
335     });
336     }
337    
338     protected void
339     onOk() { setVisible(false); }
340    
341     protected void
342     onCancel() { setVisible(false); }
343    
344     public Color
345     getColor() { return colorChooser.getColor(); }
346     }
347 iliev 787 }
348    
349     class GeneralPane extends JPanel {
350 iliev 842 private final JCheckBox checkWindowSizeAndLocation =
351     new JCheckBox(i18n.getLabel("GeneralPane.checkWindowSizeAndLocation"));
352    
353 iliev 911 private final JCheckBox checkLeftPaneState =
354     new JCheckBox(i18n.getLabel("GeneralPane.checkLeftPaneState"));
355    
356     private final JCheckBox checkShowLSConsoleWhenRunScript =
357     new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript"));
358    
359 iliev 1143 private final JTextField tfJSamplerHome = new JTextField();
360     private final JButton btnChange = new JButton(i18n.getLabel("GeneralPane.btnChange"));
361    
362 iliev 911 private final JLabel lRecentScriptsSize =
363     new JLabel(i18n.getLabel("GeneralPane.lRecentScriptsSize"));
364     private final JSpinner spRecentScriptsSize;
365     private final JButton btnClearRecentScriptList =
366     new JButton(i18n.getButtonLabel("GeneralPane.btnClearRecentScriptList"));
367    
368    
369 iliev 787 public
370 iliev 911 GeneralPane() {
371 iliev 842 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
372 iliev 787
373 iliev 911 checkWindowSizeAndLocation.setAlignmentX(JPanel.LEFT_ALIGNMENT);
374 iliev 842
375 iliev 911 checkWindowSizeAndLocation.setSelected(ClassicPrefs.getSaveWindowProperties());
376 iliev 842 checkWindowSizeAndLocation.addItemListener(new ItemListener() {
377     public void
378     itemStateChanged(ItemEvent e) {
379     boolean b = e.getStateChange() == e.SELECTED;
380 iliev 911 //checkWindowSizeAndLocation.setEnabled(b);
381 iliev 842 }
382     });
383    
384 iliev 911 add(checkWindowSizeAndLocation);
385 iliev 842
386 iliev 911 checkLeftPaneState.setAlignmentX(JPanel.LEFT_ALIGNMENT);
387     checkLeftPaneState.setSelected(ClassicPrefs.getSaveLeftPaneState());
388     add(checkLeftPaneState);
389    
390     checkShowLSConsoleWhenRunScript.setAlignmentX(JPanel.LEFT_ALIGNMENT);
391    
392     boolean b = ClassicPrefs.getShowLSConsoleWhenRunScript();
393     checkShowLSConsoleWhenRunScript.setSelected(b);
394    
395     add(checkShowLSConsoleWhenRunScript);
396    
397     add(Box.createRigidArea(new Dimension(0, 6)));
398    
399 iliev 1143 JPanel jhp = new JPanel();
400     jhp.setLayout(new BoxLayout(jhp, BoxLayout.Y_AXIS));
401    
402     JPanel p = new JPanel();
403     p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
404     if(CC.getJSamplerHome() != null) tfJSamplerHome.setText(CC.getJSamplerHome());
405     Dimension d;
406     d = new Dimension(Short.MAX_VALUE, tfJSamplerHome.getPreferredSize().height);
407     tfJSamplerHome.setMaximumSize(d);
408     p.add(tfJSamplerHome);
409     p.add(Box.createRigidArea(new Dimension(5, 0)));
410     p.add(btnChange);
411     p.setBorder(BorderFactory.createEmptyBorder(2, 6, 6, 6));
412     p.setAlignmentX(JPanel.CENTER_ALIGNMENT);
413     jhp.add(p);
414    
415     String s = i18n.getLabel("GeneralPane.jSamplerHome");
416     jhp.setBorder(BorderFactory.createTitledBorder(s));
417     jhp.setMaximumSize(new Dimension(Short.MAX_VALUE, jhp.getPreferredSize().height));
418     jhp.setAlignmentX(JPanel.LEFT_ALIGNMENT);
419     add(jhp);
420    
421     add(Box.createRigidArea(new Dimension(0, 6)));
422    
423 iliev 911 JPanel rsp = new JPanel();
424     rsp.setLayout(new BoxLayout(rsp, BoxLayout.Y_AXIS));
425    
426     int i = ClassicPrefs.getRecentScriptsSize();
427     spRecentScriptsSize = new JSpinner(new SpinnerNumberModel(i, 0, 100, 1));
428     spRecentScriptsSize.setMaximumSize(spRecentScriptsSize.getPreferredSize());
429    
430 iliev 1143 p = new JPanel();
431 iliev 911 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
432     p.add(lRecentScriptsSize);
433     p.add(Box.createRigidArea(new Dimension(5, 0)));
434     p.add(spRecentScriptsSize);
435    
436     p.setAlignmentX(JPanel.CENTER_ALIGNMENT);
437     rsp.add(p);
438    
439     rsp.add(Box.createRigidArea(new Dimension(0, 6)));
440    
441     btnClearRecentScriptList.addActionListener(new ActionListener() {
442     public void
443     actionPerformed(ActionEvent e) {
444     ClassicPrefs.setRecentScripts(null);
445     ((MainFrame)CC.getMainFrame()).clearRecentScripts();
446     }
447     });
448    
449     btnClearRecentScriptList.setAlignmentX(JPanel.CENTER_ALIGNMENT);
450     rsp.add(btnClearRecentScriptList);
451     rsp.add(Box.createRigidArea(new Dimension(0, 6)));
452    
453     rsp.setMaximumSize(new Dimension(Short.MAX_VALUE, rsp.getPreferredSize().height));
454     rsp.setAlignmentX(JPanel.LEFT_ALIGNMENT);
455 iliev 1143 s = i18n.getLabel("GeneralPane.recentScripts");
456     rsp.setBorder(BorderFactory.createTitledBorder(s));
457 iliev 911
458     add(rsp);
459     add(Box.createGlue());
460    
461     setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
462 iliev 1143
463     btnChange.addActionListener(new ActionListener() {
464     public void
465     actionPerformed(ActionEvent e) { onChange(); }
466     });
467 iliev 787 }
468 iliev 842
469 iliev 1143 private void
470     onChange() {
471     JFileChooser fc = new JFileChooser();
472     fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
473     int result = fc.showOpenDialog(this);
474     if(result != JFileChooser.APPROVE_OPTION) return;
475    
476     String s = CC.getJSamplerHome();
477     String suf = File.separator + ".jsampler";
478     if(s != null) suf = File.separator + new File(s).getName();
479    
480     tfJSamplerHome.setText(fc.getSelectedFile().getPath() + suf);
481     }
482    
483 iliev 842 protected void
484     apply() {
485 iliev 911 ClassicPrefs.setSaveWindowProperties(checkWindowSizeAndLocation.isSelected());
486     ClassicPrefs.setSaveLeftPaneState(checkLeftPaneState.isSelected());
487    
488     boolean b = checkShowLSConsoleWhenRunScript.isSelected();
489     ClassicPrefs.setShowLSConsoleWhenRunScript(b);
490    
491     int size = Integer.parseInt(spRecentScriptsSize.getValue().toString());
492     ClassicPrefs.setRecentScriptstSize(size);
493     ((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu();
494 iliev 1143
495     String s = tfJSamplerHome.getText();
496     if(s.length() > 0 && !s.equals(CC.getJSamplerHome())) {
497     CC.changeJSamplerHome(s);
498     }
499 iliev 842 }
500 iliev 787 }
501    
502     class ViewPane extends JPanel {
503     private final JLabel lIfaceLanguage =
504     new JLabel(i18n.getLabel("ViewPane.lIfaceLanguage"));
505     private final JComboBox cbIfaceLanguage = new JComboBox();
506    
507     private final JLabel lIfaceFont =
508     new JLabel(i18n.getLabel("ViewPane.lIfaceFont"));
509     private final JComboBox cbIfaceFont = new JComboBox();
510    
511 iliev 842 private final JCheckBox checkBorderColor =
512     new JCheckBox(i18n.getLabel("ViewPane.channelBorderColor"));
513 iliev 911 private final PrefsDlg.ColorButton btnBorderColor =
514     new PrefsDlg.ColorButton(Color.WHITE);
515 iliev 842
516 iliev 1143 private final JCheckBox checkHlChnBorderColor =
517     new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBorderColor"));
518     private final PrefsDlg.ColorButton btnHlChnBorderColor =
519     new PrefsDlg.ColorButton(Color.WHITE);
520    
521     private final JCheckBox checkSelChnBgColor =
522     new JCheckBox(i18n.getLabel("ViewPane.checkSelChnBgColor"));
523     private final PrefsDlg.ColorButton btnSelChnBgColor =
524     new PrefsDlg.ColorButton(Color.WHITE);
525    
526     private final JCheckBox checkHlChnBgColor =
527     new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBgColor"));
528     private final PrefsDlg.ColorButton btnHlChnBgColor =
529     new PrefsDlg.ColorButton(Color.WHITE);
530    
531 iliev 787 public
532     ViewPane() { initViewPane(); }
533    
534     private void
535     initViewPane() {
536     cbIfaceLanguage.setMaximumSize (
537     new Dimension(Short.MAX_VALUE, cbIfaceLanguage.getPreferredSize().height)
538     );
539    
540     for(Locale l : JSI18n.getAvailableLocales()) {
541     LocaleBox box = new LocaleBox(l);
542     cbIfaceLanguage.addItem(box);
543     if ( l.getLanguage().equals(Prefs.getInterfaceLanguage()) &&
544     l.getCountry().equals(Prefs.getInterfaceCountry())
545     ) cbIfaceLanguage.setSelectedItem(box);
546     }
547    
548     cbIfaceFont.setMaximumSize (
549     new Dimension(Short.MAX_VALUE, cbIfaceFont.getPreferredSize().height)
550     );
551    
552     cbIfaceFont.addItem("[Default]");
553    
554     String[] fontS =
555     GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
556    
557     for(String f : fontS) cbIfaceFont.addItem(f);
558    
559     if(Prefs.getInterfaceFont() == null) cbIfaceFont.setSelectedItem("[Default]");
560     else cbIfaceFont.setSelectedItem(Prefs.getInterfaceFont());
561    
562     setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
563    
564     JPanel ifacePane = new JPanel();
565     ifacePane.setLayout(new BoxLayout(ifacePane, BoxLayout.X_AXIS));
566     ifacePane.add(lIfaceLanguage);
567     ifacePane.add(Box.createRigidArea(new Dimension(5, 0)));
568     ifacePane.add(cbIfaceLanguage);
569    
570     add(ifacePane);
571    
572     add(Box.createRigidArea(new Dimension(0, 6)));
573    
574     JPanel fontPane = new JPanel();
575     fontPane.setLayout(new BoxLayout(fontPane, BoxLayout.X_AXIS));
576     fontPane.add(lIfaceFont);
577     fontPane.add(Box.createRigidArea(new Dimension(5, 0)));
578     fontPane.add(cbIfaceFont);
579    
580     add(fontPane);
581 iliev 842 add(Box.createRigidArea(new Dimension(0, 6)));
582     add(createCustomColorsPane());
583    
584 iliev 787 setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
585     }
586    
587 iliev 842 private JPanel
588     createCustomColorsPane() {
589     btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor());
590     btnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderColor());
591    
592     checkBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderColor());
593    
594     checkBorderColor.addItemListener(new ItemListener() {
595     public void
596     itemStateChanged(ItemEvent e) {
597     boolean b = e.getStateChange() == e.SELECTED;
598     btnBorderColor.setEnabled(b);
599     }
600     });
601    
602 iliev 1143 btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor());
603     btnHlChnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderHlColor());
604 iliev 842
605 iliev 1143 checkHlChnBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderHlColor());
606    
607     checkHlChnBorderColor.addItemListener(new ItemListener() {
608     public void
609     itemStateChanged(ItemEvent e) {
610     boolean b = e.getStateChange() == e.SELECTED;
611     btnHlChnBorderColor.setEnabled(b);
612     }
613     });
614    
615     Color color = ClassicPrefs.getSelectedChannelBgColor();
616     if(color == null) color = new Color(getBackground().getRGB());
617     btnSelChnBgColor.setColor(color);
618     btnSelChnBgColor.setEnabled(ClassicPrefs.getCustomSelectedChannelBgColor());
619    
620     checkSelChnBgColor.setSelected(ClassicPrefs.getCustomSelectedChannelBgColor());
621    
622     checkSelChnBgColor.addItemListener(new ItemListener() {
623     public void
624     itemStateChanged(ItemEvent e) {
625     boolean b = e.getStateChange() == e.SELECTED;
626     btnSelChnBgColor.setEnabled(b);
627     }
628     });
629    
630     color = ClassicPrefs.getHighlightedChannelBgColor();
631     if(color == null) color = new Color(getBackground().getRGB());
632     btnHlChnBgColor.setColor(color);
633     btnHlChnBgColor.setEnabled(ClassicPrefs.getCustomHighlightedChannelBgColor());
634    
635     checkHlChnBgColor.setSelected(ClassicPrefs.getCustomHighlightedChannelBgColor());
636    
637     checkHlChnBgColor.addItemListener(new ItemListener() {
638     public void
639     itemStateChanged(ItemEvent e) {
640     boolean b = e.getStateChange() == e.SELECTED;
641     btnHlChnBgColor.setEnabled(b);
642     }
643     });
644    
645 iliev 842 JButton btnDefaults = new JButton("Reset to defaults");
646     btnDefaults.addActionListener(new ActionListener() {
647     public void
648     actionPerformed(ActionEvent e) {
649     ClassicPrefs.setChannelBorderColor(null);
650     btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor());
651 iliev 1143
652     ClassicPrefs.setChannelBorderHlColor(null);
653     btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor());
654    
655     ClassicPrefs.setSelectedChannelBgColor(null);
656     btnSelChnBgColor.setColor(ClassicPrefs.getSelectedChannelBgColor());
657    
658     ClassicPrefs.setHighlightedChannelBgColor(null);
659     btnHlChnBgColor.setColor(ClassicPrefs.getHighlightedChannelBgColor());
660 iliev 842 }
661     });
662    
663 iliev 1143 GridBagLayout gridbag = new GridBagLayout();
664     GridBagConstraints c = new GridBagConstraints();
665    
666     JPanel ccp = new JPanel();
667     ccp.setLayout(gridbag);
668    
669     c.fill = GridBagConstraints.NONE;
670    
671     c.gridx = 0;
672     c.gridy = 0;
673     c.anchor = GridBagConstraints.WEST;
674     c.insets = new Insets(0, 3, 3, 3);
675     gridbag.setConstraints(checkBorderColor, c);
676     ccp.add(checkBorderColor);
677    
678    
679     c.gridx = 1;
680     c.gridy = 0;
681     gridbag.setConstraints(btnBorderColor, c);
682     ccp.add(btnBorderColor);
683    
684     c.gridx = 0;
685     c.gridy = 1;
686     gridbag.setConstraints(checkHlChnBorderColor, c);
687     ccp.add(checkHlChnBorderColor);
688    
689     c.gridx = 1;
690     c.gridy = 1;
691     gridbag.setConstraints(btnHlChnBorderColor, c);
692     ccp.add(btnHlChnBorderColor);
693    
694     c.gridx = 0;
695     c.gridy = 2;
696     gridbag.setConstraints(checkSelChnBgColor, c);
697     ccp.add(checkSelChnBgColor);
698    
699     c.gridx = 1;
700     c.gridy = 2;
701     gridbag.setConstraints(btnSelChnBgColor, c);
702     ccp.add(btnSelChnBgColor);
703    
704     c.gridx = 0;
705     c.gridy = 3;
706     gridbag.setConstraints(checkHlChnBgColor, c);
707     ccp.add(checkHlChnBgColor);
708    
709     c.gridx = 1;
710     c.gridy = 3;
711     gridbag.setConstraints(btnHlChnBgColor, c);
712     ccp.add(btnHlChnBgColor);
713    
714     JPanel p = new JPanel();
715 iliev 842 p.setAlignmentX(LEFT_ALIGNMENT);
716     p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
717     p.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 6));
718     p.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
719    
720     p.add(Box.createGlue());
721     p.add(btnDefaults);
722     p.add(Box.createGlue());
723    
724 iliev 1143 c.fill = GridBagConstraints.HORIZONTAL;
725     c.gridx = 0;
726     c.gridy = 4;
727     c.gridwidth = 2;
728     c.weightx = 1.0;
729     c.anchor = GridBagConstraints.CENTER;
730     gridbag.setConstraints(p, c);
731 iliev 842 ccp.add(p);
732 iliev 1143
733 iliev 842 ccp.setBorder (
734     BorderFactory.createTitledBorder(i18n.getLabel("ViewPane.CustomColorsPane"))
735     );
736    
737 iliev 911 ccp.setMaximumSize(new Dimension(Short.MAX_VALUE, ccp.getPreferredSize().height));
738 iliev 842
739     return ccp;
740     }
741    
742     private String
743 iliev 787 getInterfaceLanguage() {
744     LocaleBox box = (LocaleBox)cbIfaceLanguage.getSelectedItem();
745     if(box == null) return null;
746     return box.getLocale().getLanguage();
747     }
748    
749 iliev 842 private String
750 iliev 787 getInterfaceCountry() {
751     LocaleBox box = (LocaleBox)cbIfaceLanguage.getSelectedItem();
752     if(box == null) return null;
753     return box.getLocale().getCountry();
754     }
755    
756 iliev 842 private String
757 iliev 787 getInterfaceFontName() { return cbIfaceFont.getSelectedItem().toString(); }
758    
759 iliev 842 protected void
760     apply() {
761     boolean b = Prefs.setInterfaceLanguage(getInterfaceLanguage());
762     boolean b2 = Prefs.setInterfaceCountry(getInterfaceCountry());
763     if (b || b2) JOptionPane.showMessageDialog (
764     this,
765     i18n.getMessage("PrefsDlg.ifaceChangeInfo", "JS Classic"),
766     null,
767     JOptionPane.INFORMATION_MESSAGE
768     );
769    
770     b = false;
771     String fontName = getInterfaceFontName();
772     if(fontName.equals("[Default]")) {
773     b = Prefs.setInterfaceFont(null);
774     } else if(Prefs.setInterfaceFont(fontName)) {
775     HF.setUIDefaultFont(fontName);
776     b = true;
777     }
778    
779     if(b) JOptionPane.showMessageDialog (
780     this,
781     i18n.getMessage("PrefsDlg.ifaceFontChangeInfo", "JS Classic"),
782     null,
783     JOptionPane.INFORMATION_MESSAGE
784     );
785    
786     ///***///
787    
788     b = checkBorderColor.isSelected();
789     ClassicPrefs.setCustomChannelBorderColor(b);
790     if(b) ClassicPrefs.setChannelBorderColor(btnBorderColor.getColor());
791    
792     Color c;
793     if(b) c = ClassicPrefs.getChannelBorderColor();
794     else c = ClassicPrefs.getDefaultChannelBorderColor();
795     Channel.setBorderColor(c);
796 iliev 1143
797     b = checkHlChnBorderColor.isSelected();
798     ClassicPrefs.setCustomChannelBorderHlColor(b);
799     if(b) ClassicPrefs.setChannelBorderHlColor(btnHlChnBorderColor.getColor());
800    
801     if(b) c = ClassicPrefs.getChannelBorderHlColor();
802     else c = ClassicPrefs.getDefaultChannelBorderHlColor();
803     Channel.setBorderHighlightedColor(c);
804    
805     b = checkSelChnBgColor.isSelected();
806     ClassicPrefs.setCustomSelectedChannelBgColor(b);
807     if(b) ClassicPrefs.setSelectedChannelBgColor(btnSelChnBgColor.getColor());
808    
809     if(b) c = ClassicPrefs.getSelectedChannelBgColor();
810     else c = new Color(getBackground().getRGB());
811     if(c == null) c = new Color(getBackground().getRGB());
812     Channel.setSelectedChannelBgColor(c);
813    
814     b = checkHlChnBgColor.isSelected();
815     ClassicPrefs.setCustomHighlightedChannelBgColor(b);
816     if(b) ClassicPrefs.setHighlightedChannelBgColor(btnHlChnBgColor.getColor());
817    
818     if(b) c = ClassicPrefs.getHighlightedChannelBgColor();
819     else c = new Color(getBackground().getRGB());
820     if(c == null) c = new Color(getBackground().getRGB());
821     Channel.setHighlightedChannelBgColor(c);
822 iliev 842 }
823    
824 iliev 787 class LocaleBox {
825     private Locale locale;
826    
827     LocaleBox(Locale locale) { this.locale = locale; }
828    
829     public Locale
830     getLocale() { return locale; }
831    
832     public String
833     toString() { return locale.getDisplayLanguage(JSI18n.i18n.getCurrentLocale()); }
834     }
835 iliev 911 }
836    
837     class ConsolePane extends JPanel {
838 iliev 1143 private final JCheckBox checkSaveCmdHist =
839     new JCheckBox(i18n.getLabel("ConsolePane.checkSaveCmdHist"));
840    
841 iliev 911 private final JLabel lCmdHistorySize =
842     new JLabel(i18n.getLabel("ConsolePane.lCmdHistorySize"));
843 iliev 1143 private JSpinner spCmdHistorySize;
844 iliev 911 private final JLabel lLines = new JLabel(i18n.getLabel("ConsolePane.lLines"));
845     private final JButton btnClearCmdHistory =
846     new JButton(i18n.getButtonLabel("ConsolePane.btnClearCmdHistory"));
847 iliev 842
848 iliev 911 private final JLabel lTextColor = new JLabel(i18n.getLabel("ConsolePane.lTextColor"));
849     private final PrefsDlg.ColorButton btnTextColor = new PrefsDlg.ColorButton();
850    
851     private final JLabel lBGColor = new JLabel(i18n.getLabel("ConsolePane.lBGColor"));
852     private final PrefsDlg.ColorButton btnBGColor = new PrefsDlg.ColorButton();
853    
854     private final JLabel lNotifyColor = new JLabel(i18n.getLabel("ConsolePane.lNotifyColor"));
855     private final PrefsDlg.ColorButton btnNotifyColor = new PrefsDlg.ColorButton();
856    
857     private final JLabel lWarningColor = new JLabel(i18n.getLabel("ConsolePane.lWarningColor"));
858     private final PrefsDlg.ColorButton btnWarningColor = new PrefsDlg.ColorButton();
859    
860     private final JLabel lErrorColor = new JLabel(i18n.getLabel("ConsolePane.lErrorColor"));
861     private final PrefsDlg.ColorButton btnErrorColor = new PrefsDlg.ColorButton();
862    
863    
864     public
865     ConsolePane() {
866     setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
867 iliev 842
868 iliev 1143 add(checkSaveCmdHist);
869    
870     add(createCommandHistoryPane());
871     add(Box.createRigidArea(new Dimension(0, 6)));
872     add(createConsoleColorsPane());
873    
874     setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
875     }
876    
877     private JPanel
878     createCommandHistoryPane() {
879     JPanel chp = new JPanel();
880     chp.setAlignmentX(CENTER_ALIGNMENT);
881    
882     GridBagLayout gridbag = new GridBagLayout();
883     GridBagConstraints c = new GridBagConstraints();
884    
885     chp.setLayout(gridbag);
886    
887 iliev 911 int i = ClassicPrefs.getLSConsoleHistSize();
888     spCmdHistorySize = new JSpinner(new SpinnerNumberModel(i, 0, 20000, 1));
889     spCmdHistorySize.setMaximumSize(spCmdHistorySize.getPreferredSize());
890    
891     btnClearCmdHistory.addActionListener(new ActionListener() {
892     public void
893     actionPerformed(ActionEvent e) {
894 iliev 1143 LSConsolePane.clearConsoleHistory();
895 iliev 911 MainFrame mainFrame = (MainFrame)CC.getMainFrame();
896     mainFrame.getLSConsoleModel().clearCommandHistory();
897     }
898     });
899 iliev 842
900 iliev 911 btnClearCmdHistory.setAlignmentX(JPanel.CENTER_ALIGNMENT);
901     add(btnClearCmdHistory);
902 iliev 842
903 iliev 1143 c.fill = GridBagConstraints.NONE;
904 iliev 911
905 iliev 1143 c.gridx = 0;
906     c.gridy = 0;
907     c.anchor = GridBagConstraints.EAST;
908     c.insets = new Insets(0, 6, 3, 0);
909     gridbag.setConstraints(lCmdHistorySize, c);
910     chp.add(lCmdHistorySize);
911    
912     c.gridx = 1;
913     c.gridy = 0;
914     gridbag.setConstraints(spCmdHistorySize, c);
915     chp.add(spCmdHistorySize);
916    
917     c.gridx = 2;
918     c.gridy = 0;
919     gridbag.setConstraints(lLines, c);
920     chp.add(lLines);
921    
922     c.gridx = 3;
923     c.gridy = 0;
924     c.insets = new Insets(0, 12, 3, 6);
925     gridbag.setConstraints(btnClearCmdHistory, c);
926     chp.add(btnClearCmdHistory);
927    
928     checkSaveCmdHist.setSelected(ClassicPrefs.getSaveConsoleHistory());
929     checkSaveCmdHist.setAlignmentX(JPanel.CENTER_ALIGNMENT);
930 iliev 911
931 iliev 1143 c.gridx = 0;
932     c.gridy = 1;
933     c.gridwidth = 4;
934     c.insets = new Insets(3, 6, 3, 6);
935     c.anchor = GridBagConstraints.CENTER;
936     gridbag.setConstraints(checkSaveCmdHist, c);
937     chp.add(checkSaveCmdHist);
938    
939     String s = i18n.getLabel("ConsolePane.commandHistory");
940     chp.setBorder(BorderFactory.createTitledBorder(s));
941    
942     chp.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
943    
944     return chp;
945 iliev 911 }
946 iliev 842
947 iliev 911 private JPanel
948     createConsoleColorsPane() {
949     JPanel ccp = new JPanel();
950     ccp.setAlignmentX(CENTER_ALIGNMENT);
951 iliev 842
952 iliev 911 GridBagLayout gridbag = new GridBagLayout();
953     GridBagConstraints c = new GridBagConstraints();
954 iliev 842
955 iliev 911 ccp.setLayout(gridbag);
956 iliev 842
957 iliev 911 c.fill = GridBagConstraints.NONE;
958    
959     c.gridx = 0;
960     c.gridy = 0;
961     c.anchor = GridBagConstraints.EAST;
962     c.insets = new Insets(3, 3, 3, 3);
963     gridbag.setConstraints(lTextColor, c);
964     ccp.add(lTextColor);
965    
966     c.gridx = 0;
967     c.gridy = 1;
968     gridbag.setConstraints(lBGColor, c);
969     ccp.add(lBGColor);
970    
971     c.gridx = 0;
972     c.gridy = 2;
973     gridbag.setConstraints(lNotifyColor, c);
974     ccp.add(lNotifyColor);
975    
976     c.gridx = 0;
977     c.gridy = 3;
978     gridbag.setConstraints(lWarningColor, c);
979     ccp.add(lWarningColor);
980    
981     c.gridx = 0;
982     c.gridy = 4;
983     gridbag.setConstraints(lErrorColor, c);
984     ccp.add(lErrorColor);
985    
986     c.fill = GridBagConstraints.HORIZONTAL;
987     c.gridx = 1;
988     c.gridy = 0;
989     //c.weightx = 1.0;
990     c.anchor = GridBagConstraints.WEST;
991     gridbag.setConstraints(btnTextColor, c);
992     ccp.add(btnTextColor);
993    
994     c.gridx = 1;
995     c.gridy = 1;
996     gridbag.setConstraints(btnBGColor, c);
997     ccp.add(btnBGColor);
998    
999     c.gridx = 1;
1000     c.gridy = 2;
1001     gridbag.setConstraints(btnNotifyColor, c);
1002     ccp.add(btnNotifyColor);
1003    
1004     c.gridx = 1;
1005     c.gridy = 3;
1006     gridbag.setConstraints(btnWarningColor, c);
1007     ccp.add(btnWarningColor);
1008    
1009     c.gridx = 1;
1010     c.gridy = 4;
1011     gridbag.setConstraints(btnErrorColor, c);
1012     ccp.add(btnErrorColor);
1013    
1014     btnTextColor.setColor(ClassicPrefs.getLSConsoleTextColor());
1015     btnBGColor.setColor(ClassicPrefs.getLSConsoleBackgroundColor());
1016     btnNotifyColor.setColor(ClassicPrefs.getLSConsoleNotifyColor());
1017     btnWarningColor.setColor(ClassicPrefs.getLSConsoleWarningColor());
1018     btnErrorColor.setColor(ClassicPrefs.getLSConsoleErrorColor());
1019    
1020     JButton btnDefaults = new JButton("Reset to defaults");
1021    
1022     btnDefaults.addActionListener(new ActionListener() {
1023     public void
1024     actionPerformed(ActionEvent e) {
1025     ClassicPrefs.setLSConsoleTextColor(null);
1026     btnTextColor.setColor(ClassicPrefs.getLSConsoleTextColor());
1027    
1028     ClassicPrefs.setLSConsoleBackgroundColor(null);
1029     btnBGColor.setColor(ClassicPrefs.getLSConsoleBackgroundColor());
1030    
1031     ClassicPrefs.setLSConsoleNotifyColor(null);
1032     btnNotifyColor.setColor(ClassicPrefs.getLSConsoleNotifyColor());
1033    
1034     ClassicPrefs.setLSConsoleWarningColor(null);
1035     btnWarningColor.setColor(ClassicPrefs.getLSConsoleWarningColor());
1036    
1037     ClassicPrefs.setLSConsoleErrorColor(null);
1038     btnErrorColor.setColor(ClassicPrefs.getLSConsoleErrorColor());
1039 iliev 842 }
1040 iliev 911 });
1041 iliev 842
1042 iliev 911 JPanel p = new JPanel();
1043     p.setAlignmentX(LEFT_ALIGNMENT);
1044     p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
1045     p.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 6));
1046     p.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
1047 iliev 842
1048 iliev 911 p.add(Box.createGlue());
1049     p.add(btnDefaults);
1050     p.add(Box.createGlue());
1051    
1052     c.gridx = 0;
1053     c.gridy = 5;
1054     c.gridwidth = 2;
1055     gridbag.setConstraints(p, c);
1056     ccp.add(p);
1057    
1058 iliev 1143 String s = i18n.getLabel("ConsolePane.consoleColors");
1059     ccp.setBorder(BorderFactory.createTitledBorder(s));
1060 iliev 911
1061     ccp.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
1062    
1063     return ccp;
1064 iliev 842 }
1065    
1066 iliev 911 protected void
1067     apply() {
1068 iliev 1143 ClassicPrefs.setSaveConsoleHistory(checkSaveCmdHist.isSelected());
1069    
1070 iliev 911 int size = Integer.parseInt(spCmdHistorySize.getValue().toString());
1071     ClassicPrefs.setLSConsoleHistSize(size);
1072     LSConsoleModel model = ((MainFrame)CC.getMainFrame()).getLSConsoleModel();
1073     model.setCommandHistorySize(size);
1074 iliev 842
1075 iliev 911 ///***///
1076 iliev 842
1077 iliev 911 MainFrame mainFrame = (MainFrame)CC.getMainFrame();
1078 iliev 842
1079 iliev 911 ClassicPrefs.setLSConsoleTextColor(btnTextColor.getColor());
1080     mainFrame.setLSConsoleTextColor(btnTextColor.getColor());
1081 iliev 842
1082 iliev 911 ClassicPrefs.setLSConsoleBackgroundColor(btnBGColor.getColor());
1083     mainFrame.setLSConsoleBackgroundColor(btnBGColor.getColor());
1084 iliev 842
1085 iliev 911 ClassicPrefs.setLSConsoleNotifyColor(btnNotifyColor.getColor());
1086     mainFrame.setLSConsoleNotifyColor(btnNotifyColor.getColor());
1087    
1088     ClassicPrefs.setLSConsoleWarningColor(btnWarningColor.getColor());
1089     mainFrame.setLSConsoleWarningColor(btnWarningColor.getColor());
1090    
1091     ClassicPrefs.setLSConsoleErrorColor(btnErrorColor.getColor());
1092     mainFrame.setLSConsoleErrorColor(btnErrorColor.getColor());
1093 iliev 842 }
1094 iliev 911
1095    
1096 iliev 787 }
1097    
1098     class ConnectionPane extends JPanel {
1099     final LSPrefsPane lsPrefsPane = new LSPrefsPane();
1100    
1101     public
1102     ConnectionPane() { initConnectionPane(); }
1103    
1104     private void
1105     initConnectionPane() {
1106     setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
1107    
1108     add(lsPrefsPane);
1109     add(Box.createGlue());
1110     setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
1111     }
1112    
1113     public String
1114     getLSAddress() { return lsPrefsPane.getLSAddress(); }
1115    
1116     public void
1117     setLSAddress(String address) { lsPrefsPane.setLSAddress(address); }
1118    
1119     public String
1120     getLSPort() { return lsPrefsPane.getLSPort(); }
1121    
1122     public void
1123     setLSPort(String port) { lsPrefsPane.setLSPort(port); }
1124     }
1125    
1126     class LSPrefsPane extends JPanel {
1127     private final JLabel lAddress = new JLabel(i18n.getLabel("LSPrefsPane.Address"));
1128     private final JLabel lPort = new JLabel(i18n.getLabel("LSPrefsPane.Port"));
1129     private final JTextField tfAddress = new JTextField();
1130     private final JTextField tfPort = new JTextField();
1131    
1132    
1133     public
1134     LSPrefsPane() { initLSPrefsPane(); }
1135    
1136     private void
1137     initLSPrefsPane() {
1138     GridBagLayout gridbag = new GridBagLayout();
1139     GridBagConstraints c = new GridBagConstraints();
1140    
1141     setLayout(gridbag);
1142    
1143     // Set preferred size for username & password fields
1144     int w1 = (int) tfAddress.getMinimumSize().getWidth();
1145     int h1 = (int) tfAddress.getMinimumSize().getHeight();
1146     Dimension d = new Dimension(w1 > 150 ? w1 : 150, h1);
1147     tfAddress.setMinimumSize(d);
1148     tfAddress.setPreferredSize(d);
1149    
1150     w1 = (int) tfPort.getMinimumSize().getWidth();
1151     h1 = (int) tfPort.getMinimumSize().getHeight();
1152     d = new Dimension(w1 > 150 ? w1 : 150, h1);
1153     tfPort.setMinimumSize(d);
1154     tfPort.setPreferredSize(d);
1155    
1156     c.fill = GridBagConstraints.NONE;
1157    
1158     c.gridx = 0;
1159     c.gridy = 0;
1160     c.anchor = GridBagConstraints.EAST;
1161     c.insets = new Insets(3, 3, 3, 3);
1162     gridbag.setConstraints(lAddress, c);
1163     add(lAddress);
1164    
1165     c.gridx = 0;
1166     c.gridy = 1;
1167     gridbag.setConstraints(lPort, c);
1168     add(lPort);
1169    
1170     c.fill = GridBagConstraints.HORIZONTAL;
1171     c.gridx = 1;
1172     c.gridy = 0;
1173     c.weightx = 1.0;
1174     c.anchor = GridBagConstraints.WEST;
1175     gridbag.setConstraints(tfAddress, c);
1176     add(tfAddress);
1177    
1178     c.gridx = 1;
1179     c.gridy = 1;
1180     gridbag.setConstraints(tfPort, c);
1181     add(tfPort);
1182    
1183     setBorder(BorderFactory.createTitledBorder(i18n.getLabel("LSPrefsPane")));
1184 iliev 842 setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height));
1185 iliev 787 }
1186    
1187     public String
1188     getLSAddress() { return tfAddress.getText(); }
1189    
1190     public void
1191     setLSAddress(String address) { tfAddress.setText(address); }
1192    
1193     public String
1194     getLSPort() { return tfPort.getText(); }
1195    
1196     public void
1197     setLSPort(String port) { tfPort.setText(port); }
1198     }

  ViewVC Help
Powered by ViewVC