/[svn]/jsampler/trunk/src/org/jsampler/view/std/JSGeneralProps.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/std/JSGeneralProps.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1286 by iliev, Fri Aug 10 20:24:23 2007 UTC revision 1357 by iliev, Sat Sep 22 17:27:06 2007 UTC
# Line 23  Line 23 
23  package org.jsampler.view.std;  package org.jsampler.view.std;
24    
25  import java.awt.Dimension;  import java.awt.Dimension;
26    import java.awt.GridBagConstraints;
27    import java.awt.GridBagLayout;
28    import java.awt.Insets;
29    
30  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
31  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
# Line 53  import static org.jsampler.view.std.StdP Line 56  import static org.jsampler.view.std.StdP
56   */   */
57  public class JSGeneralProps {  public class JSGeneralProps {
58                    
59          /** Creates a new instance of <code>JSGeneralProps</code> */          /** Forbids the instantiation of this class. */
60          private JSGeneralProps() { }          private JSGeneralProps() { }
61                    
62          private static JSPrefs          private static JSPrefs
63          preferences() { return CC.getViewConfig().preferences(); }          preferences() { return CC.getViewConfig().preferences(); }
64                    
65                    
66            public static class MaxVolumePane extends JPanel {
67                    private final JLabel lMaxMasterVol =
68                            new JLabel(i18n.getLabel("JSGeneralProps.lMaxMasterVol"));
69                    
70                    private final JLabel lMaxChannelVol =
71                            new JLabel(i18n.getLabel("JSGeneralProps.lMaxChannelVol"));
72                    
73                    private final JSpinner spMaxMasterVol;
74                    private final JSpinner spMaxChannelVol;
75                    
76                    public
77                    MaxVolumePane() {
78                            int i = preferences().getIntProperty(MAXIMUM_MASTER_VOLUME);
79                            spMaxMasterVol = new JSpinner(new SpinnerNumberModel(i, 10, 1000, 10));
80                            i = preferences().getIntProperty(MAXIMUM_CHANNEL_VOLUME);
81                            spMaxChannelVol = new JSpinner(new SpinnerNumberModel(i, 10, 1000, 10));
82                            
83                            GridBagLayout gridbag = new GridBagLayout();
84                            GridBagConstraints c = new GridBagConstraints();
85                            
86                            setLayout(gridbag);
87                            
88                            c.fill = GridBagConstraints.NONE;
89                            
90                            c.gridx = 0;
91                            c.gridy = 0;
92                            c.anchor = GridBagConstraints.EAST;
93                            c.insets = new Insets(3, 3, 3, 3);
94                            gridbag.setConstraints(lMaxMasterVol, c);
95                            add(lMaxMasterVol);
96                            
97                            c.gridx = 0;
98                            c.gridy = 1;
99                            gridbag.setConstraints(lMaxChannelVol, c);
100                            add(lMaxChannelVol);
101                            
102                            c.gridx = 1;
103                            c.gridy = 0;
104                            c.fill = GridBagConstraints.HORIZONTAL;
105                            c.anchor = GridBagConstraints.WEST;
106                            gridbag.setConstraints(spMaxMasterVol, c);
107                            add(spMaxMasterVol);
108                            
109                            c.gridx = 1;
110                            c.gridy = 1;
111                            gridbag.setConstraints(spMaxChannelVol, c);
112                            add(spMaxChannelVol);
113                            
114                            c.gridx = 2;
115                            c.gridy = 0;
116                            c.gridheight = 2;
117                            c.weightx = 1.0;
118                            JPanel p = new JPanel();
119                            p.setOpaque(false);
120                            gridbag.setConstraints(p, c);
121                            add(p);
122                            
123                            setAlignmentX(JPanel.LEFT_ALIGNMENT);
124                            setOpaque(false);
125                    }
126                    
127                    public void
128                    apply() {
129                            int i = Integer.parseInt(spMaxMasterVol.getValue().toString());
130                            preferences().setIntProperty(MAXIMUM_MASTER_VOLUME, i);
131                            
132                            i = Integer.parseInt(spMaxChannelVol.getValue().toString());
133                            preferences().setIntProperty(MAXIMUM_CHANNEL_VOLUME, i);
134                    }
135            }
136            
137          public static class JSamplerHomePane extends JPanel {          public static class JSamplerHomePane extends JPanel {
138                  private final JTextField tfJSamplerHome = new JTextField();                  private final JTextField tfJSamplerHome = new JTextField();
139                  private final JButton btnChange =                  private final JButton btnChange =

Legend:
Removed from v.1286  
changed lines
  Added in v.1357

  ViewVC Help
Powered by ViewVC