我的主对话框变得杂乱无章。我认为只需在对话框中添加一些带有按钮的工具栏就会很酷。JToolBar - JButton - 图像没有显示
我目前在应用程序工具栏中使用图像来启动我的应用程序。这是在plugin.xml的代码
icon="icons/ediOrb.png"
所以在我的对话,我尝试使用相同的图标为我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);
有表示按钮没有图像。它只显示一个小点。它不会抛出任何错误,只是不显示图像。
任何想法?
你确定图像可以在那个位置找到? – Robin 2012-07-23 16:47:45