Code example for JScrollPane

Methods: getMinimumSizesetPreferredSize

0
    private Component createRegExpPanel() {
        JPanel panel = new JPanel(new BorderLayout(5, 5));
        panel.setBorder(BorderFactory.createTitledBorder("Regular Expressions Data Extractor"));
        panel.setPreferredSize(new Dimension(150, 150));
 
        JScrollPane scroll = new JScrollPane(createGrid());
        scroll.setPreferredSize(scroll.getMinimumSize());
        panel.add(scroll, BorderLayout.CENTER);
        panel.add(new ButtonPanelAddCopyRemove(grid, tableModel, defaultValues), BorderLayout.SOUTH);
 
        return panel;
    } 
 
    @Override 
    protected JPanel getGraphPanelContainer() {
        JPanel panel = new JPanel(new BorderLayout());
        JPanel innerTopPanel = new JPanel(new BorderLayout());
 
        innerTopPanel.add(createRegExpPanel(), BorderLayout.CENTER);
        innerTopPanel.add(getFilePanel(), BorderLayout.SOUTH);
Experience pair programming with AI  Get Codota for Java