Bean only renders itself when inside a JFrame

From: Jon K Hellan <hellan@acm.org>
Date: Thu Dec 06 2001 - 16:26:02 EST

Hi

I wonder if this is happening to anybody else:

The SimpleMap demo works for me. It is a JFrame containing a MapBean.
But if I change the hierarchy like this:
    
 JFrame
   JPanel
     MapBean

the map isn't painted.

This is on Linux. Sun j2sdk1.4.0 and jdk1.3.1_01 behave in the same way.

Here's the diff from the 4.4.2 version:

--- orig/com/bbn/openmap/examples/simple/SimpleMap.java
+++ new/SimpleMap.java
@@ -23,10 +23,9 @@
  * **********************************************************************
  */
 
-package com.bbn.openmap.examples.simple;
-
 import java.util.Properties;
 import javax.swing.JFrame;
+import javax.swing.JPanel;
 
 import com.bbn.openmap.MapBean;
 import com.bbn.openmap.layer.shape.ShapeLayer;
@@ -74,7 +73,9 @@
         mapBean.add(shapeLayer);
 
         // Add the map to the frame
- frame.getContentPane().add(mapBean);
+ JPanel jp = new JPanel();
+ jp.add (mapBean);
+ frame.getContentPane().add(jp);
 
         // Display the frame
         frame.setVisible(true);

Needless to say, this isn't what I'm really trying to do, just a
minimal example to isolate the problem.

I thought this could be layout management trouble, but if I wrap
anything but a map bean in the JPanel, it is rendered properly.

Am I doing something wrong, or is there a bug here?

Jon

--
Jon Kåre Hellan -  Clustra AS - Trondheim, Norway
--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Dec 6 16:27:01 2001

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:32 EDT