Java Code Examples for javafx.scene.control.Label#setOnMouseClicked()
The following examples show how to use
javafx.scene.control.Label#setOnMouseClicked() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Watch.java From jace with GNU General Public License v2.0 | 8 votes |
public Watch(int address, final MetacheatUI outer) { super(); this.outer = outer; this.address = address; cell = outer.cheatEngine.getMemoryCell(address); redraw = outer.animationTimer.scheduleAtFixedRate(this::redraw, MetacheatUI.FRAME_RATE, MetacheatUI.FRAME_RATE, TimeUnit.MILLISECONDS); setBackground(new Background(new BackgroundFill(Color.NAVY, CornerRadii.EMPTY, Insets.EMPTY))); Label addrLabel = new Label("$" + Integer.toHexString(address)); addrLabel.setOnMouseClicked((evt)-> outer.inspectAddress(address)); addrLabel.setTextAlignment(TextAlignment.CENTER); addrLabel.setMinWidth(GRAPH_WIDTH); addrLabel.setFont(new Font(Font.getDefault().getFamily(), 14)); addrLabel.setTextFill(Color.WHITE); graph = new Canvas(GRAPH_WIDTH, GRAPH_HEIGHT); getChildren().add(addrLabel); getChildren().add(graph); CheckBox hold = new CheckBox("Hold"); holding = hold.selectedProperty(); holding.addListener((prop, oldVal, newVal) -> this.updateHold()); getChildren().add(hold); hold.setTextFill(Color.WHITE); }
Example 2
Source File: MetacheatUI.java From jace with GNU General Public License v2.0 | 6 votes |
private Watch addWatch(int addr) { Watch watch = new Watch(addr, this); watch.setPadding(new Insets(5)); watch.setOpaqueInsets(new Insets(10)); Label addCheat = new Label("Cheat >>"); addCheat.setOnMouseClicked((mouseEvent) -> { addCheat(addr, watch.getValue()); }); addCheat.setTextFill(Color.WHITE); watch.getChildren().add(addCheat); Label close = new Label("Close X"); close.setOnMouseClicked((mouseEvent) -> { watch.disconnect(); watchesPane.getChildren().remove(watch); }); close.setTextFill(Color.WHITE); watch.getChildren().add(close); watchesPane.getChildren().add(watch); return watch; }
Example 3
Source File: ContainerVerbsPanelSkin.java From phoenicis with GNU Lesser General Public License v3.0 | 6 votes |
/** * Updates the verbs in the given {@link GridPane verbs} * * @param verbs The GridPane containing the visual verb installation components */ private void updateVerbs(final GridPane verbs) { verbs.getChildren().clear(); for (ScriptDTO verb : getControl().getVerbScripts()) { final int row = verbs.getRowCount(); final CheckBox verbCheck = new CheckBox(); verbCheck.disableProperty().bind(getControl().lockVerbsProperty()); final Label verbName = new Label(verb.getScriptName()); // select the associated checkbox if the label has been clicked verbName.setOnMouseClicked(event -> verbCheck.fire()); GridPane.setHgrow(verbName, Priority.ALWAYS); verbs.addRow(row, verbCheck, verbName); } }
Example 4
Source File: MetacheatUI.java From jace with GNU General Public License v2.0 | 5 votes |
private void memoryViewClicked(MouseEvent e, MemoryCell cell) { if (cheatEngine != null) { Watch currentWatch = (Watch) memoryWatchTooltip.getGraphic(); if (currentWatch != null) { currentWatch.disconnect(); } int addr = cell.address; Watch watch = new Watch(addr, this); Label addWatch = new Label("Watch >>"); addWatch.setOnMouseClicked((mouseEvent) -> { Watch newWatch = addWatch(addr); if (watch.holdingProperty().get()) { newWatch.holdingProperty().set(true); } memoryWatchTooltip.hide(); }); watch.getChildren().add(addWatch); Label addCheat = new Label("Cheat >>"); addCheat.setOnMouseClicked((mouseEvent) -> { Platform.runLater(() -> addCheat(addr, watch.getValue())); }); watch.getChildren().add(addCheat); memoryWatchTooltip.setStyle("-fx-background-color:NAVY"); memoryWatchTooltip.onHidingProperty().addListener((prop, oldVal, newVal) -> { watch.disconnect(); memoryWatchTooltip.setGraphic(null); }); memoryWatchTooltip.setGraphic(watch); memoryWatchTooltip.show(memoryViewPane.getContent(), e.getScreenX() + 5, e.getScreenY() - 15); } }
Example 5
Source File: ClientDisplay.java From Open-Lowcode with Eclipse Public License 2.0 | 5 votes |
/** * generates the JAVAFX component for the status bar * * @return the Pane */ public Pane generateStatusBar() { Label statusbar = new Label(""); statusbar.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getButton().equals(MouseButton.SECONDARY)) { final ClipboardContent content = new ClipboardContent(); content.putString(statusbar.getText()); Clipboard.getSystemClipboard().setContent(content); } else { Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Status Message"); alert.setHeaderText("Status Message"); alert.setContentText(statusbar.getText()); alert.showAndWait(); } } }); this.statuslabel = statusbar; HBox statusbarpane = new HBox(5); statusbarpane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null))); statusbarpane.getChildren().add(statusbar); return statusbarpane; }
Example 6
Source File: PanelMenuBar.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
private HBox createRenameButton() { HBox renameBox = new HBox(); renameButton = new Label(OCTICON_RENAME_PANEL); renameButton.getStyleClass().addAll("octicon", "label-button"); renameButton.setId(IdGenerator.getPanelRenameButtonId(panel.panelIndex)); renameButton.setOnMouseClicked(e -> { e.consume(); activateInplaceRename(); }); Tooltip.install(renameBox, new Tooltip("Edit the name of this panel")); renameBox.getChildren().add(renameButton); return renameBox; }
Example 7
Source File: TextFieldWithCopyIcon.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
public TextFieldWithCopyIcon(String customStyleClass) { Label copyIcon = new Label(); copyIcon.setLayoutY(3); copyIcon.getStyleClass().addAll("icon", "highlight"); copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard"))); AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); copyIcon.setOnMouseClicked(e -> { String text = getText(); if (text != null && text.length() > 0) { String copyText; if (copyWithoutCurrencyPostFix) { String[] strings = text.split(" "); if (strings.length > 1) copyText = strings[0]; // exclude the BTC postfix else copyText = text; } else { copyText = text; } Utilities.copyToClipboard(copyText); } }); textField = new JFXTextField(); textField.setEditable(false); if (customStyleClass != null) textField.getStyleClass().add(customStyleClass); textField.textProperty().bindBidirectional(text); AnchorPane.setRightAnchor(copyIcon, 5.0); AnchorPane.setRightAnchor(textField, 30.0); AnchorPane.setLeftAnchor(textField, 0.0); textField.focusTraversableProperty().set(focusTraversableProperty().get()); //TODO app wide focus //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus()); getChildren().addAll(textField, copyIcon); }
Example 8
Source File: FundsTextField.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
public FundsTextField() { super(); textField.textProperty().unbind(); textField.textProperty().bind(Bindings.concat(textProperty(), " ", fundsStructure)); Label copyIcon = getIcon(AwesomeIcon.COPY); copyIcon.setLayoutY(5); copyIcon.getStyleClass().addAll("icon", "highlight"); Tooltip.install(copyIcon, new Tooltip(Res.get("shared.copyToClipboard"))); copyIcon.setOnMouseClicked(e -> { String text = getText(); if (text != null && text.length() > 0) { String copyText; String[] strings = text.split(" "); if (strings.length > 1) copyText = strings[0]; // exclude the BTC postfix else copyText = text; Utilities.copyToClipboard(copyText); } }); AnchorPane.setRightAnchor(copyIcon, 30.0); AnchorPane.setRightAnchor(infoIcon, 62.0); AnchorPane.setRightAnchor(textField, 55.0); getChildren().add(copyIcon); }
Example 9
Source File: HighlightOptions.java From LogFX with GNU General Public License v3.0 | 5 votes |
private Node createHelpIcon() { WebView htmlContent = new WebView(); WebEngine webEngine = htmlContent.getEngine(); String htmlText; try { htmlText = new BufferedReader( new InputStreamReader( getClass().getResourceAsStream( "/html/highlight-options-help.html" ), StandardCharsets.UTF_8 ) ).lines().collect( joining( "\n" ) ); webEngine.setUserStyleSheetLocation( getClass().getResource( "/css/web-view.css" ).toString() ); } catch ( Exception e ) { log.warn( "Error loading HTML resources", e ); htmlText = "<div>Could not open the help file</div>"; } Label help = AwesomeIcons.createIconLabel( HELP ); Dialog helpDialog = new Dialog( htmlContent ); helpDialog.setTitle( "Highlight Options Help" ); helpDialog.setStyle( StageStyle.UTILITY ); helpDialog.setResizable( false ); final String html = htmlText; help.setOnMouseClicked( event -> { helpDialog.setOwner( getScene().getWindow() ); webEngine.loadContent( html ); helpDialog.show(); } ); help.setOnMouseEntered( event -> getScene().setCursor( Cursor.HAND ) ); help.setOnMouseExited( event -> getScene().setCursor( Cursor.DEFAULT ) ); return help; }
Example 10
Source File: MarsNode.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public Label createPerson(Person person) { //Button b = new Button(person.getName()); Label l = new Label(person.getName()); l.setPadding(new Insets(20)); l.setMaxWidth(Double.MAX_VALUE); l.setId("settlement-node"); l.getStylesheets().add("/fxui/css/personnode.css"); l.setOnMouseClicked(new EventHandler<MouseEvent>() { PopOver popOver = null; @Override public void handle(MouseEvent evt) { if (popOver == null ) { popOver = createPopOver(l, person); } else if (evt.getClickCount() >= 1) { popOver.hide(Duration.seconds(.5)); } else if (popOver.isShowing()) { popOver.hide(Duration.seconds(.5)); } else if (!popOver.isShowing()) { popOver = createPopOver(l, person); } } }); return l; }
Example 11
Source File: MarsNode.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public Label createEach(Settlement settlement) { Label l = new Label(settlement.getName()); l.setPadding(new Insets(20)); l.setAlignment(Pos.CENTER); l.setMaxWidth(Double.MAX_VALUE); l.setId("settlement-node"); l.getStylesheets().add("/fxui/css/settlementnode.css"); l.setOnMouseClicked(new EventHandler<MouseEvent>() { PopOver popOver = null; @Override public void handle(MouseEvent evt) { if (popOver == null ) { popOver = createPopOver(l, settlement); } else if (evt.getClickCount() >= 1) { popOver.hide(Duration.seconds(.5)); } else if (popOver.isShowing()) { popOver.hide(Duration.seconds(.5)); } else if (!popOver.isShowing()) { popOver = createPopOver(l, settlement); } } }); return l; }
Example 12
Source File: ResourceView.java From sis with Apache License 2.0 | 5 votes |
private void setOnClick(Label lab) { addContextMenu(lab); lab.setOnMouseClicked(click -> { if (click.getButton() == MouseButton.PRIMARY) { if (sauvLabel != null) { sauvLabel.setTextFill(Color.BLACK); } addMetadatPanel(null, lab.getId()); sauvLabel = lab; lab.setTextFill(Color.RED); } }); }
Example 13
Source File: NBTEditorDialog.java From mcaselector with MIT License | 5 votes |
private Label iconLabel(String img, Supplier<Tag<?>> tagSupplier, NBTTreeView nbtTreeView) { ImageView icon = new ImageView(FileHelper.getIconFromResources(img)); Label label = new Label("", icon); icon.setPreserveRatio(true); label.setOnMouseEntered(e -> icon.setFitWidth(18)); label.setOnMouseExited(e -> icon.setFitWidth(16)); label.getStyleClass().add("nbt-editor-add-tag-label"); label.setOnMouseClicked(e -> nbtTreeView.addItem(nbtTreeView.getSelectionModel().getSelectedItem(), "Unknown", tagSupplier.get())); return label; }
Example 14
Source File: JFXTimePickerContent.java From JFoenix with Apache License 2.0 | 4 votes |
protected StackPane createHeaderPane(LocalTime time, boolean _24HourView) { int hour = time.getHour(); selectedHourLabel.setText(String.valueOf(hour % (_24HourView ? 24 : 12) == 0 ? (_24HourView ? 0 : 12) : hour % (_24HourView ? 24 : 12))); selectedHourLabel.getStyleClass().add(SPINNER_LABEL); selectedHourLabel.setTextFill(Color.WHITE); selectedHourLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42)); selectedHourLabel.setOnMouseClicked((click) -> unit.set(TimeUnit.HOURS)); selectedHourLabel.setMinWidth(49); selectedHourLabel.setAlignment(Pos.CENTER_RIGHT); timeLabel.set(selectedHourLabel); selectedMinLabel.setText(String.valueOf(unitConverter.toString(time.getMinute()))); selectedMinLabel.getStyleClass().add(SPINNER_LABEL); selectedMinLabel.setTextFill(fadedColor); selectedMinLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42)); selectedMinLabel.setOnMouseClicked((click) -> unit.set(TimeUnit.MINUTES)); Label separatorLabel = new Label(":"); separatorLabel.setPadding(new Insets(0, 0, 4, 0)); separatorLabel.setTextFill(fadedColor); separatorLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42)); periodPMLabel = new Label("PM"); periodPMLabel.getStyleClass().add(SPINNER_LABEL); periodPMLabel.setTextFill(fadedColor); periodPMLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14)); periodPMLabel.setOnMouseClicked((click) -> period.set("PM")); periodAMLabel = new Label("AM"); periodAMLabel.getStyleClass().add(SPINNER_LABEL); periodAMLabel.setTextFill(fadedColor); periodAMLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14)); periodAMLabel.setOnMouseClicked((click) -> period.set("AM")); // init period value if (hour < 12) { periodAMLabel.setTextFill(Color.WHITE); } else { periodPMLabel.setTextFill(Color.WHITE); } period.set(hour < 12 ? "AM" : "PM"); VBox periodContainer = new VBox(); periodContainer.setPadding(new Insets(0, 0, 0, 4)); periodContainer.getChildren().addAll(periodAMLabel, periodPMLabel); // Year label container HBox selectedTimeContainer = new HBox(); selectedTimeContainer.getStyleClass().add("spinner"); selectedTimeContainer.getChildren() .addAll(selectedHourLabel, separatorLabel, selectedMinLabel); if (!_24HourView) { selectedTimeContainer.getChildren().add(periodContainer); } selectedTimeContainer.setAlignment(Pos.CENTER); selectedTimeContainer.setFillHeight(false); StackPane headerPanel = new StackPane(); headerPanel.getStyleClass().add("time-pane"); headerPanel.setBackground(new Background(new BackgroundFill(this.timePicker.getDefaultColor(), CornerRadii.EMPTY, Insets.EMPTY))); headerPanel.setPadding(new Insets(8, 24, 8, 24)); headerPanel.getChildren().add(selectedTimeContainer); return headerPanel; }
Example 15
Source File: LineNumAndBreakpointFactory.java From CPUSim with GNU General Public License v3.0 | 4 votes |
@Override public Node apply(int idx) { Label label = new Label(); Paragraph paragraph = area.getParagraphs().get(idx); boolean breakPoint = getAllBreakPointLineNumbers().contains(idx); Circle icon = new Circle(4, breakPoint ? Color.RED : Color.web("#eee")); // // same color as background and so invisible label.setGraphic(icon); label.getStyleClass().add("lineno"); label.getStylesheets().add(stylesheet); // add a listener to the Label so that clicks in it cause the breakpoint // circle to toggle on and off label.setOnMouseClicked(event -> { Circle circle = (Circle) label.getGraphic(); if (breakPoints.removeIf(x -> x == paragraph)) { // if the paragraph was already a breakpoint, remove it and its circle circle.setFill(Color.web("#eee")); } else { breakPoints.add(paragraph); circle.setFill(Color.RED); } }); // When the format changes, for example when line numbers are shown or hidden, // redraw the label's text format.addListener((observable, oldValue, newValue) -> { label.setText(formatTheLineNumber(idx + 1, area.getParagraphs().size())); }); // When code stops due to a break point, change the background to orange // instead of light grey currentBreakPointLineNumber.addListener((observable, oldValue, newValue) -> { if ((int) newValue == idx) { // break at given line label.setBackground(new Background(new BackgroundFill(Color.ORANGE, CornerRadii.EMPTY, Insets.EMPTY))); } else if ((int) oldValue == idx) { // resumed after breaking at given line label.setBackground(new Background(new BackgroundFill(Color.web("#eee") , CornerRadii.EMPTY, Insets.EMPTY))); } }); // when a paragraph is removed from the text area, be sure the // paragraph is removed from the set of breakpoints area.getParagraphs().addListener((ListChangeListener<Paragraph<?>>) c -> { if (indexOfUsingIdentity(breakPoints, paragraph) == -1) { breakPoints.removeIf(x -> x == paragraph); } //we can't just say breakPoints.remove(paragraph) because we need //to compare paragraphs withh ==, not Paragraph.equals() }); // reformat the line numbers when the number of lines changes. // When removed from the scene, stay subscribed to never(), which is // a fake subscription that consumes no resources, instead of staying // subscribed to area's paragraphs. EventStreams.valuesOf(label.sceneProperty()).flatMap(scene -> scene != null ? nParagraphs.map(n -> formatTheLineNumber(idx + 1, n)) : EventStreams .<String>never()).feedTo(label.textProperty()); return label; }
Example 16
Source File: CanvasManager.java From ShootOFF with GNU General Public License v3.0 | 4 votes |
public Label addDiagnosticMessage(final String message, final long chimeDelay, final Color backgroundColor) { final Label diagnosticLabel = new Label(message); diagnosticLabel.setStyle("-fx-background-color: " + colorToWebCode(backgroundColor)); final ImageView muteView = new ImageView(); muteView.setFitHeight(20); muteView.setFitWidth(muteView.getFitHeight()); if (config.isChimeMuted(message)) { muteView.setImage(muteImage); } else { muteView.setImage(soundImage); } diagnosticLabel.setContentDisplay(ContentDisplay.RIGHT); diagnosticLabel.setGraphic(muteView); diagnosticLabel.setOnMouseClicked((event) -> { if (config.isChimeMuted(message)) { muteView.setImage(soundImage); config.unmuteMessageChime(message); } else { muteView.setImage(muteImage); config.muteMessageChime(message); } try { config.writeConfigurationFile(); } catch (final Exception e) { logger.error("Failed persisting message's (" + message + ") chime mute settings.", e); } }); Platform.runLater(() -> diagnosticsVBox.getChildren().add(diagnosticLabel)); if (chimeDelay > 0 && !config.isChimeMuted(message) && !diagnosticExecutorService.isShutdown()) { @SuppressWarnings("unchecked") final ScheduledFuture<Void> chimeFuture = (ScheduledFuture<Void>) diagnosticExecutorService.schedule( () -> TrainingExerciseBase.playSound("sounds/chime.wav"), chimeDelay, TimeUnit.MILLISECONDS); diagnosticFutures.put(diagnosticLabel, chimeFuture); } return diagnosticLabel; }
Example 17
Source File: BsqAddressTextField.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
public BsqAddressTextField() { TextField textField = new BisqTextField(); textField.setId("address-text-field"); textField.setEditable(false); textField.textProperty().bind(address); String tooltipText = Res.get("addressTextField.copyToClipboard"); textField.setTooltip(new Tooltip(tooltipText)); textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown()); textField.setOnMouseReleased(event -> { if (wasPrimaryButtonDown && address.get() != null && address.get().length() > 0) { Utilities.copyToClipboard(address.get()); Notification walletFundedNotification = new Notification() .notification(Res.get("addressTextField.addressCopiedToClipboard")) .hideCloseButton() .autoClose(); walletFundedNotification.show(); } wasPrimaryButtonDown = false; }); textField.focusTraversableProperty().set(focusTraversableProperty().get()); //TODO app wide focus //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus()); Label copyIcon = new Label(); copyIcon.setLayoutY(3); copyIcon.getStyleClass().addAll("icon", "highlight"); copyIcon.setTooltip(new Tooltip(Res.get("addressTextField.copyToClipboard"))); AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> { if (address.get() != null && address.get().length() > 0) Utilities.copyToClipboard(address.get()); })); AnchorPane.setRightAnchor(copyIcon, 5.0); AnchorPane.setRightAnchor(textField, 30.0); AnchorPane.setLeftAnchor(textField, 0.0); getChildren().addAll(textField, copyIcon); }
Example 18
Source File: AddressTextField.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
public AddressTextField(String label) { JFXTextField textField = new BisqTextField(); textField.setId("address-text-field"); textField.setEditable(false); textField.setLabelFloat(true); textField.setPromptText(label); textField.textProperty().bind(address); String tooltipText = Res.get("addressTextField.openWallet"); textField.setTooltip(new Tooltip(tooltipText)); textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown()); textField.setOnMouseReleased(event -> { if (wasPrimaryButtonDown) GUIUtil.showFeeInfoBeforeExecute(AddressTextField.this::openWallet); wasPrimaryButtonDown = false; }); textField.focusTraversableProperty().set(focusTraversableProperty().get()); //TODO app wide focus //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus()); Label extWalletIcon = new Label(); extWalletIcon.setLayoutY(3); extWalletIcon.getStyleClass().addAll("icon", "highlight"); extWalletIcon.setTooltip(new Tooltip(tooltipText)); AwesomeDude.setIcon(extWalletIcon, AwesomeIcon.SIGNIN); extWalletIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet)); Label copyIcon = new Label(); copyIcon.setLayoutY(3); copyIcon.getStyleClass().addAll("icon", "highlight"); Tooltip.install(copyIcon, new Tooltip(Res.get("addressTextField.copyToClipboard"))); AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY); copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> { if (address.get() != null && address.get().length() > 0) Utilities.copyToClipboard(address.get()); })); AnchorPane.setRightAnchor(copyIcon, 30.0); AnchorPane.setRightAnchor(extWalletIcon, 5.0); AnchorPane.setRightAnchor(textField, 55.0); AnchorPane.setLeftAnchor(textField, 0.0); getChildren().addAll(textField, copyIcon, extWalletIcon); }
Example 19
Source File: TitleBar.java From Maus with GNU General Public License v3.0 | 4 votes |
HBox getMenuBar(Stage stage) { MenuBar menuBar = new MenuBar(); menuBar.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm()); menuBar.getStyleClass().add("background"); Label maus = (Label) Styler.styleAdd(new Label("\uD83D\uDC2D " + MausSettings.CURRENT_VERSION), "option-button"); maus.setPadding(new Insets(5, 10, 5, 10)); maus.setOnMouseClicked(event -> { String[] MausEasterEgg = { MausSettings.CURRENT_VERSION, "):", "Where's the cheese?", "#NotaRAT", "Please consider donating to Wikipedia", "Du haben keine Freunde", ":)", "Just don't get this shit detected", "Stop clicking here", "*CRASH*", "Whiskers", "BlackShades V.5", "1 bot = 1 prayer", "Why did you click here in the first place?", "Maus only continues if I get community feedback!", "INF3CTED!!11oneone!1oen", "Deditated Wam", "Meow", "┌(=^‥^=)┘", "(^._.^)ノ", "\uD83D\uDC31", "\uD83D\uDCA5", "❤ ❤ ❤", "\uD83D\uDC08", "\uD83D\uDC01", "\uD83D\uDC2D", "Cat got your tongue?", "Purrrr", "Luminosity Maus 1.5", "Spreche du Deutsche?", "Carrier pigeons are faster", "Duct Tape is more stable than this shit", "Cat got your tongue?", "Stay Tuned!", "We're in BETA!", }; Random rn = new Random(); int rnn = rn.nextInt(MausEasterEgg.length); maus.setText(MausEasterEgg[rnn]); }); Label minimize = (Label) Styler.styleAdd(new Label("_"), "option-button"); minimize.setPadding(new Insets(5, 10, 5, 10)); minimize.setOnMouseClicked(event -> stage.setIconified(true)); Label exit = (Label) Styler.styleAdd(new Label("X"), "option-button"); exit.setPadding(new Insets(5, 10, 5, 10)); exit.setOnMouseClicked(event -> { if (stage.equals(Maus.getPrimaryStage())) { Logger.log(Level.INFO, "Exit event detected. "); /* Only hide stage if Maus is set to be background persistent */ if (MausSettings.BACKGROUND_PERSISTENT) { Maus.getPrimaryStage().hide(); } else { Platform.exit(); Maus.systemTray.remove(Maus.systemTray.getTrayIcons()[0]); System.exit(0); } } else { stage.close(); } }); HBox sep = Styler.hContainer(); sep.setId("drag-bar"); final Delta dragDelta = new Delta(); sep.setOnMousePressed(mouseEvent -> { dragDelta.x = stage.getX() - mouseEvent.getScreenX(); dragDelta.y = stage.getY() - mouseEvent.getScreenY(); }); sep.setOnMouseDragged(mouseEvent -> { stage.setX(mouseEvent.getScreenX() + dragDelta.x); stage.setY(mouseEvent.getScreenY() + dragDelta.y); }); HBox hBox = Styler.hContainer(5, maus, sep, minimize, exit); hBox.setId("drag-bar"); return hBox; }
Example 20
Source File: NBTEditorDialog.java From mcaselector with MIT License | 4 votes |
public NBTEditorDialog(TileMap tileMap, Stage primaryStage) { titleProperty().bind(Translation.DIALOG_EDIT_NBT_TITLE.getProperty()); initStyle(StageStyle.UTILITY); getDialogPane().getStyleClass().add("nbt-editor-dialog-pane"); setResultConverter(p -> p == ButtonType.APPLY ? new Result(data) : null); getDialogPane().getStylesheets().addAll(primaryStage.getScene().getStylesheets()); getDialogPane().getButtonTypes().addAll(ButtonType.APPLY, ButtonType.CANCEL); getDialogPane().lookupButton(ButtonType.APPLY).setDisable(true); ((Button) getDialogPane().lookupButton(ButtonType.APPLY)).setOnAction(e -> writeSingleChunk()); NBTTreeView nbtTreeView = new NBTTreeView(primaryStage); ImageView deleteIcon = new ImageView(FileHelper.getIconFromResources("img/delete")); Label delete = new Label("", deleteIcon); delete.getStyleClass().add("nbt-editor-delete-tag-label"); delete.setDisable(true); deleteIcon.setPreserveRatio(true); delete.setOnMouseEntered(e -> { if (!delete.isDisabled()) { deleteIcon.setFitWidth(24); } }); delete.setOnMouseExited(e -> { if (!delete.isDisabled()) { deleteIcon.setFitWidth(22); } }); delete.disableProperty().addListener((i, o, n) -> { if (o.booleanValue() != n.booleanValue()) { if (n) { delete.getStyleClass().remove("nbt-editor-delete-tag-label-enabled"); } else { delete.getStyleClass().add("nbt-editor-delete-tag-label-enabled"); } } }); delete.setOnMouseClicked(e -> nbtTreeView.deleteItem(nbtTreeView.getSelectionModel().getSelectedItem())); nbtTreeView.setOnSelectionChanged((o, n) -> { delete.setDisable(n == null || n.getParent() == null); enableAddTagLabels(nbtTreeView.getPossibleChildTagTypes(n)); }); HBox options = new HBox(); options.getStyleClass().add("nbt-editor-options"); treeViewHolder.getStyleClass().add("nbt-tree-view-holder"); initAddTagLabels(nbtTreeView); options.getChildren().add(delete); options.getChildren().addAll(addTagLabels.values()); VBox box = new VBox(); treeViewHolder.setCenter(treeViewPlaceHolder); box.getChildren().addAll(treeViewHolder, options); getDialogPane().setContent(box); readSingleChunkAsync(tileMap, nbtTreeView); }