I have a problem with my tabs:
JTabbedPane tab = new JTabbedPane(); frame.add(tab, BorderLayout.CENTER); JPanel contact = new JPanel(); contact.add(backgroundContact); tab.add("Contacto", contact); //tab.addTab("Contacto",new ImageIcon("images/image2.gif"), contact,""); JPanel schedule = new JPanel(); schedule.add(backgroundSchedule); tab.add("Horario", schedule); //tab.addTab("Horario", new ImageIcon("images/image2.gif"), schedule,""); JPanel cost = new JPanel(); cost.add(backgroundCost); tab.add("Tarifas", cost); //tab.addTab("Tarifas", new ImageIcon("images/image3.gif"), cost,""); // Los iconos tab.setIconAt(0, new ImageIcon("images/image1.gif")); tab.setIconAt(1, new ImageIcon("images/image2.gif")); tab.setIconAt(2, new ImageIcon("images/image3.gif"));
I tried both options, but the icons are not showing. Why is this happening?
I also tried: new ImageIcon("images/im.gif")
, which does not exist and I have some kind of error
source share