I am using the Draw.java class from the Princeton library for a small graphics program. Currently it runs in a window. I want to make it scaleable and full-screen. How can I achieve that? I looked into Full-Screen Exclusive Mode but am not quite sure on how to use it. I tried adding it into my program, but I can't seem to link the Draw-Window to the Full-Screen Frame, which leads to one window with the program and a blank full screen opening. I don't want to change my entire code using the Draw class unless it is necessary. Any ideas on how to make the Draw-Window Full-Screen?
Here is a code sample although I don't think it'll help much:
Draw draw = new Draw("TapReact");
int canvasWidth = 1350;
int canvasHeight = 800;
draw.setCanvasSize(canvasWidth, canvasHeight);
And and example for a full-screen implementation with Full-Screen Exclusive Mode:
GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();
Window myWindow = new Window(new Frame());
graphicsDevice.setFullScreenWindow(myWindow);
How can I link
myWindow
and draw
, so that both display the same thing?
Help would be much appreciated, thank you.
Edit: I Already tried implementing a getFrame()
method in Draw.java
and using that frame with new Window(draw.getFrame())
. I also tried implementing a setFullScreen()
method in Draw.java
which also didn't work.