Example usage for javafx.stage Screen equals

List of usage examples for javafx.stage Screen equals

Introduction

In this page you can find the example usage for javafx.stage Screen equals.

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.openbase.display.DisplayView.java

private Screen getScreen() {
    try {/* ww w .j a v  a2 s .c  o m*/

        // setup display property
        JPOutput.Display display;
        try {
            display = JPService.getProperty(JPOutput.class).getValue();
        } catch (JPServiceException ex) {
            ExceptionPrinter.printHistory(new CouldNotPerformException(
                    "Could not detect output property! Try to use default display.", ex), logger);
            display = JPOutput.Display.PRIMARY;
        }

        // select screen
        switch (display) {
        case PRIMARY:
            return Screen.getPrimary();
        case SECONDARY:
            for (Screen screen : Screen.getScreens()) {
                if (!screen.equals(Screen.getPrimary())) {
                    return screen;
                }
            }
            throw new NotAvailableException(Screen.class, JPOutput.Display.SECONDARY.name());
        default:
            return Screen.getScreens().get(display.getId());
        }
    } catch (Exception ex) {
        ExceptionPrinter.printHistory(
                new CouldNotPerformException("Could not detect display! Use display 0 instead.", ex), logger);
        return Screen.getScreens().get(0);
    }
}