JComponent () { JPanel content = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.fill = GridBagConstraints.VERTICAL; myVerticalCaption = createCaptionPanel(false); content.add(myVerticalCaption, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; myHorizontalCaption = createCaptionPanel(true); content.add(myHorizontalCaption, gbc); gbc.gridx = 1; gbc.gridy = 1; gbc.weightx = 1; gbc.weighty = 1; gbc.fill = GridBagConstraints.BOTH; content.add(myScrollPane, gbc); myHorizontalCaption.attachToScrollPane(myScrollPane); myVerticalCaption.attachToScrollPane(myScrollPane); return content; }