How to add jzy3d chart to JFrame without making a new one?

后端 未结 1 838
野趣味
野趣味 2021-01-23 09:10

There is the following code for making jzy3d chart in JFrame:

public class SurfaceViewerFrame extends IconFrame {

    public SurfaceViewerFrame() {
        setR         


        
相关标签:
1条回答
  • 2021-01-23 09:33

    A CardLayout is well suited to this use. See How to Use CardLayout for details and working examples.

    Other strategies for combining data can be seen in/linked from this answer to "The Use of Multiple JFrames, Good/Bad Practice?".

    Update

    To flesh out that idea.

    • Don't extend frame, simply keep a reference to a panel.
    • Make the panel a GridLayout or BorderLayout (any single component added to either with no constraint, will be stretched to the available width & height).
    • Fill that panel much as you are doing in the code snippet above.
    • Add that panel to a card of a CardLayout in the main (and only) frame.
    • (If necessary) flip to that card.
    0 讨论(0)
提交回复
热议问题