]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/gui/UndoManager.java
Version 16, February 2014
[GpsPrune.git] / tim / prune / gui / UndoManager.java
index 5c3a992b431f0f7e9edcb65b8d6aa6b6728cc4b5..48307c1a1f9cc54d107462a7a68f4008d9d938a4 100644 (file)
@@ -28,11 +28,13 @@ public class UndoManager
 {
        private App _app;
        private JDialog _dialog;
-       private JList _actionList;
+       private JList<String> _actionList;
 
 
        /**
         * Constructor
+        * @param inApp App object
+        * @param inFrame parent frame
         */
        public UndoManager(App inApp, JFrame inFrame)
        {
@@ -42,15 +44,15 @@ public class UndoManager
                JPanel mainPanel = new JPanel();
                mainPanel.setLayout(new BorderLayout(3, 3));
                mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
-               Stack undoStack = inApp.getUndoStack();
+               Stack<UndoOperation> undoStack = inApp.getUndoStack();
                mainPanel.add(new JLabel(I18nManager.getText("dialog.undo.pretext")), BorderLayout.NORTH);
 
                String[] undoActions = new String[undoStack.size()];
                for (int i=0; i<undoStack.size(); i++)
                {
-                       undoActions[i] = ((UndoOperation) undoStack.elementAt(undoStack.size()-1-i)).getDescription();
+                       undoActions[i] = undoStack.elementAt(undoStack.size()-1-i).getDescription();
                }
-               _actionList = new JList(undoActions);
+               _actionList = new JList<String>(undoActions);
                _actionList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
                _actionList.setSelectedIndex(0);
                _actionList.addListSelectionListener(new ListSelectionListener()
@@ -67,7 +69,7 @@ public class UndoManager
                // Buttons
                JPanel buttonPanel = new JPanel();
                buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
-               JButton okButton = new JButton("OK");
+               JButton okButton = new JButton(I18nManager.getText("button.ok"));
                okButton.addActionListener(new ActionListener()
                        {
                                public void actionPerformed(ActionEvent e)
@@ -77,7 +79,7 @@ public class UndoManager
                                }
                        });
                buttonPanel.add(okButton);
-               JButton cancelButton = new JButton("Cancel");
+               JButton cancelButton = new JButton(I18nManager.getText("button.cancel"));
                cancelButton.addActionListener(new ActionListener()
                        {
                                public void actionPerformed(ActionEvent e)
@@ -89,7 +91,7 @@ public class UndoManager
                mainPanel.add(buttonPanel, BorderLayout.SOUTH);
                _dialog.getContentPane().add(mainPanel);
                _dialog.pack();
-               _dialog.show();
+               _dialog.setVisible(true);
        }
 
 }