我的主對話框變得雜亂無章。我認爲只需在對話框中添加一些帶有按鈕的工具欄就會很酷。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