Changeset 1102 for trunk/src/org/apollo/gui/PlaybackControlPopup.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/apollo/gui/PlaybackControlPopup.java
r315 r1102 2 2 3 3 import java.awt.Dimension; 4 import java.awt.Graphics2D; 4 5 import java.awt.GridBagConstraints; 5 6 import java.awt.GridBagLayout; … … 8 9 import java.awt.event.ActionListener; 9 10 10 import javax.swing.Icon;11 11 import javax.swing.JButton; 12 import javax.swing.JPanel; 12 13 import javax.swing.JSlider; 13 14 import javax.swing.JToggleButton; … … 16 17 17 18 import org.apollo.io.IconRepository; 19 import org.expeditee.core.Image; 20 import org.expeditee.core.bounds.AxisAlignedBoxBounds; 21 import org.expeditee.gio.swing.SwingConversions; 22 import org.expeditee.gio.swing.SwingMiscManager; 18 23 import org.expeditee.gui.Popup; 24 import org.expeditee.gui.PopupManager.ExpandShrinkAnimator; 19 25 20 26 /** … … 25 31 * 26 32 */ 27 public abstract class PlaybackControlPopup extends Popup implements ActionListener { 28 33 public abstract class PlaybackControlPopup extends Popup implements ActionListener 34 { 35 public JPanel panel; 29 36 public JButton playPauseButton; 30 37 public JButton stopButton; … … 39 46 private static final int BUTTON_SIZE = 40; 40 47 41 protected PlaybackControlPopup() { 42 super(new GridBagLayout()); 48 protected PlaybackControlPopup() 49 { 50 super(new ExpandShrinkAnimator()); 51 52 panel = new JPanel(new GridBagLayout()); 43 53 44 54 playPauseButton = new JButton(); 45 55 playPauseButton.setActionCommand("playpause"); 46 56 playPauseButton.addActionListener(this); 47 playPauseButton.setIcon(IconRepository.getIcon("play.png"));57 SwingMiscManager.setJButtonIcon(playPauseButton, IconRepository.getIcon("play.png")); 48 58 playPauseButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE)); 49 59 playPauseButton.setToolTipText("Play selection / Pause"); … … 53 63 stopButton.addActionListener(this); 54 64 stopButton.setActionCommand("stop"); 55 stopButton.setIcon(IconRepository.getIcon("stop.png"));65 SwingMiscManager.setJButtonIcon(stopButton, IconRepository.getIcon("stop.png")); 56 66 stopButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE)); 57 67 stopButton.setToolTipText("Stop playback"); … … 60 70 rewindButton.addActionListener(this); 61 71 rewindButton.setActionCommand("rewind"); 62 rewindButton.setIcon(IconRepository.getIcon("rewind.png"));72 SwingMiscManager.setJButtonIcon(rewindButton, IconRepository.getIcon("rewind.png")); 63 73 rewindButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE)); 64 74 rewindButton.setToolTipText("Rewind to start"); … … 66 76 // Icon changes 67 77 muteButton = new JToggleButton(); 68 muteButton.setSelectedIcon(IconRepository.getIcon("volmute.png"));78 SwingMiscManager.setJButtonSelectedIcon(muteButton, IconRepository.getIcon("volmute.png")); 69 79 muteButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE)); 70 80 muteButton.setToolTipText("Toggle mute"); … … 78 88 79 89 soloButton = new JToggleButton(); 80 soloButton.setIcon(IconRepository.getIcon("solo.png"));81 soloButton.setSelectedIcon(IconRepository.getIcon("soloon.png"));90 SwingMiscManager.setJButtonIcon(soloButton, IconRepository.getIcon("solo.png")); 91 SwingMiscManager.setJButtonSelectedIcon(soloButton, IconRepository.getIcon("soloon.png")); 82 92 soloButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE)); 83 93 soloButton.setToolTipText("Toggle solo"); … … 115 125 c.gridy = 0; 116 126 c.fill = GridBagConstraints.BOTH; 117 add(playPauseButton, c);127 panel.add(playPauseButton, c); 118 128 119 129 c = new GridBagConstraints(); … … 121 131 c.gridy = 0; 122 132 c.fill = GridBagConstraints.BOTH; 123 add(stopButton, c);133 panel.add(stopButton, c); 124 134 125 135 c = new GridBagConstraints(); … … 127 137 c.gridy = 0; 128 138 c.fill = GridBagConstraints.BOTH; 129 add(rewindButton, c);139 panel.add(rewindButton, c); 130 140 131 141 c = new GridBagConstraints(); … … 133 143 c.gridy = 0; 134 144 c.fill = GridBagConstraints.BOTH; 135 add(soloButton, c);145 panel.add(soloButton, c); 136 146 137 147 c = new GridBagConstraints(); … … 139 149 c.gridy = 0; 140 150 c.fill = GridBagConstraints.BOTH; 141 add(muteButton, c);151 panel.add(muteButton, c); 142 152 143 153 c = new GridBagConstraints(); … … 146 156 c.fill = GridBagConstraints.BOTH; 147 157 c.insets = new Insets(0,VOLUME_SPACING,0,VOLUME_SPACING); 148 add(volumeSlider, c);158 panel.add(volumeSlider, c); 149 159 150 160 c = new GridBagConstraints(); … … 152 162 c.gridy = 0; 153 163 c.fill = GridBagConstraints.BOTH; 154 add(miscButton, c);164 panel.add(miscButton, c); 155 165 156 166 // … … 201 211 // this.setSize(BUTTON_SIZE * 4, BUTTON_SIZE * 2); 202 212 203 this.setSize(BUTTON_SIZE * 8, BUTTON_SIZE);204 205 this.doLayout();213 panel.setSize(BUTTON_SIZE * 8, BUTTON_SIZE); 214 215 panel.doLayout(); 206 216 207 217 } … … 213 223 private void updateButtonGUI() { 214 224 215 I connewIcon = null;225 Image newIcon = null; 216 226 if (volumeSlider.getValue() <= 25) 217 227 newIcon = IconRepository.getIcon("vol25.png"); … … 223 233 newIcon = IconRepository.getIcon("vol100.png"); 224 234 225 muteButton.setIcon(newIcon); 226 } 227 228 235 SwingMiscManager.setJButtonIcon(muteButton, newIcon); 236 } 237 238 @Override 239 protected void paintInternal() 240 { 241 Graphics2D g = SwingMiscManager.getIfUsingSwingGraphicsManager().getCurrentSurface(); 242 AxisAlignedBoxBounds bounds = getBounds(); 243 244 g.translate(bounds.getMinX(), bounds.getMinY()); 245 panel.paint(g); 246 g.translate(-bounds.getMinX(), -bounds.getMinY()); 247 } 248 249 @Override 250 public AxisAlignedBoxBounds getFullBounds() 251 { 252 return SwingConversions.fromSwingRectangle(panel.getBounds()); 253 } 254 229 255 public abstract void actionPerformed(ActionEvent e); 230 256
Note:
See TracChangeset
for help on using the changeset viewer.