My main dialog has gotten so cluttered with buttons. I thought it would be pretty cool to just add a tool bar with some of the buttons to the dialog.
I am currently using a image in a application toolbar to start my application. It is in Plugin.xml code
icon="icons/ediOrb.png"
So in my Dialog I am trying to use the same icon for my refreshButton
JToolBar toolbar = new JToolBar();
refreshButton = new JButton(new ImageIcon("icons/ediOrb.png"));
refreshButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
refreshTable();
}
});
toolbar.add(refreshButton);
centerPanel = new JPanel();
centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.PAGE_AXIS));
centerPanel.setPreferredSize(new Dimension(850, 450));
centerPanel.add(Box.createRigidArea(new Dimension(5, 0)));
centerPanel.add(currentPanel);
centerPanel.add(selectionsPanel);
centerPanel.add(Box.createHorizontalGlue());
centerPanel.add(Box.createRigidArea(new Dimension(0, 2)));
centerPanel.add(buttonPanel);
getContentPane().add(toolbar,BorderLayout.PAGE_START );
getContentPane().add(centerPanel);
There is no image showing for the button. It only shows a tiny spot. It is not throwing any errors, just does not show the image.
Any Ideas?
I had the same issue. In Netbeans I had to go to:
Run | Set Project Configuration | customize --
Then add the Working Directory path that contained my project and the icons. I'm not sure how to do this in a different IDE but my Icons showed up after this fix.