Code example for JScrollPane

Methods: setPreferredSize

0
        this.initializeTableModel();
        files = new JTable(tableModel);
        files.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        files.revalidate();
 
        JScrollPane scrollpane = new JScrollPane(files);
        scrollpane.setPreferredSize(new Dimension(100,80));
        add(scrollpane,BorderLayout.CENTER);
 
        browse.setActionCommand(ACTION_BROWSE); // $NON-NLS-1$
        browse.addActionListener(this);
        clear.addActionListener(this);
        delete.addActionListener(this);
        //this.setPreferredSize(new Dimension(400,150)); 
    } 
 
    /** 
     * If the gui needs to enable/disable the FilePanel, call the method. 
     * 
     * @param enable Flag whether FilePanel should be enabled