我需要将一个可滚动的JPanel添加到AWT帧中,该帧可以在重新调整帧时进行缩放。当我将其设置为固定大小时,会出现滚动窗格。但是当我重新调整框架尺寸时,我需要面板覆盖整个框架并自动重新调整尺寸。
Composite composite = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
Frame frame = SWT_AWT.new_Frame(composite);
SimulationPanel simPanel= new SimulationPanel(WIDTH,simPanelTotalHeight);
JScrollPane scrollPane = new JScrollPane(simPanel);
scrollPane.setSize(new Dimension(500,400));
JPanel contentPane = new JPanel(null);
contentPane.add(scrollPane);
frame.add(contentPane);
答案 0 :(得分:2)