Menu

#17 0.94 Nested Panel problem

closed-accepted
nobody
swing (3)
5
2003-12-15
2003-12-06
Anonymous
No

I am attempting to embed a chart into a larger
application built with swing. There is a high-level
JFrame, and within it are several JPanels. In one of
these JPanels, I am trying to display a ChartPanel.

Should it be possible to display a chart in a nested
JPanel, and not just in the highest level component?

One of three things usually happens: either the entire
JFrame reduces down to 0x0 pixels, or it comes up the
usual size but empty. The more interesting behavior is
that it will show up without drawing the chart, but if
I drag the chart off-screen and back on, the chart will
sometimes be partly visible under the panel it is
contained in (i.e. it is being drawn beneath its ancestor).

If I add a repaint() to the Frame's paint() method,
then I can get the chart to display in the proper
place, but once paint() finishes, the application goes
into a busy-wait loop (not updating anymore, and using
100% of the processor).

I can add the ChartPanel to the highest level component
and it draws fine. I can also create a new JFrame and
add it to that, and the new frame will show the chart
perfectly. It is only when I try to embed the chart
into a sub-panel that it fails.

Any ideas?

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Okay, answering my own post: it doesn't want to work with a
    JPanel, but it seems to work fine with a JInternalFrame. I
    ended up putting the JInternalFrame into a JPanel to keep
    the user from dragging the InternalFrame all over the place,
    and it seems to be fine.

    Not exactly what I was looking for, but close enough.

     
  • S. Müller

    S. Müller - 2003-12-15

    Logged In: YES
    user_id=138061

    The ChartPanel is known to be buggy. It's actually just a
    quick hack to test the not even completely implemented
    editable data model.

     
  • S. Müller

    S. Müller - 2003-12-15
    • status: open --> closed-accepted
     

Log in to post a comment.