Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot create image with swing backend: initImage is never called in the constructor #18

Open
MohamedLEGH opened this issue Dec 20, 2023 · 0 comments

Comments

@MohamedLEGH
Copy link

I have the following bug when I try to create an image :

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.awt.Graphics2D.getTransform()" because "this.g2" is null
        at org.graphstream.ui.swing.BackendJ2D.prepareNewFrame(BackendJ2D.java:107)
        at org.graphstream.ui.swing.SwingGraphRenderer.render(SwingGraphRenderer.java:223)
        at org.graphstream.ui.swing.util.SwingFileSinkImages.render(SwingFileSinkImages.java:70)
        at org.graphstream.stream.file.FileSinkImages.outputNewImage(FileSinkImages.java:548)
        at org.graphstream.stream.file.FileSinkImages.outputNewImage(FileSinkImages.java:515)

I think the problem is that the function initImage (that create g2d) is never called in the constructor:

https://github.com/graphstream/gs-ui-swing/blob/67888fae1f2bbc71b4d9ab50bdfd20e7ea391a67/src/org/graphstream/ui/swing/util/SwingFileSinkImages.java#L78C1-L82C3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant