public static Stage getStage(Window owner) { Stage stage = new Stage(); ResourceBundle resources = ResourceBundle.getBundle("fxml/i18n/klc"); URL location = ExternalMonitor.class.getResource("/fxml/ExternalMonitor.fxml"); FXMLLoader loader = new FXMLLoader(location, resources); try { loader.load(); } catch (IOException e) { throw new RuntimeException(e); } stage.setTitle("Server Monitor"); stage.initModality(Modality.NONE); stage.initStyle(StageStyle.UTILITY); stage.initOwner(owner); stage.setScene(new Scene(loader.getRoot())); return stage; }
public CloseButton (String btnText) { super(btnText); setId("closebtn"); setOnAction(e -> { debug.Debugger.out("closing button"); Window window = this.getScene().getWindow(); if (myController != null) { GameModel gm = (GameModel) myController.getModel("game"); if (gm != null) gm.dispose(); } if (window instanceof Stage){ ((Stage) window).close(); } else { Logger.out("no stage found for closing button"); } }); }
public DataImportDialog(Window owner, FinancialMarket fm, TatConfig config) { super(); this.fm = fm; this.config = config; setResizable(false); initStyle(StageStyle.DECORATED); initOwner(owner); setTitle("Financial Market Import"); initModality(Modality.APPLICATION_MODAL); Image appIcon = new Image("icon/IMPORT_MARKET_DATA.png"); getIcons().add(appIcon); root = new Group(); Scene scene = new Scene(root, 500, 440, Color.WHITE); ImagePattern pattern = new ImagePattern(new Image("icon/bk5.jpg")); scene.setFill(pattern); setScene(scene); initGui(); //Add listener to exit when press Esc key addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> { if (KeyCode.ESCAPE == event.getCode()) { DataImportDialog.this.close(); } if (KeyCode.ENTER == event.getCode()) { doImport(); } }); setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0); setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0); }
public static File selectPrawnFile(Window ownerWindow) throws IOException, JAXBException, SAXException { File retVal = null; FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Select Prawn XML file"); fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("Prawn XML files", "*.xml")); File initDirectory = new File(squidPersistentState.getMRUPrawnFileFolderPath()); fileChooser.setInitialDirectory(initDirectory.exists() ? initDirectory : null); File prawnXMLFileNew = fileChooser.showOpenDialog(ownerWindow); if (prawnXMLFileNew != null) { if (prawnXMLFileNew.getName().toLowerCase(Locale.US).endsWith(".xml")) { retVal = prawnXMLFileNew; } else { throw new IOException("Filename does not end with '.xml'"); } } return retVal; }
public static List<File> selectForJoinTwoPrawnFiles(Window ownerWindow) throws IOException, JAXBException, SAXException { List<File> retVal = new ArrayList<>(); FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Select Two Prawn XML files"); fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("Prawn XML files", "*.xml")); File initDirectory = new File(squidPersistentState.getMRUPrawnFileFolderPath()); fileChooser.setInitialDirectory(initDirectory.exists() ? initDirectory : null); List<File> prawnXMLFilesNew = fileChooser.showOpenMultipleDialog(ownerWindow); if (prawnXMLFilesNew != null) { if ((prawnXMLFilesNew.size() == 2) && prawnXMLFilesNew.get(0).getName().toLowerCase(Locale.US).endsWith(".xml") && prawnXMLFilesNew.get(1).getName().toLowerCase(Locale.US).endsWith(".xml")) { retVal = prawnXMLFilesNew; } else { throw new IOException("Please choose exactly 2 Prawn xml files to merge."); } } return retVal; }
public static File savePrawnFile(SquidProject squidProject, Window ownerWindow) throws IOException, JAXBException, SAXException { File retVal = null; FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Save Prawn XML file"); fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("Prawn XML files", "*.xml")); fileChooser.setInitialDirectory(squidProject.getPrawnFileHandler().currentPrawnFileLocationFolder()); fileChooser.setInitialFileName(squidProject.getPrawnXMLFileName().toUpperCase(Locale.US).replace(".XML", "-REV.xml")); File prawnXMLFileNew = fileChooser.showSaveDialog(ownerWindow); if (prawnXMLFileNew != null) { squidProject.savePrawnFile(prawnXMLFileNew); retVal = prawnXMLFileNew; } return retVal; }
public static File saveExpressionFileXML(Expression expression, Window ownerWindow) throws IOException { File retVal = null; FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Save Expression '.xml' file"); fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("Expression '.xml' files", "*.xml")); File mruFolder = new File(squidPersistentState.getMRUExpressionFolderPath()); fileChooser.setInitialDirectory(mruFolder.isDirectory() ? mruFolder : null); fileChooser.setInitialFileName(expression.getName() + ".xml"); File expressionFileXML = fileChooser.showSaveDialog(ownerWindow); if (expressionFileXML != null) { retVal = expressionFileXML; squidPersistentState.setMRUExpressionFolderPath(expressionFileXML.getParent()); ((XMLSerializerInterface) expression) .serializeXMLObject(expressionFileXML.getAbsolutePath()); } return retVal; }
public static File selectExpressionXMLFile(Window ownerWindow) throws IOException, JAXBException, SAXException { File retVal = null; FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Select Expression xml File '.xml"); fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("Expression xml Files", "*.xml")); File mruFolder = new File(squidPersistentState.getMRUExpressionFolderPath()); fileChooser.setInitialDirectory(mruFolder.isDirectory() ? mruFolder : null); File expressionFileXML = fileChooser.showOpenDialog(ownerWindow); if (expressionFileXML != null) { if (expressionFileXML.getName().toLowerCase(Locale.US).endsWith(".xml")) { squidPersistentState.setMRUExpressionFolderPath(expressionFileXML.getParent()); retVal = expressionFileXML; } else { throw new IOException("Filename does not end with '.xml'"); } } return retVal; }
@FXML public void generateFileAction(ActionEvent actionEvent) { FileChooser saveChooser = new FileChooser(); Window stage = ((Node) actionEvent.getSource()).getScene().getWindow(); saveChooser.setTitle("Zapisz plik"); saveChooser.setInitialDirectory(new File(System.getProperty("user.home"))); saveChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("PDF file", "*.pdf")); saveChooser.setInitialFileName("faktura.pdf"); File file = saveChooser.showSaveDialog(stage); if (file != null) { try { updateData(); model.setInvoiceData(invoiceData); model.setReceiverData(receiverData); model.setSenderData(senderData); model.generatePDF(file); } catch (IOException | DocumentException e) { Dialog dialog = new Dialog<>(); dialog.getDialogPane().getButtonTypes().add(new ButtonType("Ok", ButtonBar.ButtonData.OK_DONE)); dialog.setContentText("Wystąpił błąd podczas próby zapisu"); dialog.showAndWait(); } } }
@Override @FXThread public void show(@NotNull final Window owner) { super.show(owner); final EditorConfig editorConfig = EditorConfig.getInstance(); final Path currentAsset = notNull(editorConfig.getCurrentAsset()); final ResourceTree resourceTree = getResourceTree(); resourceTree.setOnLoadHandler(finished -> expand(currentAsset, resourceTree, finished)); resourceTree.fill(currentAsset); FX_EVENT_MANAGER.addEventHandler(CreatedFileEvent.EVENT_TYPE, createdFileHandler); FX_EVENT_MANAGER.addEventHandler(RequestSelectFileEvent.EVENT_TYPE, selectFileHandle); FX_EVENT_MANAGER.addEventHandler(DeletedFileEvent.EVENT_TYPE, deletedFileHandler); validateFileName(); EXECUTOR_MANAGER.addFXTask(getFileNameField()::requestFocus); }
public void saveSenderData(ActionEvent actionEvent) { FileChooser saveChooser = new FileChooser(); Window stage = senderMenuButton.getScene().getWindow(); saveChooser.setTitle("Zapisz dane wystawcy"); saveChooser.setInitialDirectory(new File(System.getProperty("user.home"))); saveChooser.setInitialFileName("File.txt"); File file = saveChooser.showSaveDialog(stage); if (file != null) { updateData(); try { FileWriter fileWriter = new FileWriter(file); fileWriter.write(senderData.toString()); fileWriter.flush(); fileWriter.close(); } catch (IOException e) { e.printStackTrace(); } } }
public void saveReceiverData(ActionEvent actionEvent) { FileChooser saveChooser = new FileChooser(); Window stage = receiverMenuButton.getScene().getWindow(); saveChooser.setTitle("Zapisz dane odbiorcy"); saveChooser.setInitialDirectory(new File(System.getProperty("user.home"))); saveChooser.setInitialFileName("file.txt"); File file = saveChooser.showSaveDialog(stage); if (file != null) { updateData(); try { FileWriter fileWriter = new FileWriter(file); fileWriter.write(receiverData.toString()); fileWriter.flush(); fileWriter.close(); } catch (IOException e) { e.printStackTrace(); } } }
public void showDialog() { FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/diff/diff-view.fxml")); try { loader.setController(diffController); DialogPane root = loader.load(); root.getStylesheets().add(getClass().getResource("/gui/diff/diff-view.css").toExternalForm()); Alert alert = new Alert(Alert.AlertType.WARNING); alert.setTitle("Diff Viewer"); alert.setResizable(true); alert.setDialogPane(root); alert.initModality(Modality.WINDOW_MODAL); Window window = alert.getDialogPane().getScene().getWindow(); window.setOnCloseRequest(event -> window.hide()); alert.showAndWait(); } catch (IOException e) { e.printStackTrace(); } }
/** * Utility method to center a Dialog/Alert on the middle of the current * screen. Used to workaround a "bug" with the current version of JavaFX (or * the SWT/JavaFX embedding?) where alerts always show on the primary * screen, not necessarily the current one. * * @param dialog * The dialog to reposition. It must be already shown, or else * this will do nothing. * @param referenceNode * The dialog should be moved to the same screen as this node's * window. */ public static void centerDialogOnScreen(Dialog<?> dialog, Node referenceNode) { Window window = referenceNode.getScene().getWindow(); if (window == null) { return; } Rectangle2D windowRectangle = new Rectangle2D(window.getX(), window.getY(), window.getWidth(), window.getHeight()); List<Screen> screens = Screen.getScreensForRectangle(windowRectangle); Screen screen = screens.stream() .findFirst() .orElse(Screen.getPrimary()); Rectangle2D screenBounds = screen.getBounds(); dialog.setX((screenBounds.getWidth() - dialog.getWidth()) / 2 + screenBounds.getMinX()); // dialog.setY((screenBounds.getHeight() - dialog.getHeight()) / 2 + screenBounds.getMinY()); }
public T show(Window parent) { Stage stage = getStage(); stage.initModality(Modality.APPLICATION_MODAL); focusOnFirstControl(stage.getScene().getRoot()); stage.showAndWait(); return getReturnValue(); }
public static void showMessageDialog(Window parent, String message, String title, AlertType type, boolean monospace) { if (Platform.isFxApplicationThread()) { _showMessageDialog(parent, message, title, type, monospace); } else { Object lock = new Object(); synchronized (lock) { Platform.runLater(() -> { _showMessageDialog(parent, message, title, type, monospace); lock.notifyAll(); }); } synchronized (lock) { try { lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } }
@SuppressWarnings("unchecked") public static Optional<ButtonType> showConfirmDialog(Window parent, String message, String title, AlertType type, ButtonType... buttonTypes) { if (Platform.isFxApplicationThread()) { return _showConfirmDialog(parent, message, title, type, buttonTypes); } else { Object r[] = { null }; Object lock = new Object(); synchronized (lock) { Platform.runLater(() -> { r[0] = _showConfirmDialog(parent, message, title, type, buttonTypes); synchronized (lock) { lock.notifyAll(); } }); } synchronized (lock) { try { lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } return (Optional<ButtonType>) r[0]; } }
private List<Window> getContextMenu() { List<Window> contextMenus = new ArrayList<>(); new Wait("Unable to context menu") { @Override public boolean until() { @SuppressWarnings({ "deprecation" }) Iterator<Window> windows = Window.impl_getWindows(); while (windows.hasNext()) { Window window = windows.next(); if (window instanceof ContextMenu) { contextMenus.add(window); } } return contextMenus.size() > 0; } }; ; return contextMenus; }
@Override @FXThread public void show(@NotNull final Window owner) { super.show(owner); Path initDirectory = getInitDirectory(); if (initDirectory == null) { initDirectory = Paths.get(System.getProperty("user.home")); } final Path toExpand = initDirectory; final Path root = initDirectory.getRoot(); final ResourceTree resourceTree = getResourceTree(); resourceTree.fill(root); resourceTree.setOnLoadHandler(finished -> { if (finished) { resourceTree.expandTo(toExpand, true); } }); EXECUTOR_MANAGER.addFXTask(resourceTree::requestFocus); }
@Before public void setup() throws Exception { if (Platform.isFxApplicationThread()) throw new AssertionError("Invalid test state"); Thread.setDefaultUncaughtExceptionHandler(HANDLER); FxToolkit.registerPrimaryStage(); // FxToolkit.registerStage(() -> new Stage(StageStyle.TRANSPARENT)); FxToolkit.setupSceneRoot(() -> { if (!Platform.isFxApplicationThread()) throw new AssertionError("Invalid test state"); Thread.currentThread().setUncaughtExceptionHandler(HANDLER); pane = target.createPane(); pane.setId(ID); return pane; }); FxToolkit.setupStage(Window::sizeToScene); FxToolkit.showStage(); }
public DataUpdateDialog(TatMain app, Window owner, FinancialMarket fm, TatConfig config, boolean bUpdateMode) { super(); this.bUpdateMode = bUpdateMode; this.fm = fm; this.config = config; setResizable(false); initStyle(StageStyle.DECORATED); initOwner(owner); application = app; if (bUpdateMode == true){ setTitle("View & update market data"); } else { setTitle("Select a market data"); } initModality(Modality.APPLICATION_MODAL); Image appIcon = new Image("icon/UPDATE_MARKET_DATA.png"); getIcons().add(appIcon); root = new Group(); Scene scene = new Scene(root, 700, 620, Color.WHITE); ImagePattern pattern = new ImagePattern(new Image("icon/bk5.jpg")); scene.setFill(pattern); setScene(scene); marketDataTreeView = new MarketDataTreeViewNode(application, fm, config, this.bUpdateMode); initGui(); //Add listener to exit when press Esc key addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> { if (KeyCode.ESCAPE == event.getCode()) { DataUpdateDialog.this.close(); } }); setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0); setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0); }
public void apply(Window owner) { File file = fileChooser.showOpenDialog(owner); if (file != null) { // 1. Check for sidecar file Optional<byte[]> bytes = Optional.empty(); try { bytes = readSha512(file); } catch (IOException e) { log.warn("Failed to lookup file by sha512 sidecar file", e); } if (bytes.isPresent()) { fetchBySha51(bytes.get(), file); } else { fetchByFilename(file); } } }
public FeaturesDialog(final Window parent) { setTitle("Makeover Tools"); setResizable(false); initStyle(StageStyle.UTILITY); setOnCloseRequest(evt -> parent.hide()); Scene optionsScene = new Scene(featuresPane); setScene(optionsScene); sizeToScene(); if(parent != null) { setX(parent.getX() + parent.getWidth() - 40); setY(parent.getY() + 100); initOwner(parent); } }
public static void installWindowDragListener(Node node) { node.setOnMousePressed(evt -> { mouseX = evt.getScreenX(); mouseY = evt.getScreenY(); }); node.setOnMouseDragged(evt -> { double deltaX = evt.getScreenX() - mouseX; double deltaY = evt.getScreenY() - mouseY; Window window = node.getScene().getWindow(); window.setX(node.getScene().getWindow().getX() + deltaX); window.setY(node.getScene().getWindow().getY() + deltaY); mouseX = evt.getScreenX(); mouseY = evt.getScreenY(); }); }
private SquidMessageDialog(Alert.AlertType alertType, String message, String headerText, Window owner) { super(alertType); initOwner(owner); setTitle("Squid3 Alert"); setContentText(message); setHeaderText(headerText); initStyle(StageStyle.DECORATED); getDialogPane().setPrefSize(500, 350); }
public void show(Window window) { if(window == null) { return; } Application.invokeAndWait(new Runnable() { @Override public void run() { long viewPointer = JavaFXUtils.getViewPointer(window); JTouchBarJNI.setTouchBar0(viewPointer, JTouchBar.this); } }); }
@Test void testGfaFileOpenerAccept() throws Exception { final CompletableFuture<Object> future = new CompletableFuture<>(); interact(() -> { try { final GraphStore graphStore = spy(GraphStore.class); final FileChooser fileChooser = mock(FileChooser.class); final File file = mock(File.class); // Due to the internal structure of JavaFX, the FileChooser only returns the file the second time. final Window owner = Hygene.getInstance().getPrimaryStage().getScene().getWindow(); when(fileChooser.showOpenDialog(owner)).thenReturn(file); menuController.setGfaFileChooser(fileChooser); menuController.setGraphStore(graphStore); menuController.openGfaFileAction(mock(ActionEvent.class)); verify(file).getParentFile(); future.complete(null); } catch (final Exception e) { future.complete(null); fail(e.getMessage()); } }); future.get(); }
@Override @FXThread public void show(@NotNull final Window owner) { super.show(owner); final VirtualResourceTree<C> resourceTree = getResourceTree(); final RootVirtualResourceElement newRoot = VirtualResourceElementFactory.build(resources, resourceTree); resourceTree.fill(newRoot); resourceTree.expandAll(); EXECUTOR_MANAGER.addFXTask(resourceTree::requestFocus); }
/** * An action which shows the popup to select or add a user. * * @param bundle The resource bundle, must not be null. * @param context The application context, must not be null. * @param window The main window of the application, must not be null. */ public SelectUserAction(ResourceBundle bundle, ApplicationContext context, Window window) { super(bundle, context, window); CreateUserAction createUserAction = new CreateUserAction(getBundle(), getApplicationContext(), getWindow()); selectUserPopOver = new SelectionPopOver<User>() { @Override protected void onSelected(User user) { Log.debug(APPLICATION, "Change active user to '" + user + "'."); getApplicationContext().changeActiveUser(user); } @Override protected void onAddClicked(ActionEvent event) { Log.debug(APPLICATION, "User wants to add a new user!"); createUserAction.handle(event); } @Override protected ListCell<User> createListCell(ListView<User> listView) { return new UserListCell(listView); } }; selectUserPopOver.setPlaceholderText(bundle.getString("popup_select_user_list_no_users")); selectUserPopOver.setButtonText(bundle.getString("popup_select_user_btn_add_user")); }
/** * An action which shows the popup with info about the connection. * * @param bundle The resource bundle, must not be null. * @param context The application context, must not be null. * @param window The main window of the application, must not be null. */ public ConnectInfoAction(ResourceBundle bundle, ApplicationContext context, Window window) { super(bundle, context, window); infoPopOver = new InfoPopOver(); infoPopOver.setLogo(createGlyph(ICON_USB)); infoPopOver.setText(bundle.getString("popup_connect_connecting")); }
UidSetupPane(ProjectConfig config, Window window, Node okButton) { this.config = config; //this.window = window; this.okButton = okButton; init(); }
public static ProofView openProof(TabPane tabPane) throws FileNotFoundException, ClassNotFoundException, IOException { System.out.println("opendProof"); Window window = tabPane.getScene().getWindow(); FileChooser fc = new FileChooser(); fc.getExtensionFilters().addAll( new ExtensionFilter(".proof", "*.proof"), new ExtensionFilter("All Files", "*")); File file = fc.showOpenDialog(window); if(file == null){ System.out.println("No file chosen."); return null; } System.out.println("File chosen: "+file.getName()); Proof proof; FileInputStream fileIn = new FileInputStream(file); ObjectInputStream in = new ObjectInputStream(fileIn); proof = (Proof) in.readObject(); in.close(); fileIn.close(); proof.load(); String premiseStr = proof.getPremisesStr(); String conclusionStr = proof.getConclusionStr(); ProofView pv = new ProofView(tabPane, proof); pv.setPath(file.getPath()); pv.setName(file.getName()); pv.getTab().setText(pv.getName()); pv.displayLoadedProof(premiseStr, conclusionStr); System.out.println("Deserialized proof: "+pv.getName()); return pv; }
public static Optional<ButtonType> _showConfirmDialog(Window parent, String message, String title, AlertType type, ButtonType... buttonTypes) { Alert alert = new Alert(type, message, buttonTypes); alert.initOwner(parent); alert.setTitle(title); alert.initModality(Modality.APPLICATION_MODAL); return alert.showAndWait(); }
private static FileChooser getFileChooser(String title, File initialDirectory, Window ownerWindow, ExtensionFilter filter) { FileChooser fileChooser = new FileChooser(); if (filter != null) { fileChooser.getExtensionFilters().add(filter); } fileChooser.setTitle(title); fileChooser.setInitialDirectory(initialDirectory); return fileChooser; }
/** * * @param window * @param title * @param message * @return {@code ButtonType.YES, ButtonType.NO, ButtonType.CANCEL} */ public static ButtonType showConfirmCancelDialog(Window window, String title, String message) { Dialog<ButtonType> dialog = createDialog(); if (window != null) { dialog.initOwner(window); } dialog.getDialogPane().getButtonTypes().addAll(ButtonType.YES, ButtonType.NO, ButtonType.CANCEL); dialog.setTitle(title); dialog.setContentText(message); return dialog.showAndWait().orElse(ButtonType.CANCEL); }
@FXThread public void hide() { final Duration duration = Duration.between(showedTime, LocalTime.now()); final int seconds = (int) duration.getSeconds(); final Window window = dialog.getOwner(); final Scene scene = window.getScene(); if (scene instanceof EditorFXScene) { final EditorFXScene editorFXScene = (EditorFXScene) scene; final StackPane container = editorFXScene.getContainer(); container.setFocusTraversable(true); } if (focusOwner != null) { focusOwner.requestFocus(); } dialog.hide(); final JFXApplication application = JFXApplication.getInstance(); application.removeWindow(dialog); GAnalytics.sendEvent(GAEvent.Category.DIALOG, GAEvent.Action.DIALOG_CLOSED, getDialogId()); GAnalytics.sendTiming(GAEvent.Category.DIALOG, GAEvent.Label.SHOWING_A_DIALOG, seconds, getDialogId()); }
/** * Load fileChooser */ private void chooseImage(){ FileChooser fileChooser = new FileChooser(); configureFileChooser(fileChooser); Window stage = GUIController.getPrimaryStage(); changeImage(fileChooser.showOpenDialog(stage)); GUIController .getPrimaryStage() .setScene(new Scene(new ProfileScene(dc,p,loggedInProfile) .getPane(), GUIConstants .SCENE_WIDTH, GUIConstants .SCENE_HEIGHT) ); }
public File showOpenDialog(Window window) { File opened = wrapped.showOpenDialog(window); if(opened != null) { wrapped.setInitialDirectory(opened.getParentFile()); } return opened; }
public File showSaveDialog(Window window) { File saved = wrapped.showSaveDialog(window); if(saved != null) { wrapped.setInitialDirectory(saved.getParentFile()); } return saved; }
@Override public void press(MouseEvent e) { Window window = get(); if (isEnable() && e.isConsumed() == false && window != null) { if (canDrag(new Point2D(e.getSceneX(), e.getSceneY()), window.getX() + window.getWidth(), window.getY() + window.getHeight())) { startX = e.getScreenX() - window.getX(); startY = e.getScreenY() - window.getY(); e.consume(); pressed = true; } } }