22 |
package org.jsampler.view.std; |
package org.jsampler.view.std; |
23 |
|
|
24 |
import java.awt.Desktop; |
import java.awt.Desktop; |
25 |
|
import java.awt.Rectangle; |
26 |
|
|
27 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
28 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
37 |
import java.text.NumberFormat; |
import java.text.NumberFormat; |
38 |
|
|
39 |
import java.util.Vector; |
import java.util.Vector; |
40 |
|
import java.util.logging.Level; |
41 |
|
|
42 |
import javax.swing.JComboBox; |
import javax.swing.JComboBox; |
43 |
import javax.swing.JSlider; |
import javax.swing.JSlider; |
134 |
catch(Exception x) { x.printStackTrace(); } |
catch(Exception x) { x.printStackTrace(); } |
135 |
} |
} |
136 |
|
|
137 |
|
/** |
138 |
|
* Gets the windows bounds from the preferences for the specified window. |
139 |
|
* @return The windows bounds saved in the preferences for the specified window |
140 |
|
* or <code>null</code>. |
141 |
|
*/ |
142 |
|
public static Rectangle |
143 |
|
getWindowBounds(String windowName) { |
144 |
|
String s = windowName + ".windowSizeAndLocation"; |
145 |
|
s = CC.preferences().getStringProperty(s, null); |
146 |
|
if(s == null) return null; |
147 |
|
|
148 |
|
try { |
149 |
|
int i = s.indexOf(','); |
150 |
|
int x = Integer.parseInt(s.substring(0, i)); |
151 |
|
|
152 |
|
s = s.substring(i + 1); |
153 |
|
i = s.indexOf(','); |
154 |
|
int y = Integer.parseInt(s.substring(0, i)); |
155 |
|
|
156 |
|
s = s.substring(i + 1); |
157 |
|
i = s.indexOf(','); |
158 |
|
int width = Integer.parseInt(s.substring(0, i)); |
159 |
|
|
160 |
|
s = s.substring(i + 1); |
161 |
|
int height = Integer.parseInt(s); |
162 |
|
|
163 |
|
return new Rectangle(x, y, width, height); |
164 |
|
} catch(Exception x) { |
165 |
|
String msg = windowName; |
166 |
|
msg += ": Parsing of window size and location string failed"; |
167 |
|
CC.getLogger().log(Level.INFO, msg, x); |
168 |
|
return null; |
169 |
|
} |
170 |
|
} |
171 |
|
|
172 |
|
/** |
173 |
|
* Saves the windows bounds in the preferences for the specified window. |
174 |
|
*/ |
175 |
|
public static void |
176 |
|
saveWindowBounds(String windowName, Rectangle r) { |
177 |
|
StringBuffer sb = new StringBuffer(); |
178 |
|
sb.append(r.x).append(',').append(r.y).append(','); |
179 |
|
sb.append(r.width).append(',').append(r.height); |
180 |
|
String s = windowName + ".windowSizeAndLocation"; |
181 |
|
CC.preferences().setStringProperty(s, sb.toString()); |
182 |
|
} |
183 |
|
|
184 |
public static JSlider |
public static JSlider |
185 |
createVolumeSlider() { |
createVolumeSlider() { |
186 |
return new VolumeSlider(); |
return new VolumeSlider(); |