changeset 3608:5a1a05d3a30b

IdealGraphVisualizer: prevent unnecessary updates of the text component when the current graph changes
author Peter Hofer <peter.hofer@jku.at>
date Wed, 02 Nov 2011 14:09:40 +0100
parents de066dcbf607
children e43bd78ca3a4
files src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponent.java
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponent.java	Mon Oct 31 21:06:04 2011 +0100
+++ b/src/share/tools/IdealGraphVisualizer/GraphTextEditor/src/com/sun/hotspot/igv/graphtexteditor/TextTopComponent.java	Wed Nov 02 14:09:40 2011 +0100
@@ -39,7 +39,6 @@
 import java.awt.BorderLayout;
 import java.awt.CardLayout;
 import java.awt.Color;
-import java.awt.Graphics;
 import java.awt.event.ComponentAdapter;
 import java.awt.event.ComponentEvent;
 import java.awt.event.ItemEvent;
@@ -213,7 +212,9 @@
         // Rebuild combobox choices
         Object selection = sourceCombo.getSelectedItem();
         sourceCombo.removeAllItems();
-        sourceCombo.addItem(GRAPH_TEXT_REPRESENTATION);
+        // NOTE: addItem() makes the first inserted item the selected item,
+        //       so use insertItemAt() instead
+        sourceCombo.insertItemAt(GRAPH_TEXT_REPRESENTATION, 0);
         if (diagram != null) {
             if (diagram.getGraph().getSourceGraphs() != null) {
                 // Diff graph with source graphs with possibly different groups: