我的主对话框中的按钮变得如此混乱。我认为在对话框中添加一个带有一些按钮的工具栏会很酷。
我目前正在使用应用程序工具栏中的图像来启动我的应用程序。它在 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);
该按钮没有显示图像。它只显示一个小点。它没有抛出任何错误,只是不显示图像。
有任何想法吗?