List of usage examples for javafx.scene.input KeyCombination ALT_DOWN
Modifier ALT_DOWN
To view the source code for javafx.scene.input KeyCombination ALT_DOWN.
Click Source Link
From source file:io.bitsquare.app.BitsquareApp.java
@Override public void start(Stage stage) throws IOException { BitsquareApp.primaryStage = stage;/* ww w. j a v a 2 s. c o m*/ String logPath = Paths.get(env.getProperty(AppOptionKeys.APP_DATA_DIR_KEY), "bitsquare").toString(); Log.setup(logPath); log.info("Log files under: " + logPath); Version.printVersion(); Utilities.printSysInfo(); Log.setLevel(Level.toLevel(env.getRequiredProperty(CommonOptionKeys.LOG_LEVEL_KEY))); UserThread.setExecutor(Platform::runLater); UserThread.setTimerClass(UITimer.class); shutDownHandler = this::stop; // setup UncaughtExceptionHandler Thread.UncaughtExceptionHandler handler = (thread, throwable) -> { // Might come from another thread if (throwable.getCause() != null && throwable.getCause().getCause() != null && throwable.getCause().getCause() instanceof BlockStoreException) { log.error(throwable.getMessage()); } else if (throwable instanceof ClassCastException && "sun.awt.image.BufImgSurfaceData cannot be cast to sun.java2d.xr.XRSurfaceData" .equals(throwable.getMessage())) { log.warn(throwable.getMessage()); } else { log.error("Uncaught Exception from thread " + Thread.currentThread().getName()); log.error("throwableMessage= " + throwable.getMessage()); log.error("throwableClass= " + throwable.getClass()); log.error("Stack trace:\n" + ExceptionUtils.getStackTrace(throwable)); throwable.printStackTrace(); UserThread.execute(() -> showErrorPopup(throwable, false)); } }; Thread.setDefaultUncaughtExceptionHandler(handler); Thread.currentThread().setUncaughtExceptionHandler(handler); try { Utilities.checkCryptoPolicySetup(); } catch (NoSuchAlgorithmException | LimitedKeyStrengthException e) { e.printStackTrace(); UserThread.execute(() -> showErrorPopup(e, true)); } Security.addProvider(new BouncyCastleProvider()); try { // Guice bitsquareAppModule = new BitsquareAppModule(env, primaryStage); injector = Guice.createInjector(bitsquareAppModule); injector.getInstance(InjectorViewFactory.class).setInjector(injector); Version.setBtcNetworkId(injector.getInstance(BitsquareEnvironment.class).getBitcoinNetwork().ordinal()); if (Utilities.isLinux()) System.setProperty("prism.lcdtext", "false"); Storage.setDatabaseCorruptionHandler((String fileName) -> { corruptedDatabaseFiles.add(fileName); if (mainView != null) mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles); }); // load the main view and create the main scene CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class); mainView = (MainView) viewLoader.load(MainView.class); mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles); /* Storage.setDatabaseCorruptionHandler((String fileName) -> { corruptedDatabaseFiles.add(fileName); if (mainView != null) mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles); });*/ scene = new Scene(mainView.getRoot(), 1200, 700); //740 Font.loadFont(getClass().getResource("/fonts/Verdana.ttf").toExternalForm(), 13); Font.loadFont(getClass().getResource("/fonts/VerdanaBold.ttf").toExternalForm(), 13); Font.loadFont(getClass().getResource("/fonts/VerdanaItalic.ttf").toExternalForm(), 13); Font.loadFont(getClass().getResource("/fonts/VerdanaBoldItalic.ttf").toExternalForm(), 13); scene.getStylesheets().setAll("/io/bitsquare/gui/bitsquare.css", "/io/bitsquare/gui/images.css", "/io/bitsquare/gui/CandleStickChart.css"); // configure the system tray SystemTray.create(primaryStage, shutDownHandler); primaryStage.setOnCloseRequest(event -> { event.consume(); stop(); }); scene.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> { if (new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN).match(keyEvent) || new KeyCodeCombination(KeyCode.W, KeyCombination.CONTROL_DOWN).match(keyEvent)) { stop(); } else if (new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN).match(keyEvent) || new KeyCodeCombination(KeyCode.Q, KeyCombination.CONTROL_DOWN).match(keyEvent)) { stop(); } else if (new KeyCodeCombination(KeyCode.E, KeyCombination.SHORTCUT_DOWN).match(keyEvent) || new KeyCodeCombination(KeyCode.E, KeyCombination.CONTROL_DOWN).match(keyEvent)) { showEmptyWalletPopup(); } else if (new KeyCodeCombination(KeyCode.M, KeyCombination.ALT_DOWN).match(keyEvent)) { showSendAlertMessagePopup(); } else if (new KeyCodeCombination(KeyCode.F, KeyCombination.ALT_DOWN).match(keyEvent)) { showFilterPopup(); } else if (new KeyCodeCombination(KeyCode.F, KeyCombination.ALT_DOWN).match(keyEvent)) { showFPSWindow(); } else if (new KeyCodeCombination(KeyCode.J, KeyCombination.ALT_DOWN).match(keyEvent)) { WalletService walletService = injector.getInstance(WalletService.class); if (walletService.getWallet() != null) new ShowWalletDataWindow(walletService).information("Wallet raw data").show(); else new Popup<>().warning("The wallet is not initialized yet").show(); } else if (new KeyCodeCombination(KeyCode.G, KeyCombination.ALT_DOWN).match(keyEvent)) { TradeWalletService tradeWalletService = injector.getInstance(TradeWalletService.class); WalletService walletService = injector.getInstance(WalletService.class); if (walletService.getWallet() != null) new SpendFromDepositTxWindow(tradeWalletService).information("Emergency wallet tool") .show(); else new Popup<>().warning("The wallet is not initialized yet").show(); } else if (DevFlags.DEV_MODE && new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN).match(keyEvent)) { showDebugWindow(); } }); // configure the primary stage primaryStage.setTitle(env.getRequiredProperty(APP_NAME_KEY)); primaryStage.setScene(scene); primaryStage.setMinWidth(1000); // 1190 primaryStage.setMinHeight(620); // on windows the title icon is also used as task bar icon in a larger size // on Linux no title icon is supported but also a large task bar icon is derived from that title icon String iconPath; if (Utilities.isOSX()) iconPath = ImageUtil.isRetina() ? "/images/window_icon@2x.png" : "/images/window_icon.png"; else if (Utilities.isWindows()) iconPath = "/images/task_bar_icon_windows.png"; else iconPath = "/images/task_bar_icon_linux.png"; primaryStage.getIcons().add(new Image(getClass().getResourceAsStream(iconPath))); // make the UI visible primaryStage.show(); if (!Utilities.isCorrectOSArchitecture()) { String osArchitecture = Utilities.getOSArchitecture(); // We don't force a shutdown as the osArchitecture might in strange cases return a wrong value. // Needs at least more testing on different machines... new Popup<>() .warning("You probably have the wrong Bitsquare version for this computer.\n" + "Your computer's architecture is: " + osArchitecture + ".\n" + "The Bitsquare binary you installed is: " + Utilities.getJVMArchitecture() + ".\n" + "Please shut down and re-install the correct version (" + osArchitecture + ").") .show(); } UserThread.runPeriodically(() -> Profiler.printSystemLoad(log), LOG_MEMORY_PERIOD_MIN, TimeUnit.MINUTES); } catch (Throwable throwable) { showErrorPopup(throwable, false); } }
From source file:com.cdd.bao.editor.EditSchema.java
private void createMenuItems() { final KeyCombination.Modifier cmd = KeyCombination.SHORTCUT_DOWN, shift = KeyCombination.SHIFT_DOWN, alt = KeyCombination.ALT_DOWN; addMenu(menuFile, "_New", new KeyCharacterCombination("N", cmd)).setOnAction(event -> actionFileNew()); addMenu(menuFile, "_Open", new KeyCharacterCombination("O", cmd)).setOnAction(event -> actionFileOpen()); addMenu(menuFile, "_Save", new KeyCharacterCombination("S", cmd)) .setOnAction(event -> actionFileSave(false)); addMenu(menuFile, "Save _As", new KeyCharacterCombination("S", cmd, shift)) .setOnAction(event -> actionFileSave(true)); addMenu(menuFile, "_Export Dump", new KeyCharacterCombination("E", cmd)) .setOnAction(event -> actionFileExportDump()); addMenu(menuFile, "_Merge", null).setOnAction(event -> actionFileMerge()); menuFile.getItems().add(new SeparatorMenuItem()); addMenu(menuFile, "Confi_gure", new KeyCharacterCombination(",", cmd)) .setOnAction(event -> actionFileConfigure()); addMenu(menuFile, "_Browse Endpoint", new KeyCharacterCombination("B", cmd, shift)) .setOnAction(event -> actionFileBrowse()); if (false) {/*from w w w.ja v a2 s.c o m*/ addMenu(menuFile, "_Upload Endpoint", new KeyCharacterCombination("U", cmd, shift)) .setOnAction(event -> actionFileUpload()); } Menu menuFileGraphics = new Menu("Graphics"); addMenu(menuFileGraphics, "_Template", null).setOnAction(event -> actionFileGraphicsTemplate()); addMenu(menuFileGraphics, "_Assay", null).setOnAction(event -> actionFileGraphicsAssay()); addMenu(menuFileGraphics, "_Properties", null).setOnAction(event -> actionFileGraphicsProperties()); addMenu(menuFileGraphics, "_Values", null).setOnAction(event -> actionFileGraphicsValues()); menuFile.getItems().add(menuFileGraphics); addMenu(menuFile, "Assay Stats", null).setOnAction(event -> actionFileAssayStats()); menuFile.getItems().add(new SeparatorMenuItem()); addMenu(menuFile, "_Close", new KeyCharacterCombination("W", cmd)).setOnAction(event -> actionFileClose()); addMenu(menuFile, "_Quit", new KeyCharacterCombination("Q", cmd)).setOnAction(event -> actionFileQuit()); addMenu(menuEdit, "Add _Group", new KeyCharacterCombination("G", cmd, shift)) .setOnAction(event -> actionGroupAdd()); addMenu(menuEdit, "Add _Assignment", new KeyCharacterCombination("A", cmd, shift)) .setOnAction(event -> actionAssignmentAdd()); addMenu(menuEdit, "Add Assa_y", new KeyCharacterCombination("Y", cmd, shift)) .setOnAction(event -> actionAssayAdd()); menuEdit.getItems().add(new SeparatorMenuItem()); addMenu(menuEdit, "Cu_t", new KeyCharacterCombination("X", cmd)).setOnAction(event -> actionEditCopy(true)); addMenu(menuEdit, "_Copy", new KeyCharacterCombination("C", cmd)) .setOnAction(event -> actionEditCopy(false)); Menu menuCopyAs = new Menu("Copy As"); menuEdit.getItems().add(menuCopyAs); addMenu(menuEdit, "_Paste", new KeyCharacterCombination("V", cmd)).setOnAction(event -> actionEditPaste()); menuEdit.getItems().add(new SeparatorMenuItem()); addMenu(menuEdit, "_Delete", new KeyCodeCombination(KeyCode.DELETE, cmd, shift)) .setOnAction(event -> actionEditDelete()); addMenu(menuEdit, "_Undo", new KeyCharacterCombination("Z", cmd, shift)) .setOnAction(event -> actionEditUndo()); addMenu(menuEdit, "_Redo", new KeyCharacterCombination("Z", cmd, shift, alt)) .setOnAction(event -> actionEditRedo()); menuEdit.getItems().add(new SeparatorMenuItem()); addMenu(menuEdit, "Move _Up", new KeyCharacterCombination("[", cmd)) .setOnAction(event -> actionEditMove(-1)); addMenu(menuEdit, "Move _Down", new KeyCharacterCombination("]", cmd)) .setOnAction(event -> actionEditMove(1)); addMenu(menuCopyAs, "Layout Tab-Separated", null).setOnAction(event -> actionEditCopyLayoutTSV()); addMenu(menuValue, "_Add Value", new KeyCharacterCombination("V", cmd, shift)) .setOnAction(event -> detail.actionValueAdd()); addMenu(menuValue, "Add _Multiple Values", new KeyCharacterCombination("M", cmd, shift)) .setOnAction(event -> detail.actionValueMultiAdd()); addMenu(menuValue, "_Delete Value", new KeyCodeCombination(KeyCode.DELETE, cmd)) .setOnAction(event -> detail.actionValueDelete()); addMenu(menuValue, "Move _Up", new KeyCodeCombination(KeyCode.UP, cmd)) .setOnAction(event -> detail.actionValueMove(-1)); addMenu(menuValue, "Move _Down", new KeyCodeCombination(KeyCode.DOWN, cmd)) .setOnAction(event -> detail.actionValueMove(1)); menuValue.getItems().add(new SeparatorMenuItem()); addMenu(menuValue, "_Lookup URI", new KeyCharacterCombination("U", cmd)) .setOnAction(event -> detail.actionLookupURI()); addMenu(menuValue, "Lookup _Name", new KeyCharacterCombination("L", cmd)) .setOnAction(event -> detail.actionLookupName()); menuValue.getItems().add(new SeparatorMenuItem()); addMenu(menuValue, "_Sort Values", null).setOnAction(event -> actionValueSort()); addMenu(menuValue, "_Remove Duplicates", null).setOnAction(event -> actionValueDuplicates()); addMenu(menuValue, "Cleanup Values", null).setOnAction(event -> actionValueCleanup()); (menuViewSummary = addCheckMenu(menuView, "_Summary Values", new KeyCharacterCombination("-", cmd))) .setOnAction(event -> actionViewToggleSummary()); addMenu(menuView, "_Template", new KeyCharacterCombination("1", cmd)) .setOnAction(event -> actionViewTemplate()); addMenu(menuView, "_Assays", new KeyCharacterCombination("2", cmd)) .setOnAction(event -> actionViewAssays()); addMenu(menuView, "_Derived Tree", new KeyCharacterCombination("3", cmd)) .setOnAction(event -> detail.actionShowTree()); }