private boolean rollover = false;
@Override
public void stateChanged(final ChangeEvent e) {
final JButton btn = (JButton) e.getSource();
final ButtonModel model = btn.getModel();
if (model.isRollover() && !rollover) {
btn.setForeground(Color.LIGHT_GRAY);
rollover = true;
} else if (rollover && !model.isRollover()) {
btn.setForeground(Color.GRAY);
rollover = false;
}
}
});
// previous.setIcon(new ImageIcon(previousButtonIcon));
// previous.setRolloverIcon(new ImageIcon(previousRollOver));
play = new JButton("");
play.addActionListener(e -> {
final boolean isPaused = PlayerFunctions.isPaused;
if (!isPaused) {
PlayerFunctions.pause(play);
} else {
PlayerFunctions.play(play);
}
});
((WebButtonUI) play.getUI()).setUndecorated(true);
play.setFont(fontAwesome);
play.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
play.setBorderPainted(false);
play.setBorder(null);
play.setText("\uf04b");
play.setMargin(new Insets(0, 0, 0, 0));
play.setContentAreaFilled(false);
play.addChangeListener(new ChangeListener() {
private boolean rollover = false;
@Override
public void stateChanged(final ChangeEvent e) {
final JButton btn = (JButton) e.getSource();
final ButtonModel model = btn.getModel();
if (model.isRollover() && !rollover) {
btn.setForeground(Color.LIGHT_GRAY);
rollover = true;
} else if (rollover && !model.isRollover()) {
btn.setForeground(Color.GRAY);
rollover = false;
}
}
});
// play.setIcon(new ImageIcon(playBackPaused));
// play.setRolloverIcon(new ImageIcon(playBackPausedHover));
final JButton next = new JButton("");
((WebButtonUI) next.getUI()).setUndecorated(true);
next.addActionListener(e -> PlayerFunctions.seekNext());
next.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
next.setBorderPainted(false);
next.setBorder(null);
next.setFont(fontAwesome);
next.setMargin(new Insets(0, 0, 0, 0));
next.setContentAreaFilled(false);
next.setText("\uF04E");
// next.setIcon(new ImageIcon(forwardButtonIcon));
// next.setRolloverIcon(new ImageIcon(forwardButtonHover));
next.setToolTipText("Next");
next.addChangeListener(new ChangeListener() {
private boolean rollover = false;
@Override
public void stateChanged(final ChangeEvent e) {
final JButton btn = (JButton) e.getSource();
final ButtonModel model = btn.getModel();
if (model.isRollover() && !rollover) {
btn.setForeground(Color.LIGHT_GRAY);
rollover = true;
} else if (rollover && !model.isRollover()) {
btn.setForeground(Color.GRAY);
rollover = false;
}
}
});
final JButton mute = new JButton("");
((WebButtonUI) mute.getUI()).setUndecorated(true);
mute.setFont(fontAwesome);
mute.setText("\uF028");
mute.addActionListener(e -> MediaUtils.muteToggle());
mute.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
mute.setBorderPainted(false);
mute.setBorder(null);
mute.setMargin(new Insets(0, 0, 0, 0));
mute.setContentAreaFilled(false);
mute.addChangeListener(new ChangeListener() {
private boolean rollover = false;
@Override
public void stateChanged(final ChangeEvent e) {
final JButton btn = (JButton) e.getSource();
final ButtonModel model = btn.getModel();
if (model.isRollover() && !rollover) {
btn.setForeground(Color.LIGHT_GRAY);
rollover = true;
} else if (rollover && !model.isRollover()) {
btn.setForeground(Color.GRAY);
rollover = false;
}
}
});