Code example for JScrollPane

0
    public ChartFrame(String title, JFreeChart chart, boolean scrollPane) {
        super(title);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.chartPanel = new ChartPanel(chart);
        if (scrollPane) {
            setContentPane(new JScrollPane(this.chartPanel));
        } 
        else { 
            setContentPane(this.chartPanel);
        } 
    } 
 
    /** 
     * Returns the chart panel for the frame. 
     * 
     * @return The chart panel. 
     */ 
    public ChartPanel getChartPanel() { 
        return this.chartPanel;
    } 
Experience pair programming with AI  Get Codota for Java