Reputation: 514
I need to add a scrollable JPanel to a AWT frame that can scale when the frame is re-sized. The scrollpane appears when I set it a fixed size. But I need the panel to cover the whole frame and re-size automatically when I re-adjust the frame size.
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);
Upvotes: 1
Views: 138
Reputation: 285403
Upvotes: 2