]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/gui/UndoManager.java
Version 7, February 2009
[GpsPrune.git] / tim / prune / gui / UndoManager.java
index 5c3a992b431f0f7e9edcb65b8d6aa6b6728cc4b5..1b77fe151136ea8254f60622639a6823ec2c2bd9 100644 (file)
@@ -33,6 +33,8 @@ public class UndoManager
 
        /**
         * Constructor
+        * @param inApp App object
+        * @param inFrame parent frame
         */
        public UndoManager(App inApp, JFrame inFrame)
        {
@@ -42,13 +44,13 @@ 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.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
@@ -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);
        }
 
 }