1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005 Grigor Kirilov Iliev |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
25 |
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
26 |
import java.awt.Color; |
import java.awt.Color; |
27 |
import java.awt.Container; |
import java.awt.Container; |
|
import java.awt.Cursor; |
|
28 |
import java.awt.Dialog; |
import java.awt.Dialog; |
29 |
import java.awt.Dimension; |
import java.awt.Dimension; |
30 |
import java.awt.GraphicsEnvironment; |
import java.awt.GraphicsEnvironment; |
38 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
39 |
import java.awt.event.ItemEvent; |
import java.awt.event.ItemEvent; |
40 |
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
|
import java.awt.event.MouseAdapter; |
|
|
import java.awt.event.MouseEvent; |
|
41 |
|
|
42 |
import java.util.Locale; |
import java.util.Locale; |
|
import java.util.Vector; |
|
43 |
|
|
44 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
45 |
import javax.swing.Box; |
import javax.swing.Box; |
47 |
import javax.swing.DefaultButtonModel; |
import javax.swing.DefaultButtonModel; |
48 |
import javax.swing.JButton; |
import javax.swing.JButton; |
49 |
import javax.swing.JCheckBox; |
import javax.swing.JCheckBox; |
|
import javax.swing.JColorChooser; |
|
50 |
import javax.swing.JComboBox; |
import javax.swing.JComboBox; |
51 |
import javax.swing.JLabel; |
import javax.swing.JLabel; |
52 |
import javax.swing.JOptionPane; |
import javax.swing.JOptionPane; |
53 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
|
import javax.swing.JPasswordField; |
|
|
import javax.swing.JSpinner; |
|
54 |
import javax.swing.JTabbedPane; |
import javax.swing.JTabbedPane; |
55 |
import javax.swing.JTextField; |
import javax.swing.JTextField; |
|
import javax.swing.SpinnerNumberModel; |
|
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
import javax.swing.event.ChangeListener; |
|
56 |
|
|
57 |
import net.sf.juife.EnhancedDialog; |
import net.sf.juife.EnhancedDialog; |
58 |
import net.sf.juife.JuifeUtils; |
import net.sf.juife.JuifeUtils; |
59 |
import net.sf.juife.LinkButton; |
import net.sf.juife.LinkButton; |
|
import net.sf.juife.OkCancelDialog; |
|
60 |
|
|
61 |
import org.jsampler.CC; |
import org.jsampler.CC; |
62 |
import org.jsampler.HF; |
import org.jsampler.HF; |
65 |
import org.jsampler.LSConsoleModel; |
import org.jsampler.LSConsoleModel; |
66 |
import org.jsampler.Prefs; |
import org.jsampler.Prefs; |
67 |
|
|
68 |
import org.jsampler.task.SetServerAddress; |
import org.jsampler.view.std.JSAdvancedGeneralPropsDlg; |
69 |
|
import org.jsampler.view.std.JSColorButton; |
70 |
|
import org.jsampler.view.std.JSConnectionPropsPane; |
71 |
|
import org.jsampler.view.std.JSDefaultsPropsPane; |
72 |
|
import org.jsampler.view.std.JSGeneralProps; |
73 |
|
import org.jsampler.view.std.JSLSConsolePropsPane; |
74 |
|
|
75 |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
76 |
|
import static org.jsampler.view.classic.ClassicPrefs.preferences; |
77 |
|
import static org.jsampler.view.std.StdPrefs.*; |
78 |
|
|
79 |
|
|
80 |
/** |
/** |
82 |
* @author Grigor Iliev |
* @author Grigor Iliev |
83 |
*/ |
*/ |
84 |
public class PrefsDlg extends EnhancedDialog { |
public class PrefsDlg extends EnhancedDialog { |
85 |
private final GeneralPane genPane = new GeneralPane(); |
private final JTabbedPane tabbedPane = new JTabbedPane(); |
86 |
|
|
87 |
|
private final GeneralPane genPane = new GeneralPane(this); |
88 |
private final ViewPane viewPane = new ViewPane(); |
private final ViewPane viewPane = new ViewPane(); |
89 |
private final ConsolePane consolePane = new ConsolePane(); |
private final ConsolePane consolePane = new ConsolePane(); |
90 |
private final ConnectionPane conPane = new ConnectionPane(); |
private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane(); |
91 |
|
private final JSDefaultsPropsPane defaultsPane; |
92 |
|
|
93 |
private final JButton btnApply = new JButton(i18n.getButtonLabel("apply")); |
private final JButton btnApply = new JButton(i18n.getButtonLabel("apply")); |
94 |
private final JButton btnClose = new JButton(i18n.getButtonLabel("close")); |
private final JButton btnClose = new JButton(i18n.getButtonLabel("close")); |
98 |
PrefsDlg(Frame frm) { |
PrefsDlg(Frame frm) { |
99 |
super(frm, i18n.getLabel("PrefsDlg"), true); |
super(frm, i18n.getLabel("PrefsDlg"), true); |
100 |
|
|
101 |
|
defaultsPane = new JSDefaultsPropsPane(this, Res.iconEdit16); |
102 |
|
|
103 |
initPrefsDlg(); |
initPrefsDlg(); |
104 |
handleEvents(); |
installListeners(); |
|
initPrefs(); |
|
105 |
|
|
106 |
setLocation(JuifeUtils.centerLocation(this, frm)); |
setLocation(JuifeUtils.centerLocation(this, frm)); |
107 |
|
|
108 |
|
int i = preferences().getIntProperty("PrefsDlg.tabIndex"); |
109 |
|
|
110 |
|
if(i >= 0 && i < tabbedPane.getTabCount()) tabbedPane.setSelectedIndex(i); |
111 |
} |
} |
112 |
|
|
113 |
private void |
private void |
114 |
initPrefsDlg() { |
initPrefsDlg() { |
115 |
JTabbedPane tp = new JTabbedPane(); |
JTabbedPane tp = tabbedPane; |
116 |
|
tp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); |
117 |
|
|
118 |
tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane); |
tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane); |
119 |
tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane); |
tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane); |
120 |
tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane); |
tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane); |
121 |
tp.addTab(i18n.getLabel("PrefsDlg.tabConnection"), conPane); |
|
122 |
|
JPanel p = new JPanel(); |
123 |
|
p.setLayout(new BorderLayout()); |
124 |
|
p.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
125 |
|
p.add(connectionPane); |
126 |
|
tp.addTab(i18n.getLabel("PrefsDlg.tabBackend"), p); |
127 |
|
tp.addTab(i18n.getLabel("PrefsDlg.tabDefaults"), defaultsPane); |
128 |
|
|
129 |
tp.setAlignmentX(RIGHT_ALIGNMENT); |
tp.setAlignmentX(RIGHT_ALIGNMENT); |
130 |
|
|
131 |
// Set preferred size for Apply & Exit buttons |
// Set preferred size for Apply & Exit buttons |
154 |
} |
} |
155 |
|
|
156 |
private void |
private void |
157 |
handleEvents() { |
installListeners() { |
158 |
btnApply.addActionListener(new ActionListener() { |
btnApply.addActionListener(new ActionListener() { |
159 |
public void |
public void |
160 |
actionPerformed(ActionEvent e) { onApply(); } |
actionPerformed(ActionEvent e) { onApply(); } |
171 |
|
|
172 |
protected void |
protected void |
173 |
onCancel() { onExit(); } |
onCancel() { onExit(); } |
|
|
|
|
private void |
|
|
initPrefs() { |
|
|
setLSAddress(Prefs.getLSAddress()); |
|
|
setLSPort(Prefs.getLSPort()); |
|
|
} |
|
174 |
|
|
175 |
private void |
private void |
176 |
onApply() { |
onApply() { |
177 |
genPane.apply(); |
genPane.apply(); |
178 |
viewPane.apply(); |
viewPane.apply(); |
179 |
consolePane.apply(); |
consolePane.apply(); |
180 |
|
connectionPane.apply(); |
181 |
|
defaultsPane.apply(); |
182 |
|
|
183 |
// CONNECTION |
preferences().setIntProperty("PrefsDlg.tabIndex", tabbedPane.getSelectedIndex()); |
|
Prefs.setLSAddress(getLSAddress()); |
|
|
|
|
|
boolean b = true; |
|
|
String s = getLSPort(); |
|
|
try { |
|
|
if(s.length() > 0) { |
|
|
int port = Integer.parseInt(s); |
|
|
if(port > 0 && port < 0xffff) |
|
|
Prefs.setLSPort(port); |
|
|
else b = false; |
|
|
} else Prefs.setLSPort(-1); // -1 resets to default value |
|
|
} catch(NumberFormatException x) { |
|
|
b = false; |
|
|
} |
|
|
|
|
|
if(!b) { |
|
|
JOptionPane.showMessageDialog ( |
|
|
this, |
|
|
i18n.getError("PrefsDlg.invalidPort", s), |
|
|
i18n.getError("error"), |
|
|
JOptionPane.ERROR_MESSAGE |
|
|
); |
|
|
|
|
|
return; |
|
|
} |
|
|
|
|
|
CC.getTaskQueue().add ( |
|
|
new SetServerAddress(Prefs.getLSAddress(), Prefs.getLSPort()) |
|
|
); |
|
184 |
|
|
185 |
setVisible(false); |
setVisible(false); |
186 |
} |
} |
187 |
|
|
188 |
private void |
private void |
189 |
onExit() { setVisible(false); } |
onExit() { setVisible(false); } |
|
|
|
|
private String |
|
|
getLSAddress() { return conPane.getLSAddress().trim(); } |
|
|
|
|
|
private void |
|
|
setLSAddress(String s) { conPane.setLSAddress(s); } |
|
|
|
|
|
private String |
|
|
getLSPort() { return conPane.getLSPort().trim(); } |
|
|
|
|
|
private void |
|
|
setLSPort(int port) { conPane.setLSPort(String.valueOf(port)); } |
|
|
|
|
|
protected static class ColorButton extends JPanel { |
|
|
private Color color; |
|
|
private final Vector<ActionListener> listeners = new Vector<ActionListener>(); |
|
|
|
|
|
ColorButton() { this(Color.WHITE); } |
|
|
|
|
|
ColorButton(Color c) { |
|
|
color = c; |
|
|
|
|
|
//setBorderPainted(false); |
|
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|
|
setPreferredSize(new Dimension(42, 16)); |
|
|
setMaximumSize(new Dimension(42, 16)); |
|
|
setBorder(BorderFactory.createLineBorder(Color.BLACK)); |
|
|
|
|
|
addMouseListener(new MouseAdapter() { |
|
|
public void |
|
|
mouseClicked(MouseEvent e) { |
|
|
if(!isEnabled()) return; |
|
|
if(e.getButton() == e.BUTTON1) showColorChooser(); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Registers the specified listener to be |
|
|
* notified when the current color is changed. |
|
|
* @param l The <code>ActionListener</code> to register. |
|
|
*/ |
|
|
public void |
|
|
addActionListener(ActionListener l) { listeners.add(l); } |
|
|
|
|
|
/** |
|
|
* Removes the specified listener. |
|
|
* @param l The <code>ActionListener</code> to remove. |
|
|
*/ |
|
|
public void |
|
|
removeActionListener(ActionListener l) { listeners.remove(l); } |
|
|
|
|
|
/** Notifies listeners that the current color is changed. */ |
|
|
private void |
|
|
fireActionPerformed() { |
|
|
ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, null); |
|
|
for(ActionListener l : listeners) l.actionPerformed(e); |
|
|
} |
|
|
|
|
|
public void |
|
|
setEnabled(boolean b) { |
|
|
setOpaque(b); |
|
|
if(b) setBorder(BorderFactory.createLineBorder(Color.BLACK)); |
|
|
else setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); |
|
|
//setBorderPainted(!b); |
|
|
super.setEnabled(b); |
|
|
} |
|
|
|
|
|
private void |
|
|
showColorChooser() { |
|
|
ColorDlg dlg = new ColorDlg ( |
|
|
(Dialog)JuifeUtils.getWindow(this), getColor() |
|
|
); |
|
|
|
|
|
dlg.setVisible(true); |
|
|
if(!dlg.isCancelled()) { |
|
|
setColor(dlg.getColor()); |
|
|
fireActionPerformed(); |
|
|
} |
|
|
} |
|
|
|
|
|
public Color |
|
|
getColor() { return color; } |
|
|
|
|
|
public void |
|
|
setColor(Color c) { |
|
|
color = c; |
|
|
setBackground(color); |
|
|
} |
|
|
} |
|
|
|
|
|
protected static class ColorDlg extends OkCancelDialog { |
|
|
private final JColorChooser colorChooser = new JColorChooser(); |
|
|
|
|
|
ColorDlg(Dialog owner) { this(owner, Color.WHITE); } |
|
|
|
|
|
ColorDlg(Dialog owner, Color c) { |
|
|
super(owner); |
|
|
|
|
|
colorChooser.setPreviewPanel(new JPanel()); |
|
|
colorChooser.setColor(c); |
|
|
|
|
|
JPanel mainPane = new JPanel(); |
|
|
mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS)); |
|
|
mainPane.add(colorChooser); |
|
|
|
|
|
mainPane.add(Box.createRigidArea(new Dimension(0, 6))); |
|
|
|
|
|
final JPanel p = new JPanel(); |
|
|
p.setBackground(c); |
|
|
p.setBorder(BorderFactory.createLineBorder(Color.BLACK)); |
|
|
mainPane.add(p); |
|
|
|
|
|
p.setPreferredSize(new Dimension(48, 8)); |
|
|
p.setMaximumSize(new Dimension(Short.MAX_VALUE, 8)); |
|
|
|
|
|
setMainPane(mainPane); |
|
|
|
|
|
colorChooser.getSelectionModel().addChangeListener(new ChangeListener() { |
|
|
public void |
|
|
stateChanged(ChangeEvent e) { p.setBackground(getColor()); } |
|
|
}); |
|
|
} |
|
|
|
|
|
protected void |
|
|
onOk() { setVisible(false); } |
|
|
|
|
|
protected void |
|
|
onCancel() { setVisible(false); } |
|
|
|
|
|
public Color |
|
|
getColor() { return colorChooser.getColor(); } |
|
|
} |
|
190 |
} |
} |
191 |
|
|
192 |
class GeneralPane extends JPanel { |
class GeneralPane extends JPanel { |
199 |
private final JCheckBox checkShowLSConsoleWhenRunScript = |
private final JCheckBox checkShowLSConsoleWhenRunScript = |
200 |
new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript")); |
new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript")); |
201 |
|
|
202 |
private final JLabel lRecentScriptsSize = |
private final JCheckBox checkShowVolumesInDecibels = |
203 |
new JLabel(i18n.getLabel("GeneralPane.lRecentScriptsSize")); |
new JCheckBox(i18n.getLabel("GeneralPane.checkShowVolumesInDecibels")); |
204 |
private final JSpinner spRecentScriptsSize; |
|
205 |
private final JButton btnClearRecentScriptList = |
private final JSGeneralProps.MaxVolumePane maxVolPane = new JSGeneralProps.MaxVolumePane(); |
|
new JButton(i18n.getButtonLabel("GeneralPane.btnClearRecentScriptList")); |
|
206 |
|
|
207 |
|
private final JSGeneralProps.JSamplerHomePane jSamplerHomePane = |
208 |
|
new JSGeneralProps.JSamplerHomePane(); |
209 |
|
|
210 |
|
private final RecentScriptsPane recentScriptsPane = new RecentScriptsPane(); |
211 |
|
|
212 |
|
private final JButton btnAdvanced = new JButton(i18n.getButtonLabel("GeneralPane.btnAdvanced")); |
213 |
|
|
214 |
|
private final Dialog owner; |
215 |
|
|
216 |
public |
public |
217 |
GeneralPane() { |
GeneralPane(Dialog owner) { |
218 |
|
this.owner = owner; |
219 |
|
|
220 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
221 |
|
|
222 |
checkWindowSizeAndLocation.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
checkWindowSizeAndLocation.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
238 |
|
|
239 |
checkShowLSConsoleWhenRunScript.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
checkShowLSConsoleWhenRunScript.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
240 |
|
|
241 |
boolean b = ClassicPrefs.getShowLSConsoleWhenRunScript(); |
boolean b = preferences().getBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT); |
242 |
checkShowLSConsoleWhenRunScript.setSelected(b); |
checkShowLSConsoleWhenRunScript.setSelected(b); |
243 |
|
|
244 |
add(checkShowLSConsoleWhenRunScript); |
add(checkShowLSConsoleWhenRunScript); |
245 |
|
|
246 |
|
b = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL); |
247 |
|
checkShowVolumesInDecibels.setSelected(b); |
248 |
|
|
249 |
|
add(checkShowVolumesInDecibels); |
250 |
|
|
251 |
add(Box.createRigidArea(new Dimension(0, 6))); |
add(Box.createRigidArea(new Dimension(0, 6))); |
252 |
|
|
253 |
JPanel rsp = new JPanel(); |
add(maxVolPane); |
|
rsp.setLayout(new BoxLayout(rsp, BoxLayout.Y_AXIS)); |
|
254 |
|
|
255 |
int i = ClassicPrefs.getRecentScriptsSize(); |
add(Box.createRigidArea(new Dimension(0, 6))); |
|
spRecentScriptsSize = new JSpinner(new SpinnerNumberModel(i, 0, 100, 1)); |
|
|
spRecentScriptsSize.setMaximumSize(spRecentScriptsSize.getPreferredSize()); |
|
256 |
|
|
257 |
JPanel p = new JPanel(); |
add(jSamplerHomePane); |
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
|
|
p.add(lRecentScriptsSize); |
|
|
p.add(Box.createRigidArea(new Dimension(5, 0))); |
|
|
p.add(spRecentScriptsSize); |
|
258 |
|
|
259 |
p.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
add(Box.createRigidArea(new Dimension(0, 6))); |
|
rsp.add(p); |
|
260 |
|
|
261 |
rsp.add(Box.createRigidArea(new Dimension(0, 6))); |
add(recentScriptsPane); |
262 |
|
|
263 |
btnClearRecentScriptList.addActionListener(new ActionListener() { |
add(Box.createRigidArea(new Dimension(0, 6))); |
|
public void |
|
|
actionPerformed(ActionEvent e) { |
|
|
ClassicPrefs.setRecentScripts(null); |
|
|
((MainFrame)CC.getMainFrame()).clearRecentScripts(); |
|
|
} |
|
|
}); |
|
264 |
|
|
265 |
btnClearRecentScriptList.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
JPanel p = new JPanel(); |
266 |
rsp.add(btnClearRecentScriptList); |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
267 |
rsp.add(Box.createRigidArea(new Dimension(0, 6))); |
|
268 |
|
JPanel p2 = new JPanel(); |
269 |
rsp.setMaximumSize(new Dimension(Short.MAX_VALUE, rsp.getPreferredSize().height)); |
p2.setLayout(new BorderLayout()); |
270 |
rsp.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
p.add(p2); |
271 |
rsp.setBorder ( |
p.add(btnAdvanced); |
272 |
BorderFactory.createTitledBorder(i18n.getLabel("GeneralPane.recentScripts")) |
p.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
273 |
); |
add(p); |
274 |
|
|
|
add(rsp); |
|
275 |
add(Box.createGlue()); |
add(Box.createGlue()); |
276 |
|
|
277 |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
278 |
|
|
279 |
|
btnAdvanced.addActionListener(new ActionListener() { |
280 |
|
public void |
281 |
|
actionPerformed(ActionEvent e) { showAdvancedProperties(); } |
282 |
|
}); |
283 |
|
} |
284 |
|
|
285 |
|
private void |
286 |
|
showAdvancedProperties() { |
287 |
|
new JSAdvancedGeneralPropsDlg(owner).setVisible(true); |
288 |
} |
} |
289 |
|
|
290 |
protected void |
protected void |
291 |
apply() { |
apply() { |
292 |
|
maxVolPane.apply(); |
293 |
|
|
294 |
ClassicPrefs.setSaveWindowProperties(checkWindowSizeAndLocation.isSelected()); |
ClassicPrefs.setSaveWindowProperties(checkWindowSizeAndLocation.isSelected()); |
295 |
ClassicPrefs.setSaveLeftPaneState(checkLeftPaneState.isSelected()); |
ClassicPrefs.setSaveLeftPaneState(checkLeftPaneState.isSelected()); |
296 |
|
|
297 |
boolean b = checkShowLSConsoleWhenRunScript.isSelected(); |
boolean b = checkShowLSConsoleWhenRunScript.isSelected(); |
298 |
ClassicPrefs.setShowLSConsoleWhenRunScript(b); |
preferences().setBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b); |
299 |
|
|
300 |
int size = Integer.parseInt(spRecentScriptsSize.getValue().toString()); |
b = checkShowVolumesInDecibels.isSelected(); |
301 |
ClassicPrefs.setRecentScriptstSize(size); |
preferences().setBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL, b); |
302 |
|
|
303 |
|
int size = recentScriptsPane.getRecentScriptsSize(); |
304 |
|
preferences().setIntProperty(RECENT_LSCP_SCRIPTS_SIZE, size); |
305 |
((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu(); |
((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu(); |
306 |
|
|
307 |
|
String s = jSamplerHomePane.getJSamplerHome(); |
308 |
|
if(s.length() > 0 && !s.equals(CC.getJSamplerHome())) { |
309 |
|
CC.changeJSamplerHome(s); |
310 |
|
} |
311 |
|
} |
312 |
|
|
313 |
|
private class RecentScriptsPane extends JSGeneralProps.RecentScriptsPane { |
314 |
|
protected void |
315 |
|
clearRecentScripts() { |
316 |
|
((MainFrame)CC.getMainFrame()).clearRecentScripts(); |
317 |
|
} |
318 |
} |
} |
319 |
} |
} |
320 |
|
|
329 |
|
|
330 |
private final JCheckBox checkBorderColor = |
private final JCheckBox checkBorderColor = |
331 |
new JCheckBox(i18n.getLabel("ViewPane.channelBorderColor")); |
new JCheckBox(i18n.getLabel("ViewPane.channelBorderColor")); |
332 |
private final PrefsDlg.ColorButton btnBorderColor = |
private final JSColorButton btnBorderColor = new JSColorButton(Color.WHITE); |
333 |
new PrefsDlg.ColorButton(Color.WHITE); |
|
334 |
|
private final JCheckBox checkHlChnBorderColor = |
335 |
|
new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBorderColor")); |
336 |
|
private final JSColorButton btnHlChnBorderColor = new JSColorButton(Color.WHITE); |
337 |
|
|
338 |
|
private final JCheckBox checkSelChnBgColor = |
339 |
|
new JCheckBox(i18n.getLabel("ViewPane.checkSelChnBgColor")); |
340 |
|
private final JSColorButton btnSelChnBgColor = new JSColorButton(Color.WHITE); |
341 |
|
|
342 |
|
private final JCheckBox checkHlChnBgColor = |
343 |
|
new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBgColor")); |
344 |
|
private final JSColorButton btnHlChnBgColor = new JSColorButton(Color.WHITE); |
345 |
|
|
346 |
public |
public |
347 |
ViewPane() { initViewPane(); } |
ViewPane() { initViewPane(); } |
401 |
|
|
402 |
private JPanel |
private JPanel |
403 |
createCustomColorsPane() { |
createCustomColorsPane() { |
|
JPanel ccp = new JPanel(); |
|
|
ccp.setAlignmentX(CENTER_ALIGNMENT); |
|
|
ccp.setLayout(new BoxLayout(ccp, BoxLayout.Y_AXIS)); |
|
|
|
|
|
JPanel p = new JPanel(); |
|
|
p.setAlignmentX(LEFT_ALIGNMENT); |
|
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
|
|
p.add(checkBorderColor); |
|
|
|
|
|
p.add(Box.createRigidArea(new Dimension(6, 0))); |
|
|
|
|
404 |
btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor()); |
btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor()); |
405 |
btnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderColor()); |
btnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderColor()); |
|
p.add(btnBorderColor); |
|
406 |
|
|
407 |
checkBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderColor()); |
checkBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderColor()); |
408 |
|
|
414 |
} |
} |
415 |
}); |
}); |
416 |
|
|
417 |
ccp.add(p); |
btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor()); |
418 |
|
btnHlChnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderHlColor()); |
419 |
|
|
420 |
|
checkHlChnBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderHlColor()); |
421 |
|
|
422 |
|
checkHlChnBorderColor.addItemListener(new ItemListener() { |
423 |
|
public void |
424 |
|
itemStateChanged(ItemEvent e) { |
425 |
|
boolean b = e.getStateChange() == e.SELECTED; |
426 |
|
btnHlChnBorderColor.setEnabled(b); |
427 |
|
} |
428 |
|
}); |
429 |
|
|
430 |
|
Color color = ClassicPrefs.getSelectedChannelBgColor(); |
431 |
|
if(color == null) color = new Color(getBackground().getRGB()); |
432 |
|
btnSelChnBgColor.setColor(color); |
433 |
|
btnSelChnBgColor.setEnabled(ClassicPrefs.getCustomSelectedChannelBgColor()); |
434 |
|
|
435 |
|
checkSelChnBgColor.setSelected(ClassicPrefs.getCustomSelectedChannelBgColor()); |
436 |
|
|
437 |
|
checkSelChnBgColor.addItemListener(new ItemListener() { |
438 |
|
public void |
439 |
|
itemStateChanged(ItemEvent e) { |
440 |
|
boolean b = e.getStateChange() == e.SELECTED; |
441 |
|
btnSelChnBgColor.setEnabled(b); |
442 |
|
} |
443 |
|
}); |
444 |
|
|
445 |
|
color = ClassicPrefs.getHighlightedChannelBgColor(); |
446 |
|
if(color == null) color = new Color(getBackground().getRGB()); |
447 |
|
btnHlChnBgColor.setColor(color); |
448 |
|
btnHlChnBgColor.setEnabled(ClassicPrefs.getCustomHighlightedChannelBgColor()); |
449 |
|
|
450 |
|
checkHlChnBgColor.setSelected(ClassicPrefs.getCustomHighlightedChannelBgColor()); |
451 |
|
|
452 |
|
checkHlChnBgColor.addItemListener(new ItemListener() { |
453 |
|
public void |
454 |
|
itemStateChanged(ItemEvent e) { |
455 |
|
boolean b = e.getStateChange() == e.SELECTED; |
456 |
|
btnHlChnBgColor.setEnabled(b); |
457 |
|
} |
458 |
|
}); |
459 |
|
|
460 |
JButton btnDefaults = new JButton("Reset to defaults"); |
JButton btnDefaults = new JButton("Reset to defaults"); |
461 |
btnDefaults.addActionListener(new ActionListener() { |
btnDefaults.addActionListener(new ActionListener() { |
463 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
464 |
ClassicPrefs.setChannelBorderColor(null); |
ClassicPrefs.setChannelBorderColor(null); |
465 |
btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor()); |
btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor()); |
466 |
|
|
467 |
|
ClassicPrefs.setChannelBorderHlColor(null); |
468 |
|
btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor()); |
469 |
|
|
470 |
|
ClassicPrefs.setSelectedChannelBgColor(null); |
471 |
|
btnSelChnBgColor.setColor(ClassicPrefs.getSelectedChannelBgColor()); |
472 |
|
|
473 |
|
ClassicPrefs.setHighlightedChannelBgColor(null); |
474 |
|
btnHlChnBgColor.setColor(ClassicPrefs.getHighlightedChannelBgColor()); |
475 |
} |
} |
476 |
}); |
}); |
477 |
|
|
478 |
p = new JPanel(); |
GridBagLayout gridbag = new GridBagLayout(); |
479 |
|
GridBagConstraints c = new GridBagConstraints(); |
480 |
|
|
481 |
|
JPanel ccp = new JPanel(); |
482 |
|
ccp.setLayout(gridbag); |
483 |
|
|
484 |
|
c.fill = GridBagConstraints.NONE; |
485 |
|
|
486 |
|
c.gridx = 0; |
487 |
|
c.gridy = 0; |
488 |
|
c.anchor = GridBagConstraints.WEST; |
489 |
|
c.insets = new Insets(0, 3, 3, 3); |
490 |
|
gridbag.setConstraints(checkBorderColor, c); |
491 |
|
ccp.add(checkBorderColor); |
492 |
|
|
493 |
|
|
494 |
|
c.gridx = 1; |
495 |
|
c.gridy = 0; |
496 |
|
gridbag.setConstraints(btnBorderColor, c); |
497 |
|
ccp.add(btnBorderColor); |
498 |
|
|
499 |
|
c.gridx = 0; |
500 |
|
c.gridy = 1; |
501 |
|
gridbag.setConstraints(checkHlChnBorderColor, c); |
502 |
|
ccp.add(checkHlChnBorderColor); |
503 |
|
|
504 |
|
c.gridx = 1; |
505 |
|
c.gridy = 1; |
506 |
|
gridbag.setConstraints(btnHlChnBorderColor, c); |
507 |
|
ccp.add(btnHlChnBorderColor); |
508 |
|
|
509 |
|
c.gridx = 0; |
510 |
|
c.gridy = 2; |
511 |
|
gridbag.setConstraints(checkSelChnBgColor, c); |
512 |
|
ccp.add(checkSelChnBgColor); |
513 |
|
|
514 |
|
c.gridx = 1; |
515 |
|
c.gridy = 2; |
516 |
|
gridbag.setConstraints(btnSelChnBgColor, c); |
517 |
|
ccp.add(btnSelChnBgColor); |
518 |
|
|
519 |
|
c.gridx = 0; |
520 |
|
c.gridy = 3; |
521 |
|
gridbag.setConstraints(checkHlChnBgColor, c); |
522 |
|
ccp.add(checkHlChnBgColor); |
523 |
|
|
524 |
|
c.gridx = 1; |
525 |
|
c.gridy = 3; |
526 |
|
gridbag.setConstraints(btnHlChnBgColor, c); |
527 |
|
ccp.add(btnHlChnBgColor); |
528 |
|
|
529 |
|
JPanel p = new JPanel(); |
530 |
p.setAlignmentX(LEFT_ALIGNMENT); |
p.setAlignmentX(LEFT_ALIGNMENT); |
531 |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
532 |
p.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 6)); |
p.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 6)); |
536 |
p.add(btnDefaults); |
p.add(btnDefaults); |
537 |
p.add(Box.createGlue()); |
p.add(Box.createGlue()); |
538 |
|
|
539 |
|
c.fill = GridBagConstraints.HORIZONTAL; |
540 |
|
c.gridx = 0; |
541 |
|
c.gridy = 4; |
542 |
|
c.gridwidth = 2; |
543 |
|
c.weightx = 1.0; |
544 |
|
c.anchor = GridBagConstraints.CENTER; |
545 |
|
gridbag.setConstraints(p, c); |
546 |
ccp.add(p); |
ccp.add(p); |
547 |
|
|
548 |
ccp.setBorder ( |
ccp.setBorder ( |
549 |
BorderFactory.createTitledBorder(i18n.getLabel("ViewPane.CustomColorsPane")) |
BorderFactory.createTitledBorder(i18n.getLabel("ViewPane.CustomColorsPane")) |
550 |
); |
); |
608 |
if(b) c = ClassicPrefs.getChannelBorderColor(); |
if(b) c = ClassicPrefs.getChannelBorderColor(); |
609 |
else c = ClassicPrefs.getDefaultChannelBorderColor(); |
else c = ClassicPrefs.getDefaultChannelBorderColor(); |
610 |
Channel.setBorderColor(c); |
Channel.setBorderColor(c); |
611 |
|
|
612 |
|
b = checkHlChnBorderColor.isSelected(); |
613 |
|
ClassicPrefs.setCustomChannelBorderHlColor(b); |
614 |
|
if(b) ClassicPrefs.setChannelBorderHlColor(btnHlChnBorderColor.getColor()); |
615 |
|
|
616 |
|
if(b) c = ClassicPrefs.getChannelBorderHlColor(); |
617 |
|
else c = ClassicPrefs.getDefaultChannelBorderHlColor(); |
618 |
|
Channel.setBorderHighlightedColor(c); |
619 |
|
|
620 |
|
b = checkSelChnBgColor.isSelected(); |
621 |
|
ClassicPrefs.setCustomSelectedChannelBgColor(b); |
622 |
|
if(b) ClassicPrefs.setSelectedChannelBgColor(btnSelChnBgColor.getColor()); |
623 |
|
|
624 |
|
if(b) c = ClassicPrefs.getSelectedChannelBgColor(); |
625 |
|
else c = new Color(getBackground().getRGB()); |
626 |
|
if(c == null) c = new Color(getBackground().getRGB()); |
627 |
|
Channel.setSelectedChannelBgColor(c); |
628 |
|
|
629 |
|
b = checkHlChnBgColor.isSelected(); |
630 |
|
ClassicPrefs.setCustomHighlightedChannelBgColor(b); |
631 |
|
if(b) ClassicPrefs.setHighlightedChannelBgColor(btnHlChnBgColor.getColor()); |
632 |
|
|
633 |
|
if(b) c = ClassicPrefs.getHighlightedChannelBgColor(); |
634 |
|
else c = new Color(getBackground().getRGB()); |
635 |
|
if(c == null) c = new Color(getBackground().getRGB()); |
636 |
|
Channel.setHighlightedChannelBgColor(c); |
637 |
} |
} |
638 |
|
|
639 |
class LocaleBox { |
class LocaleBox { |
649 |
} |
} |
650 |
} |
} |
651 |
|
|
652 |
class ConsolePane extends JPanel { |
class ConsolePane extends JSLSConsolePropsPane { |
653 |
private final JLabel lCmdHistorySize = |
protected void |
654 |
new JLabel(i18n.getLabel("ConsolePane.lCmdHistorySize")); |
clearConsoleHistory() { |
655 |
private final JSpinner spCmdHistorySize; |
MainFrame mainFrame = (MainFrame)CC.getMainFrame(); |
656 |
private final JLabel lLines = new JLabel(i18n.getLabel("ConsolePane.lLines")); |
mainFrame.getLSConsoleModel().clearCommandHistory(); |
|
private final JButton btnClearCmdHistory = |
|
|
new JButton(i18n.getButtonLabel("ConsolePane.btnClearCmdHistory")); |
|
|
|
|
|
private final JLabel lTextColor = new JLabel(i18n.getLabel("ConsolePane.lTextColor")); |
|
|
private final PrefsDlg.ColorButton btnTextColor = new PrefsDlg.ColorButton(); |
|
|
|
|
|
private final JLabel lBGColor = new JLabel(i18n.getLabel("ConsolePane.lBGColor")); |
|
|
private final PrefsDlg.ColorButton btnBGColor = new PrefsDlg.ColorButton(); |
|
|
|
|
|
private final JLabel lNotifyColor = new JLabel(i18n.getLabel("ConsolePane.lNotifyColor")); |
|
|
private final PrefsDlg.ColorButton btnNotifyColor = new PrefsDlg.ColorButton(); |
|
|
|
|
|
private final JLabel lWarningColor = new JLabel(i18n.getLabel("ConsolePane.lWarningColor")); |
|
|
private final PrefsDlg.ColorButton btnWarningColor = new PrefsDlg.ColorButton(); |
|
|
|
|
|
private final JLabel lErrorColor = new JLabel(i18n.getLabel("ConsolePane.lErrorColor")); |
|
|
private final PrefsDlg.ColorButton btnErrorColor = new PrefsDlg.ColorButton(); |
|
|
|
|
|
|
|
|
public |
|
|
ConsolePane() { |
|
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
|
|
|
|
|
int i = ClassicPrefs.getLSConsoleHistSize(); |
|
|
spCmdHistorySize = new JSpinner(new SpinnerNumberModel(i, 0, 20000, 1)); |
|
|
spCmdHistorySize.setMaximumSize(spCmdHistorySize.getPreferredSize()); |
|
|
|
|
|
JPanel p = new JPanel(); |
|
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
|
|
p.add(lCmdHistorySize); |
|
|
p.add(Box.createRigidArea(new Dimension(5, 0))); |
|
|
p.add(spCmdHistorySize); |
|
|
p.add(Box.createRigidArea(new Dimension(5, 0))); |
|
|
p.add(lLines); |
|
|
|
|
|
p.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
|
|
add(p); |
|
|
|
|
|
add(Box.createRigidArea(new Dimension(0, 6))); |
|
|
|
|
|
btnClearCmdHistory.addActionListener(new ActionListener() { |
|
|
public void |
|
|
actionPerformed(ActionEvent e) { |
|
|
ClassicPrefs.setLSConsoleHistory(null); |
|
|
MainFrame mainFrame = (MainFrame)CC.getMainFrame(); |
|
|
mainFrame.getLSConsoleModel().clearCommandHistory(); |
|
|
} |
|
|
}); |
|
|
|
|
|
btnClearCmdHistory.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
|
|
add(btnClearCmdHistory); |
|
|
|
|
|
add(Box.createRigidArea(new Dimension(0, 6))); |
|
|
|
|
|
p = createConsoleColorsPane(); |
|
|
p.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
|
|
add(p); |
|
|
|
|
|
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
|
|
} |
|
|
|
|
|
private JPanel |
|
|
createConsoleColorsPane() { |
|
|
JPanel ccp = new JPanel(); |
|
|
ccp.setAlignmentX(CENTER_ALIGNMENT); |
|
|
|
|
|
GridBagLayout gridbag = new GridBagLayout(); |
|
|
GridBagConstraints c = new GridBagConstraints(); |
|
|
|
|
|
ccp.setLayout(gridbag); |
|
|
|
|
|
c.fill = GridBagConstraints.NONE; |
|
|
|
|
|
c.gridx = 0; |
|
|
c.gridy = 0; |
|
|
c.anchor = GridBagConstraints.EAST; |
|
|
c.insets = new Insets(3, 3, 3, 3); |
|
|
gridbag.setConstraints(lTextColor, c); |
|
|
ccp.add(lTextColor); |
|
|
|
|
|
c.gridx = 0; |
|
|
c.gridy = 1; |
|
|
gridbag.setConstraints(lBGColor, c); |
|
|
ccp.add(lBGColor); |
|
|
|
|
|
c.gridx = 0; |
|
|
c.gridy = 2; |
|
|
gridbag.setConstraints(lNotifyColor, c); |
|
|
ccp.add(lNotifyColor); |
|
|
|
|
|
c.gridx = 0; |
|
|
c.gridy = 3; |
|
|
gridbag.setConstraints(lWarningColor, c); |
|
|
ccp.add(lWarningColor); |
|
|
|
|
|
c.gridx = 0; |
|
|
c.gridy = 4; |
|
|
gridbag.setConstraints(lErrorColor, c); |
|
|
ccp.add(lErrorColor); |
|
|
|
|
|
c.fill = GridBagConstraints.HORIZONTAL; |
|
|
c.gridx = 1; |
|
|
c.gridy = 0; |
|
|
//c.weightx = 1.0; |
|
|
c.anchor = GridBagConstraints.WEST; |
|
|
gridbag.setConstraints(btnTextColor, c); |
|
|
ccp.add(btnTextColor); |
|
|
|
|
|
c.gridx = 1; |
|
|
c.gridy = 1; |
|
|
gridbag.setConstraints(btnBGColor, c); |
|
|
ccp.add(btnBGColor); |
|
|
|
|
|
c.gridx = 1; |
|
|
c.gridy = 2; |
|
|
gridbag.setConstraints(btnNotifyColor, c); |
|
|
ccp.add(btnNotifyColor); |
|
|
|
|
|
c.gridx = 1; |
|
|
c.gridy = 3; |
|
|
gridbag.setConstraints(btnWarningColor, c); |
|
|
ccp.add(btnWarningColor); |
|
|
|
|
|
c.gridx = 1; |
|
|
c.gridy = 4; |
|
|
gridbag.setConstraints(btnErrorColor, c); |
|
|
ccp.add(btnErrorColor); |
|
|
|
|
|
btnTextColor.setColor(ClassicPrefs.getLSConsoleTextColor()); |
|
|
btnBGColor.setColor(ClassicPrefs.getLSConsoleBackgroundColor()); |
|
|
btnNotifyColor.setColor(ClassicPrefs.getLSConsoleNotifyColor()); |
|
|
btnWarningColor.setColor(ClassicPrefs.getLSConsoleWarningColor()); |
|
|
btnErrorColor.setColor(ClassicPrefs.getLSConsoleErrorColor()); |
|
|
|
|
|
JButton btnDefaults = new JButton("Reset to defaults"); |
|
|
|
|
|
btnDefaults.addActionListener(new ActionListener() { |
|
|
public void |
|
|
actionPerformed(ActionEvent e) { |
|
|
ClassicPrefs.setLSConsoleTextColor(null); |
|
|
btnTextColor.setColor(ClassicPrefs.getLSConsoleTextColor()); |
|
|
|
|
|
ClassicPrefs.setLSConsoleBackgroundColor(null); |
|
|
btnBGColor.setColor(ClassicPrefs.getLSConsoleBackgroundColor()); |
|
|
|
|
|
ClassicPrefs.setLSConsoleNotifyColor(null); |
|
|
btnNotifyColor.setColor(ClassicPrefs.getLSConsoleNotifyColor()); |
|
|
|
|
|
ClassicPrefs.setLSConsoleWarningColor(null); |
|
|
btnWarningColor.setColor(ClassicPrefs.getLSConsoleWarningColor()); |
|
|
|
|
|
ClassicPrefs.setLSConsoleErrorColor(null); |
|
|
btnErrorColor.setColor(ClassicPrefs.getLSConsoleErrorColor()); |
|
|
} |
|
|
}); |
|
|
|
|
|
JPanel p = new JPanel(); |
|
|
p.setAlignmentX(LEFT_ALIGNMENT); |
|
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
|
|
p.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 6)); |
|
|
p.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); |
|
|
|
|
|
p.add(Box.createGlue()); |
|
|
p.add(btnDefaults); |
|
|
p.add(Box.createGlue()); |
|
|
|
|
|
c.gridx = 0; |
|
|
c.gridy = 5; |
|
|
c.gridwidth = 2; |
|
|
gridbag.setConstraints(p, c); |
|
|
ccp.add(p); |
|
|
|
|
|
ccp.setBorder ( |
|
|
BorderFactory.createTitledBorder(i18n.getLabel("ConsolePane.consoleColors")) |
|
|
); |
|
|
|
|
|
ccp.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); |
|
|
|
|
|
return ccp; |
|
657 |
} |
} |
658 |
|
|
659 |
protected void |
protected void |
660 |
apply() { |
apply() { |
661 |
int size = Integer.parseInt(spCmdHistorySize.getValue().toString()); |
super.apply(); |
|
ClassicPrefs.setLSConsoleHistSize(size); |
|
|
LSConsoleModel model = ((MainFrame)CC.getMainFrame()).getLSConsoleModel(); |
|
|
model.setCommandHistorySize(size); |
|
|
|
|
|
///***/// |
|
662 |
|
|
663 |
MainFrame mainFrame = (MainFrame)CC.getMainFrame(); |
MainFrame mainFrame = (MainFrame)CC.getMainFrame(); |
664 |
|
|
665 |
ClassicPrefs.setLSConsoleTextColor(btnTextColor.getColor()); |
LSConsoleModel model = mainFrame.getLSConsoleModel(); |
666 |
mainFrame.setLSConsoleTextColor(btnTextColor.getColor()); |
model.setCommandHistorySize(preferences().getIntProperty(LS_CONSOLE_HISTSIZE)); |
667 |
|
|
668 |
ClassicPrefs.setLSConsoleBackgroundColor(btnBGColor.getColor()); |
int c = preferences().getIntProperty(LS_CONSOLE_TEXT_COLOR); |
669 |
mainFrame.setLSConsoleBackgroundColor(btnBGColor.getColor()); |
mainFrame.setLSConsoleTextColor(new Color(c)); |
670 |
|
|
671 |
ClassicPrefs.setLSConsoleNotifyColor(btnNotifyColor.getColor()); |
c = preferences().getIntProperty(LS_CONSOLE_BACKGROUND_COLOR); |
672 |
mainFrame.setLSConsoleNotifyColor(btnNotifyColor.getColor()); |
mainFrame.setLSConsoleBackgroundColor(new Color(c)); |
673 |
|
|
674 |
ClassicPrefs.setLSConsoleWarningColor(btnWarningColor.getColor()); |
c = preferences().getIntProperty(LS_CONSOLE_NOTIFY_COLOR); |
675 |
mainFrame.setLSConsoleWarningColor(btnWarningColor.getColor()); |
mainFrame.setLSConsoleNotifyColor(new Color(c)); |
676 |
|
|
677 |
ClassicPrefs.setLSConsoleErrorColor(btnErrorColor.getColor()); |
c = preferences().getIntProperty(LS_CONSOLE_WARNING_COLOR); |
678 |
mainFrame.setLSConsoleErrorColor(btnErrorColor.getColor()); |
mainFrame.setLSConsoleWarningColor(new Color(c)); |
|
} |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
class ConnectionPane extends JPanel { |
|
|
final LSPrefsPane lsPrefsPane = new LSPrefsPane(); |
|
|
|
|
|
public |
|
|
ConnectionPane() { initConnectionPane(); } |
|
|
|
|
|
private void |
|
|
initConnectionPane() { |
|
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
|
679 |
|
|
680 |
add(lsPrefsPane); |
c = preferences().getIntProperty(LS_CONSOLE_ERROR_COLOR); |
681 |
add(Box.createGlue()); |
mainFrame.setLSConsoleErrorColor(new Color(c)); |
|
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
|
682 |
} |
} |
|
|
|
|
public String |
|
|
getLSAddress() { return lsPrefsPane.getLSAddress(); } |
|
|
|
|
|
public void |
|
|
setLSAddress(String address) { lsPrefsPane.setLSAddress(address); } |
|
|
|
|
|
public String |
|
|
getLSPort() { return lsPrefsPane.getLSPort(); } |
|
|
|
|
|
public void |
|
|
setLSPort(String port) { lsPrefsPane.setLSPort(port); } |
|
|
} |
|
|
|
|
|
class LSPrefsPane extends JPanel { |
|
|
private final JLabel lAddress = new JLabel(i18n.getLabel("LSPrefsPane.Address")); |
|
|
private final JLabel lPort = new JLabel(i18n.getLabel("LSPrefsPane.Port")); |
|
|
private final JTextField tfAddress = new JTextField(); |
|
|
private final JTextField tfPort = new JTextField(); |
|
|
|
|
|
|
|
|
public |
|
|
LSPrefsPane() { initLSPrefsPane(); } |
|
|
|
|
|
private void |
|
|
initLSPrefsPane() { |
|
|
GridBagLayout gridbag = new GridBagLayout(); |
|
|
GridBagConstraints c = new GridBagConstraints(); |
|
|
|
|
|
setLayout(gridbag); |
|
|
|
|
|
// Set preferred size for username & password fields |
|
|
int w1 = (int) tfAddress.getMinimumSize().getWidth(); |
|
|
int h1 = (int) tfAddress.getMinimumSize().getHeight(); |
|
|
Dimension d = new Dimension(w1 > 150 ? w1 : 150, h1); |
|
|
tfAddress.setMinimumSize(d); |
|
|
tfAddress.setPreferredSize(d); |
|
|
|
|
|
w1 = (int) tfPort.getMinimumSize().getWidth(); |
|
|
h1 = (int) tfPort.getMinimumSize().getHeight(); |
|
|
d = new Dimension(w1 > 150 ? w1 : 150, h1); |
|
|
tfPort.setMinimumSize(d); |
|
|
tfPort.setPreferredSize(d); |
|
|
|
|
|
c.fill = GridBagConstraints.NONE; |
|
|
|
|
|
c.gridx = 0; |
|
|
c.gridy = 0; |
|
|
c.anchor = GridBagConstraints.EAST; |
|
|
c.insets = new Insets(3, 3, 3, 3); |
|
|
gridbag.setConstraints(lAddress, c); |
|
|
add(lAddress); |
|
|
|
|
|
c.gridx = 0; |
|
|
c.gridy = 1; |
|
|
gridbag.setConstraints(lPort, c); |
|
|
add(lPort); |
|
|
|
|
|
c.fill = GridBagConstraints.HORIZONTAL; |
|
|
c.gridx = 1; |
|
|
c.gridy = 0; |
|
|
c.weightx = 1.0; |
|
|
c.anchor = GridBagConstraints.WEST; |
|
|
gridbag.setConstraints(tfAddress, c); |
|
|
add(tfAddress); |
|
|
|
|
|
c.gridx = 1; |
|
|
c.gridy = 1; |
|
|
gridbag.setConstraints(tfPort, c); |
|
|
add(tfPort); |
|
|
|
|
|
setBorder(BorderFactory.createTitledBorder(i18n.getLabel("LSPrefsPane"))); |
|
|
setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height)); |
|
|
} |
|
|
|
|
|
public String |
|
|
getLSAddress() { return tfAddress.getText(); } |
|
|
|
|
|
public void |
|
|
setLSAddress(String address) { tfAddress.setText(address); } |
|
|
|
|
|
public String |
|
|
getLSPort() { return tfPort.getText(); } |
|
|
|
|
|
public void |
|
|
setLSPort(String port) { tfPort.setText(port); } |
|
683 |
} |
} |