Commit 3dc0a5ff authored by Vincent van Beveren's avatar Vincent van Beveren

added icons to edit pane toolbar

parent 710ff2f6
......@@ -3,17 +3,22 @@ package nl.nikhef.safaripark.editpane;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;
import nl.nikhef.safaripark.ContextCache;
import nl.nikhef.safaripark.res.Resources;
import nl.nikhef.sfp.SFPDevice;
import nl.nikhef.sfp.ddmi.DDMI;
import nl.nikhef.sfp.ddmi.DDMIContext;
......@@ -28,7 +33,7 @@ public class EditPane extends JPanel {
private JToolBar _tbar;
private EditorContext _ctx;
private Action _apply = new AbstractAction("Apply") {
private Action _apply = new AbstractAction("Apply", Resources.getIcon("dialog-apply")) {
@Override
public void actionPerformed(ActionEvent e) {
......@@ -38,7 +43,7 @@ public class EditPane extends JPanel {
};
private Action _revert = new AbstractAction("Revert") {
private Action _revert = new AbstractAction("Revert", Resources.getIcon("dialog-cancel")) {
@Override
public void actionPerformed(ActionEvent e) {
......@@ -63,9 +68,20 @@ public class EditPane extends JPanel {
_apply.setEnabled(false);
_revert.setEnabled(false);
_tbar.add(_apply).setBorder(BorderFactory.createEmptyBorder(4,4,4,4));
_tbar.add(_revert).setBorder(BorderFactory.createEmptyBorder(4,4,4,4));
//_tbar.set
List<JButton> buttons = new ArrayList<JButton>();
buttons.add(_tbar.add(_apply));
buttons.add(_tbar.add(_revert));
for (JButton but : buttons) {
but.setBorder(BorderFactory.createEmptyBorder(4,4,4,4));
but.setHideActionText(false);
but.setHorizontalTextPosition(SwingConstants.TRAILING);
but.setVerticalTextPosition(SwingConstants.CENTER);
}
add(_tbar, BorderLayout.NORTH);
_tab = new JTabbedPane();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment