/[classpath]/classpath/javax/swing/Popup.java
ViewVC logotype

Diff of /classpath/javax/swing/Popup.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.2 by gnu_andrew, Wed Nov 2 00:43:48 2005 UTC revision 1.2.2.3 by gnu_andrew, Sun Nov 27 21:00:38 2005 UTC
# Line 39  exception statement from your version. * Line 39  exception statement from your version. *
39  package javax.swing;  package javax.swing;
40    
41  import java.awt.Component;  import java.awt.Component;
42    import java.awt.FlowLayout;
43  import java.awt.Point;  import java.awt.Point;
44    
45    
# Line 224  public class Popup Line 225  public class Popup
225       * The panel that holds the content.       * The panel that holds the content.
226       */       */
227      private JPanel panel;      private JPanel panel;
228        
229        /**
230         * The layered pane of the owner.
231         */
232        private JLayeredPane layeredPane;
233        
234      /**      /**
235       * Constructs a new <code>LightweightPopup</code> given its owner,       * Constructs a new <code>LightweightPopup</code> given its owner,
236       * contents and the screen position where the popup       * contents and the screen position where the popup
# Line 252  public class Popup Line 258  public class Popup
258        this.contents = contents;        this.contents = contents;
259        this.x = x;        this.x = x;
260        this.y = y;        this.y = y;
261          
262          JRootPane rootPane = SwingUtilities.getRootPane(owner);
263          JLayeredPane layeredPane = rootPane.getLayeredPane();
264          this.layeredPane = layeredPane;
265      }      }
266    
267      /**      /**
# Line 260  public class Popup Line 270  public class Popup
270       */       */
271      public void show()      public void show()
272      {      {
       JRootPane rootPane = SwingUtilities.getRootPane(owner);  
       JLayeredPane layeredPane = rootPane.getLayeredPane();  
273        // We insert a JPanel between the layered pane and the contents so we        // We insert a JPanel between the layered pane and the contents so we
274        // can fiddle with the setLocation() method without disturbing a        // can fiddle with the setLocation() method without disturbing a
275        // JPopupMenu (which overrides setLocation in an unusual manner).        // JPopupMenu (which overrides setLocation in an unusual manner).
276        if (panel == null)        if (panel == null)
277          {          {
278            panel = new JPanel();            panel = new JPanel();
279            panel.setLayout(null);            panel.setLayout(new FlowLayout(0, 0, 0));
280          }          }
281          
282        panel.add(contents);        panel.add(contents);
283        panel.setSize(contents.getSize());        panel.setSize(contents.getSize());
284        Point layeredPaneLoc = layeredPane.getLocationOnScreen();        Point layeredPaneLoc = layeredPane.getLocationOnScreen();
# Line 282  public class Popup Line 291  public class Popup
291       */       */
292      public void hide()      public void hide()
293      {      {
       JRootPane rootPane = SwingUtilities.getRootPane(owner);  
       JLayeredPane layeredPane = rootPane.getLayeredPane();  
294        layeredPane.remove(panel);        layeredPane.remove(panel);
295      }      }
296    }    }

Legend:
Removed from v.1.2.2.2  
changed lines
  Added in v.1.2.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26