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

Diff of /jsampler/trunk/src/org/jsampler/view/classic/ChannelsBar.java

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

revision 1566 by iliev, Sat Sep 22 17:27:06 2007 UTC revision 1567 by iliev, Thu Dec 6 19:37:41 2007 UTC
# Line 38  import javax.swing.JLabel; Line 38  import javax.swing.JLabel;
38  import javax.swing.JPanel;  import javax.swing.JPanel;
39  import javax.swing.JSlider;  import javax.swing.JSlider;
40  import javax.swing.JToolBar;  import javax.swing.JToolBar;
 import javax.swing.JToolTip;  
 import javax.swing.Popup;  
 import javax.swing.PopupFactory;  
41    
42  import javax.swing.event.ChangeEvent;  import javax.swing.event.ChangeEvent;
43  import javax.swing.event.ChangeListener;  import javax.swing.event.ChangeListener;
# Line 50  import org.jsampler.CC; Line 47  import org.jsampler.CC;
47  import org.jsampler.event.SamplerAdapter;  import org.jsampler.event.SamplerAdapter;
48  import org.jsampler.event.SamplerEvent;  import org.jsampler.event.SamplerEvent;
49    
50    import org.jsampler.view.std.StdUtils;
51    
52  import static org.jsampler.view.classic.ClassicI18n.i18n;  import static org.jsampler.view.classic.ClassicI18n.i18n;
53  import static org.jsampler.view.classic.ClassicPrefs.preferences;  import static org.jsampler.view.classic.ClassicPrefs.preferences;
54  import static org.jsampler.view.std.StdPrefs.*;  import static org.jsampler.view.std.StdPrefs.*;
# Line 72  public class ChannelsBar extends JToolBa Line 71  public class ChannelsBar extends JToolBa
71          private final JButton btnTabMoveRight = new ToolbarButton(A4n.moveTab2Right);          private final JButton btnTabMoveRight = new ToolbarButton(A4n.moveTab2Right);
72                    
73          private final JLabel lVolume = new JLabel(Res.iconVolume22);          private final JLabel lVolume = new JLabel(Res.iconVolume22);
74          private final JSlider slVolume = new JSlider(0, 100);          private final JSlider slVolume = StdUtils.createVolumeSlider();
         private Popup popup = null;  
         private final JToolTip tip = new JToolTip();  
75                    
76                    
77          /**          /**
# Line 107  public class ChannelsBar extends JToolBa Line 104  public class ChannelsBar extends JToolBa
104                  add(btnTabMoveLeft);                  add(btnTabMoveLeft);
105                  add(btnTabMoveRight);                  add(btnTabMoveRight);
106                                    
                 // Setting the tooltip size  
                 tip.setTipText(i18n.getLabel("ChannelsBar.volume", 1000));  
                 tip.setMinimumSize(tip.getPreferredSize());  
                 tip.setPreferredSize(tip.getPreferredSize()); // workaround for preserving that size  
                 tip.setComponent(slVolume);  
                 ///////  
                   
107                  int i = preferences().getIntProperty(MAXIMUM_MASTER_VOLUME);                  int i = preferences().getIntProperty(MAXIMUM_MASTER_VOLUME);
108                  slVolume.setMaximum(i);                  slVolume.setMaximum(i);
109                  String s = MAXIMUM_MASTER_VOLUME;                  String s = MAXIMUM_MASTER_VOLUME;
# Line 136  public class ChannelsBar extends JToolBa Line 126  public class ChannelsBar extends JToolBa
126                  });                  });
127                                    
128                  updateVolume();                  updateVolume();
                   
                 slVolume.addMouseListener(new MouseAdapter() {  
                         public void  
                         mousePressed(MouseEvent e) {  
                                 if(popup != null) {  
                                         popup.hide();  
                                         popup = null;  
                                 }  
                                   
                                 Point p = slVolume.getLocationOnScreen();  
                                 PopupFactory pf = PopupFactory.getSharedInstance();  
                                 popup = pf.getPopup(slVolume, tip, p.x, p.y - 22);  
                                 popup.show();  
                         }  
                           
                         public void  
                         mouseReleased(MouseEvent e) {  
                                 if(popup != null) {  
                                         popup.hide();  
                                         popup = null;  
                                 }  
                         }  
                 });  
129          }          }
130                    
131          private void          private void
132          setVolume() {          setVolume() {
133                  int volume = slVolume.getValue();                  int volume = slVolume.getValue();
134                  String s = i18n.getLabel("ChannelsBar.volume", volume);                  String s = i18n.getLabel("ChannelsBar.volume", volume);
                 slVolume.setToolTipText(s);  
                 lVolume.setToolTipText(s);  
                 tip.setTipText(s);  
                 tip.repaint();  
135                                    
136                  if(slVolume.getValueIsAdjusting()) return;                  if(slVolume.getValueIsAdjusting()) return;
137                                    

Legend:
Removed from v.1566  
changed lines
  Added in v.1567

  ViewVC Help
Powered by ViewVC