[tiled] r659 - in trunk: . src/tiled/mapeditor/dialogs

svn@biggeruniverse.com svn at biggeruniverse.com
Mon Jun 5 14:52:04 PDT 2006


Author: bjorn
Date: 2006-06-05 16:52:04 -0500 (Mon, 05 Jun 2006)
New Revision: 659

Modified:
   trunk/CHANGES
   trunk/src/tiled/mapeditor/dialogs/AboutDialog.java
Log:
Added button to collect garbage to the about dialog.

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2006-06-05 21:06:20 UTC (rev 658)
+++ trunk/CHANGES	2006-06-05 21:52:04 UTC (rev 659)
@@ -25,7 +25,7 @@
 * Added more useful visual feedback for some brushes
 * Added remembering of main window state as suggested by Dennis Spreen
 * Added remembering of size and divider position to tile palette dialog
-* Added display of memory usage to the about dialog
+* Added memory usage display and a garbage collect button to the about dialog
 * Improved memory usage and speed in several areas
 * Fixed new tileset dialog so that it is now possible to change the tile height
   to something other than the tile height used by the map

Modified: trunk/src/tiled/mapeditor/dialogs/AboutDialog.java
===================================================================
--- trunk/src/tiled/mapeditor/dialogs/AboutDialog.java	2006-06-05 21:06:20 UTC (rev 658)
+++ trunk/src/tiled/mapeditor/dialogs/AboutDialog.java	2006-06-05 21:52:04 UTC (rev 659)
@@ -14,11 +14,12 @@
 
 import java.awt.Component;
 import java.awt.Dimension;
+import java.awt.Color;
 import java.awt.event.MouseEvent;
+import java.awt.event.ActionEvent;
 import java.util.Timer;
 import java.util.TimerTask;
 import javax.swing.*;
-import javax.swing.border.CompoundBorder;
 import javax.swing.event.MouseInputAdapter;
 
 import tiled.mapeditor.MapEditor;
@@ -54,27 +55,38 @@
     }
 
     private JPanel createMainPanel() {
-        JLabel label = new JLabel(Resources.getIcon("logo.png"));
-        label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
-        label.setAlignmentX(Component.LEFT_ALIGNMENT);
+        JLabel logo = new JLabel(Resources.getIcon("logo.png"));
+        logo.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+        logo.setAlignmentX(Component.LEFT_ALIGNMENT);
 
         JSeparator separator = new JSeparator();
         separator.setAlignmentX(Component.LEFT_ALIGNMENT);
 
         memoryBar = new JProgressBar();
-        memoryBar.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5),
-                                               memoryBar.getBorder()));
-        memoryBar.setMaximumSize(new Dimension(label.getPreferredSize().width,
-                                               Short.MAX_VALUE));
-        memoryBar.setAlignmentX(Component.LEFT_ALIGNMENT);
         memoryBar.setStringPainted(true);
 
+        JButton gcButton = new JButton(new GarbageCollectAction());
+        gcButton.setBorderPainted(false);
+        gcButton.setBorder(null);
+        gcButton.setOpaque(false);
+        gcButton.setBackground(new Color(0, 0, 0, 0));
+
+        JPanel barPanel = new JPanel();
+        barPanel.setLayout(new BoxLayout(barPanel, BoxLayout.X_AXIS));
+        barPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+        barPanel.setMaximumSize(new Dimension(logo.getPreferredSize().width,
+                                              Short.MAX_VALUE));
+        barPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
+        barPanel.add(memoryBar);
+        barPanel.add(Box.createRigidArea(new Dimension(5, 5)));
+        barPanel.add(gcButton);
+
         JPanel mainPanel = new JPanel();
         mainPanel.setOpaque(false);
         mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
-        mainPanel.add(label);
+        mainPanel.add(logo);
         mainPanel.add(separator);
-        mainPanel.add(memoryBar);
+        mainPanel.add(barPanel);
         return mainPanel;
     }
 
@@ -109,4 +121,18 @@
             }
         }
     }
+
+    /**
+     * Collects garbage.
+     */
+    private class GarbageCollectAction extends AbstractAction
+    {
+        public GarbageCollectAction() {
+            putValue(Action.SMALL_ICON, Resources.getIcon("gnome-delete.png"));
+        }
+
+        public void actionPerformed(ActionEvent actionEvent) {
+            System.gc();
+        }
+    }
 }




More information about the tiled-commit mailing list