I would like to have a GUI setup like the diagram below.
The JLayeredPane
should always be the same size, but the JPanel
and the JScrollPane
can change in size. I need the JScrollPane
to be able to display the JLayedPane
by clicking the arrows and what not if the JPanel
and JScrollPane
are not large enough to show the entire JLayeredPane
.
The problem is that with the code below, the JLayeredPane
always expands to fit the size of the JScrollPane
and in the event that the JScrollPane
is smaller than the JLayeredPane
, it does not provide the scrolling ability.
Any Ideas on what is going on? Is there simpler code to achieve this?
Thanks
contentPanePanel = new javax.swing.JPanel();
contentPaneScollPane = new javax.swing.JScrollPane();
contentPane = new javax.swing.JLayeredPane();
contentPanePanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
contentPane.setRequestFocusEnabled(false);
contentPane.setVerifyInputWhenFocusTarget(false);
contentPaneScollPane.setViewportView(contentPane);
javax.swing.GroupLayout contentPanePanelLayout = new javax.swing.GroupLayout(contentPanePanel);
contentPanePanel.setLayout(contentPanePanelLayout);
contentPanePanelLayout.setHorizontalGroup(
contentPanePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(contentPaneScollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 968, Short.MAX_VALUE)
);
contentPanePanelLayout.setVerticalGroup(
contentPanePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(contentPaneScollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 628, Short.MAX_VALUE)
);