Swing scrollbar does not work

This code works if you put monkey,png to Interface file.
however, the scrollbar inside does not and I don’t know why
can anyone help me? thanks.

[java]package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeCanvasContext;
import com.jme3.ui.Picture;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;

public class Main extends SimpleApplication {

public Main() {
}
static JmeCanvasContext ctx;
static Main canvasApplication;
JScrollPane scroll;

public static void main(String[] args) {
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            AppSettings settings = new AppSettings(true);
            canvasApplication = new Main();
            canvasApplication.setSettings(settings);
            canvasApplication.createCanvas(); // create canvas!
            canvasApplication.setDisplayFps(false);
            canvasApplication.setShowSettings(false);
            canvasApplication.setDisplayStatView(false);
            ctx = (JmeCanvasContext) canvasApplication.getContext();
            ctx.setSystemListener(canvasApplication);
            Dimension dim = new Dimension(800, 600);
            ctx.getCanvas().setPreferredSize(dim);
            canvasApplication.initComponents();
        }
    });
}

@Override
public void simpleInitApp() {
    // activate windowed input behaviour
    flyCam.setDragToRotate(true);
    // display a cube
    Picture p = new Picture("background");
    p.setWidth(1920);
    p.setHeight(1080);
    p.setImage(assetManager, "Interface/Monkey.png", false);
    guiNode.attachChild(p);
}

private void initComponents() {
    JLabel jLabel1 = new JLabel();
    jLabel1.setText("Alpha");
    JFrame frame = new JFrame("Test");
    JPanel panel = new JPanel();
    JPanel panel2 = new JPanel();
    panel2.add(ctx.getCanvas());
    panel.add(jLabel1);
    frame.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.NORTHEAST;
    int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
    int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
    JScrollPane jsp = new JScrollPane(ctx.getCanvas(), v, h);
    frame.add(jsp);
    frame.add(panel2);
    frame.add(panel, gbc);
    frame.pack();
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    canvasApplication.startCanvas();
}

}[/java]

Do you see the scrollbars if you don’t put the canvas inside it?
I.e. leave out ctx.getCanvas() in line 69.

Pressing Ctrl-Shift-F1 will dump the control hierarchy of the current window. That should tell you whether the scroll bars are created at all, whether they are made visible, and whether they are placed inside or outside the visible areas.