So what am i missing here for some reason when i take the pack(); method off the images seem to vanish. Any Help here would be great.
import java.awt.*; import javax.swing.*; public class Screen extends JFrame{ //Panels for all buttons//////////////// private JPanel computer; private JPanel parts; private JPanel sound; private JPanel screens; private JPanel misc; private JPanel misc2; /////////////////////////////// private String path; //////////LABELS////////////////// private JButton computere; private JButton parte; private JButton sounde; private JButton screene; private JButton misce; private JButton misc2e; private ImageIcon compImg; private ImageIcon partsImg; private JLabel computerLabel; private JLabel partsLabel; Screen() { setLayout(new GridLayout(2,2)); setSize(800,800); setTitle("Inventory"); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); iniVars(); addPanels(); } public void iniVars() { iniLabels(); iniImages(); iniButtons(); iniJpanels(); addToPanels(); } public void iniButtons() { computere = new JButton(compImg); parte = new JButton(partsImg); sounde = new JButton(); screene = new JButton(); misce = new JButton(); misc2e = new JButton(); computere.setPreferredSize(new Dimension(300,300)); parte.setPreferredSize(new Dimension(300,300)); } public void iniImages() { compImg = new ImageIcon("comp.jpg"); partsImg = new ImageIcon("harddrive.jpg"); } public void addToPanels() { computer.add(computere); parts.add(parte); } public void iniJpanels() { computer = new JPanel(); parts = new JPanel(); } public void iniLabels() { computerLabel = new JLabel("Computers"); partsLabel = new JLabel("Parts"); computerLabel.setPreferredSize(new Dimension(30,30)); partsLabel.setPreferredSize(new Dimension(30,30)); } public void addPanels() { add(computerLabel); add(partsLabel); add(computer); add(parts); pack(); } }//End of class Screen