Component.getGraphics()"Creates a graphics context for this component. This method will return null if this component is currently not displayable."
Component.isDisplayable()"... A component is made displayable either when it is added to a displayable containment hierarchy or when its containment hierarchy is made displayable. A containment hierarchy is made displayable when its ancestor window is either packed or made visible.....A containment hierarchy is made undisplayable when its ancestor window is disposed."
Component.setVisible(boolean)"Shows or hides this component depending on the value of parameter b."
Window.dispose()"Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable."
Ergo, getGraphics() when invoked on a Window / Frame that has had setVisible(true) / show() called on it will never return null, until dispose() is called on the Window / Frame.
What is with all this talk of ultra-defensive programming!
We're talking about 4K games here
