Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Commit

Permalink
Fixed UI bug where UI elements would be drawn to PlaybackPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
ajchili committed Jul 6, 2017
1 parent e1e3247 commit 6f441e9
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions sync/src/com/kirinpatel/gui/PlaybackPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class PlaybackPanel extends JPanel {

PlaybackPanel(int type) {
super(new BorderLayout());
setBackground(Color.BLACK);
this.type = type;

fullscreenListener = new FullscreenListener();
Expand Down Expand Up @@ -59,7 +58,7 @@ public void mouseMoved(MouseEvent e) {
if (e.getY() >= Toolkit.getDefaultToolkit().getScreenSize().getHeight() - 50) {
showBar = true;
controlPanel.setVisible(true);
repaint();
if (!mediaPlayer.getMediaURL().isEmpty() && !mediaPlayer.isPaused()) repaint();
} else {
new Thread(() -> {
try {
Expand All @@ -68,7 +67,7 @@ public void mouseMoved(MouseEvent e) {

if (!showBar && isFullscreen) {
controlPanel.setVisible(false);
repaint();
if (!mediaPlayer.getMediaURL().isEmpty() && !mediaPlayer.isPaused()) repaint();
}
} catch(InterruptedException e1) {
e1.printStackTrace();
Expand Down Expand Up @@ -115,9 +114,11 @@ public void closeFullscreen() {
add(mediaPlayer, BorderLayout.CENTER);
add(controlPanel, BorderLayout.SOUTH);
controlPanel.setVisible(true);
mediaPlayer.repaint();
controlPanel.repaint();
repaint();
if (!mediaPlayer.getMediaURL().isEmpty() && !mediaPlayer.isPaused()) {
mediaPlayer.repaint();
controlPanel.repaint();
repaint();
}
}

private void initControls() {
Expand Down Expand Up @@ -193,14 +194,18 @@ public void mouseReleased(MouseEvent e) {

@Override
public void mouseEntered(MouseEvent e) {
mediaPlayer.revalidate();
mediaPlayer.repaint();
if (!mediaPlayer.getMediaURL().isEmpty() && !mediaPlayer.isPaused()) {
mediaPlayer.revalidate();
mediaPlayer.repaint();
}
}

@Override
public void mouseExited(MouseEvent e) {
mediaPlayer.revalidate();
mediaPlayer.repaint();
if (!mediaPlayer.getMediaURL().isEmpty() && !mediaPlayer.isPaused()) {
mediaPlayer.revalidate();
mediaPlayer.repaint();
}
}
}
}

0 comments on commit 6f441e9

Please sign in to comment.