public static void main(String[] args) { DesktopApplicationContext.main(ScriptApplication.class, args); }
/** * Terminates the application context. * this call is the same as exit(true) */ public static void exit() { exit(true); }
@Override public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_F && (keyEvent.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) > 0 && (keyEvent.getModifiersEx() & KeyEvent.SHIFT_DOWN_MASK) > 0) { setFullScreen(!isFullScreen()); } } });
createTimer(); windowedHostFrame.setResizable(resizable); Rectangle screenSize = getVirtualDesktopBounds(); if (center) { initializeOSExtensions(); setFullScreen(fullScreen, visible); queueCallback(new Runnable() { @Override public void run() {
/** * Sizes the window's native host frame to match its preferred size. * * @param window */ public static void sizeHostToFit(Window window) { if (window == null) { throw new IllegalArgumentException(); } if (isFullScreen()) { throw new IllegalStateException(); } Dimensions size = window.getPreferredSize(); java.awt.Window hostWindow = window.getDisplay().getHostWindow(); java.awt.Insets frameInsets = hostWindow.getInsets(); hostWindow.setSize(size.width + (frameInsets.left + frameInsets.right), size.height + (frameInsets.top + frameInsets.bottom)); }
/** * Sets the full-screen mode flag. * * @param fullScreen */ public static void setFullScreen(boolean fullScreen) { setFullScreen(fullScreen, true); }
private boolean isOptimizeScrolling() { boolean optimizeScrollingLocal = this.optimizeScrolling; if (optimizeScrollingLocal) { // Due to Sun bug #6293145, we cannot call copyArea if scaling is // applied to the graphics context. // Due to Sun bug #4033851, we cannot call copyArea if the display // host is obscured. For a full description of why this is the case, // see http://people.apache.org/~tvolkert/tests/scrolling/ ScrollPane scrollPane = (ScrollPane)getComponent(); ApplicationContext.DisplayHost displayHost = scrollPane.getDisplay().getDisplayHost(); optimizeScrollingLocal = (displayHost.getScale() == 1 && (DesktopApplicationContext.isActive() && displayHost.isDisplayable())); } return optimizeScrollingLocal; }
cancelShutdown = application.shutdown(optional); } catch(Exception exception) { displayException(exception);
createTimer(); initializeOSExtensions(); setFullScreen(fullScreen, visible); queueCallback(new Runnable() { @Override public void run() {
/** * Sizes the window's native host frame to match its preferred size. * * @param window */ public static void sizeHostToFit(Window window) { if (window == null) { throw new IllegalArgumentException(); } if (isFullScreen()) { throw new IllegalStateException(); } Dimensions size = window.getPreferredSize(); java.awt.Window hostWindow = window.getDisplay().getHostWindow(); java.awt.Insets frameInsets = hostWindow.getInsets(); hostWindow.setSize(size.width + (frameInsets.left + frameInsets.right), size.height + (frameInsets.top + frameInsets.bottom)); }
/** * Sets the full-screen mode flag. * * @param fullScreen */ public static void setFullScreen(boolean fullScreen) { setFullScreen(fullScreen, true); }
@SuppressWarnings("deprecation") private boolean isOptimizeScrolling() { boolean optimizeScrolling = this.optimizeScrolling; if (optimizeScrolling) { // Due to Sun bug #6293145, we cannot call copyArea if scaling is // applied to the graphics context. // Due to Sun bug #4033851, we cannot call copyArea if the display // host is obscured. For a full description of why this is the case, // see http://people.apache.org/~tvolkert/tests/scrolling/ ScrollPane scrollPane = (ScrollPane)getComponent(); ApplicationContext.DisplayHost displayHost = scrollPane.getDisplay().getDisplayHost(); optimizeScrolling = (displayHost.getScale() == 1 && (DesktopApplicationContext.isActive() || (displayHost.getPeer().canDetermineObscurity() && !displayHost.getPeer().isObscured()))); } return optimizeScrolling; }
public static void main(String[] args) { DesktopApplicationContext.main(ScriptApplication.class, args); } }
@Override public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_F && (keyEvent.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) > 0 && (keyEvent.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) > 0) { setFullScreen(!isFullScreen()); } } });
/** * Terminates the application context. * this call is the same as exit(true) */ public static void exit() { exit(true); }
boolean resizable, boolean undecorated, java.awt.Window owner, DisplayListener displayCloseListener) { if (isFullScreen()) { throw new IllegalStateException();
private static void doRun(final String[] args) { SwingUtilities.invokeLater(() -> DesktopApplicationContext.main(DesktopPivotGriffonApplication.class, args)); } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { boolean handled = true; String methodName = method.getName(); if (methodName.equals("handleAbout")) { Application.AboutHandler aboutHandler = (Application.AboutHandler)application; aboutHandler.aboutRequested(); } else if (methodName.equals("handleQuit")) { handled = !exit(true); } // Invoke setHandled() setHandledMethod.invoke(args[0], new Object[] {handled}); return null; } };
boolean resizable, boolean undecorated, java.awt.Window owner, DisplayListener displayCloseListener) { if (isFullScreen()) { throw new IllegalStateException();
/** * Utility method to make it easier to define <tt>main()</tt> entry-points * into applications. For example: * * <code> * public class MyApp implements Application { * public static void main(String[] args) throws Exception { * DesktopApplicationContext.main(MyApp.class, args); * } * } * </code> * * @param applicationClass * @param applicationArgs */ public static final void main(Class<? extends Application> applicationClass, String[] applicationArgs) { String[] args = new String[applicationArgs.length + 1]; System.arraycopy(applicationArgs, 0, args, 1, applicationArgs.length); args[0] = applicationClass.getName(); main(args); }