Question

How to add the button to the left of the name of graphics in that area marked by red color?

enter image description here

    chartPanel.setDomainZoomable(false);
    chartPanel.setRangeZoomable(false);
    chartPanel.setPopupMenu(null);
    frame = new JFrame(Title);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(chartPanel);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
Was it helpful?

Solution

To facilitate use on a headless server, a JFreeChart is not a Swing JComponent. The typical Swing approach is to enclose the chart in a ChartPanel and add the panel to a suitable layout. Add controls to to an adjacent panel, as shown here and here using BorderLayout.SOUTH.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top