Hello, i'm having this where i'm trying to return a JPanel with tempPictures but only if they aren't already filled with "actual" pictures. However this causes problems because your never shore that the if statement will execute. I tried adding an else statement but i cant return null i must return a JPanel;
private JPanel buildTopShelf() { if(myMediaHandler.mediaList.size() < 6) { JPanel mediaPanel = new JPanel(); mediaPanel.setOpaque(false); mediaPanel.setLayout(new GridLayout(1,6,22,0)); mediaPanel.setBounds(90, 14, 1020, 210); java.net.URL where; try { where = new URL("https://dl.dropboxusercontent.com/u/16670644/Projekt/TempPic.png"); ImageIcon image = new ImageIcon(where); for(int i = myMediaHandler.mediaList.size(); i < 6; i++) { JLabel imageLabel = new JLabel(image); mediaPanel.add(imageLabel); } } catch (MalformedURLException e) { // TODO Auto-generated catch block System.out.println("Error loading TempPic that shows allowed movie spots"); e.printStackTrace(); } return mediaPanel; } else { return null; } }