注意:这个问题是这个问题的后续问题。
我刚刚从上一个问题中了解到以下内容:
JPanelhas (具有与 from ! on resizeFLowLayout相同的输出),仅接受, child 不能通过其容器调整大小,需要使用/用于简单图形NullLayoutPreferredSizeBorderLayoutGridLayout
还给出了该原理的演示:
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import org.math.plot.Plot2DPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import org.math.plot.Plot2DPanel;
public class MyPlot {
    private JFrame frame = new JFrame("JMathPlot library in a swing application.");
    private JPanel panel = new JPanel();
    public MyPlot() {
        double[] x = new double[]{0, 1, 2, 3, 4, 5};
        double[] y = new double[]{10, 11, 12, 14, 15, 16};
        Plot2DPanel plot = new Plot2DPanel() {
            @Override
            public Dimension getPreferredSize() {
                return new Dimension(400, 200);
            }
        };
        plot.addLinePlot("my plot", x, y); // add a line plot to the PlotPanel
        panel.setLayout(new BorderLayout());
        panel.add(plot);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(panel);
        frame.pack();
        frame.setLocation(150, 150);
        frame.setVisible(true);
    }
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new MyPlot();
            }
        });
    }
}
现在我想要实现的是将图形集成到 aparent JPanel中以在我的摇摆应用程序中使用它。
对此的可视化将是:

如何在我的“父”JPanel 中实现图形而不违反使其正常工作的约束?
(我查看了JInternalFrame但无法为我的问题提出正确的实现)
如果 JInternalFrame 确实是解决方案,我应该如何使用它?(请提供代码)