Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

Commit

Permalink
"No image found" error is now shown when an image file is not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpaterakis committed Jul 8, 2019
1 parent ecbc1dd commit fca5009
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/UI/GameLabel.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ public GameLabel(Game game, MainFrame mainFrame) {
private void initComponents() {

// Add background image to JLabel
bgImage = new AlphaImageIcon(game.getGameIcon(), 1.0f);
setIcon(bgImage);
if (game.getGameIcon().getImageLoadStatus() == 8) {
bgImage = new AlphaImageIcon(game.getGameIcon(), 1.0f);
setIcon(bgImage);
} else {
setText("Image not found");
setHorizontalAlignment(CENTER);
setForeground(new Color(16777215 - mainFrame.getBackgroundColor().getRGB()));
}

// Add MouseListener
addMouseListener(new MouseAdapter() {
Expand Down
2 changes: 0 additions & 2 deletions src/UI/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import java.util.logging.*;
import javax.imageio.ImageIO;
Expand Down

0 comments on commit fca5009

Please sign in to comment.