Skip to content
Advertisement

Creating a XYChart on button click

The purpose of the program is to display chart on click of the button with given parameters.

JavaScript

However displayChart uses invokeAndWait, which cannot be executed inside ActionListener which makes sense. What is the proper way to solve this issue?

I am using swing with XChart library

Advertisement

Answer

You have to create the frame and its content panel by yourself, note that using multiple frames in an application is in general a bad idea, so consider a different design for your UI (e.g. tabbed pane).

Sample code, only displayChart(...) is relevant for you but I always prefer to create a runnable example:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement