private void onSelect(SetStroke stroke) { if (stroke != null) { name.setText(stroke.getName()); abbr.setText(stroke.getAbbr()); notes.setText(stroke.getNotes()); } }
public void setTime() { DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); Date date = new Date(); timeLabel.setText(timeFormat.format(date)); dateLabel.setText(dateFormat.format(date)); }
public void initialize() throws IOException { lblMessage.setText(""); lblMessage.setText("Send Oil Change Reminder Message?"); btnCancelMessage.setOnAction( e -> { // System.exit(0); Stage stageBox = (Stage) btnCancelMessage.getScene().getWindow(); stageBox.close(); }); btnSendMessage.setOnAction( e -> { lblMessage.setText(""); lblMessage.setText("Message Sent!"); try { btnCancelMessage.setAlignment(Pos.CENTER); btnSendMessage.setVisible(false); btnCancelMessage.setText("Done!"); Parent stageBox = btnCancelMessage.getParent(); ((BorderPane) stageBox).setCenter(btnCancelMessage); } catch (Exception exception) { } }); }
@Override public void initialize(URL url, ResourceBundle rb) { label1.setText(""); label2.setText(""); label1.relocate(0, label1.getLayoutY()); label2.relocate(label1.getLayoutX() + label1.getWidth(), label1.getLayoutY()); }
public void newOrder(ActionEvent actionEvent) { Order.resetOrder(); numberOfOrders = 0; myOrders = new ArrayList<>(); processBtn.setDisable(false); confirmBtn.setDisable(true); viewBtn.setDisable(true); finishBtn.setDisable(true); orderBox.setDisable(false); orderBox.setText(""); IDBox.setText(""); quantityBox.setText(""); infoBox.setText(""); subtotalBox.setText(""); IDLabel.setText("Enter Book ID for Item #" + (myOrders.size() + 1) + ":"); quantityLabel.setText("Enter quantity for Item #" + (myOrders.size() + 1) + ":"); infoLabel.setText(String.format("Item #%d info", myOrders.size() + 1)); processBtn.setText(String.format("Process Item #%d", myOrders.size() + 1)); confirmBtn.setText(String.format("Confirm Item #%d", myOrders.size() + 1)); subtotalLabel.setText("Order subtotal for " + myOrders.size() + " items:"); }
public Notification(Stage stage, int type, String message) { try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Notification.fxml")); fxmlLoader.setController(this); vbox = (VBox) fxmlLoader.load(); } catch (IOException e) { e.printStackTrace(); } if (type == INFO) { fxLabelTitle.setText("Information"); fxImageViewLogo.setImage( new Image(vbox.getClass().getResource(IMAGE_DIRECTORY + "info.png").toExternalForm())); } else if (type == SUCCESS) { fxLabelTitle.setText("Success"); fxImageViewLogo.setImage( new Image(vbox.getClass().getResource(IMAGE_DIRECTORY + "success.png").toExternalForm())); } else if (type == WARNING) { fxLabelTitle.setText("Warning"); fxImageViewLogo.setImage( new Image(vbox.getClass().getResource(IMAGE_DIRECTORY + "warning.png").toExternalForm())); } else if (type == ERROR) { fxLabelTitle.setText("Error"); fxImageViewLogo.setImage( new Image(vbox.getClass().getResource(IMAGE_DIRECTORY + "error.png").toExternalForm())); } if (!message.equals("")) { fxLabelMessage.setText(message); } show(stage); }
/** * Sets the text for the labels that shows the character fields pertaining to the user's character * and account: * * <ul> * <li>Username * <li>Character attributes: strength, speed, endurance, agility * </ul> */ private void showAccountAttributes() { usernameLabel.setText(Main.account.getUsername()); strengthLabel.setText(Integer.toString(attributes.getStrength())); speedLabel.setText(Integer.toString(attributes.getSpeed())); enduranceLabel.setText(Integer.toString(attributes.getEndurance())); agilityLabel.setText(Integer.toString(attributes.getAgility())); }
@Override public void bindData(Star data) throws NullPointerException { titleOut.setText(data.getTitle()); ratingOut.setText(new DecimalFormat("#.#").format(data.getRating())); new Thread( () -> { Image image = new Image( "file:" + PersistenceManager.getInstance().getRootPath() + EAltaiPersistence.STAR_MAIN_IMG_RELATIVE_PATH.getValue() + data.getMainImage()); double imgH = image.getHeight(); double imgW = image.getWidth(); Rectangle2D viewPort; if (imgH > imgW) { viewPort = new Rectangle2D(0, (imgH / 2) - (imgW / 2), imgW, imgW); } else if (imgH < imgW) { viewPort = new Rectangle2D((imgW / 2) - (imgH / 2), 0, imgH, imgH); } else { viewPort = new Rectangle2D(0, 0, imgH, imgW); } Platform.runLater( () -> { mainImg.setViewport(viewPort); mainImg.setImage(image); }); }) .start(); }
public void confirmItem(ActionEvent actionEvent) { orderBox.setDisable(true); subtotalLabel.setText("Order subtotal for " + myOrders.size() + " items:"); subtotalBox.setText(String.valueOf(Order.getRunningTotal())); if (myOrders.size() < numberOfOrders) { IDLabel.setText("Enter Book ID for Item #" + (myOrders.size() + 1) + ":"); quantityLabel.setText("Enter quantity for Item #" + (myOrders.size() + 1) + ":"); infoLabel.setText(String.format("Item #%d info", myOrders.size() + 1)); processBtn.setText(String.format("Process Item #%d", myOrders.size() + 1)); confirmBtn.setText(String.format("Confirm Item #%d", myOrders.size() + 1)); processBtn.setDisable(false); } IDBox.setText(""); quantityBox.setText(""); confirmBtn.setDisable(true); viewBtn.setDisable(false); finishBtn.setDisable(false); Alert alert = new Alert( Alert.AlertType.INFORMATION, "Item #" + (myOrders.size()) + " accepted", ButtonType.YES); alert.show(); }
public void confirm(ActionEvent event) { String name = nameField.getText(); if (S.isEmpty(name)) { tipsLabel.setText("错误:工具名字不能为空!"); nameField.requestFocus(); return; } String command = commandText.getText(); String order = orderField.getText(); ToolsTray bandeja = (ToolsTray) parentCombo.getSelectionModel().getSelectedItem(); Integer parentId = bandeja.getId(); ToolType toolType = (ToolType) typeCombo.getSelectionModel().getSelectedItem(); String type = toolType.getToolType(); ToolsTray toolsTray = new ToolsTray(); toolsTray.setTrayName(name); toolsTray.setCommand(command); toolsTray.setParentId(parentId); toolsTray.setToolOrder(order); toolsTray.setToolType(type); if (null == id) { dao.insert(toolsTray); id = toolsTray.getId(); tipsLabel.setText("添加成功:" + name); } else { toolsTray.setId(id); dao.update(toolsTray); tipsLabel.setText("更新成功:" + name); } refresh(null); }
public void setKoersen(String koersen) { Platform.runLater( () -> { label1.setText(koersen); label2.setText(koersen); }); }
private void updateIdentity() { Identity identity = clientConfiguration.getSelectedIdentity(); browseNav.setManaged(identity != null); contactsNav.setManaged(identity != null); syncNav.setManaged(identity != null); // inviteNav.setManaged(identity != null); selectedIdentity.setVisible(identity != null); // feebbackNav.setVisible(identity != null); avatarContainer.setVisible(identity != null); if (identity == null) { return; } final String currentAlias = identity.getAlias(); if (currentAlias.equals(lastAlias)) { return; } new AvatarView(e -> currentAlias).getViewAsync(avatarContainer.getChildren()::setAll); alias.setText(currentAlias); lastAlias = currentAlias; if (clientConfiguration.getAccount() == null) { return; } mail.setText(clientConfiguration.getAccount().getUser()); }
private void updateGeometry() { final List<Geometry> geoms = new ArrayList<>(); if (coords.size() == 1) { // single point final Geometry geom = GEOMETRY_FACTORY.createPoint(coords.get(0)); JTS.setCRS(geom, map.getCanvas().getObjectiveCRS2D()); geoms.add(geom); } else if (coords.size() == 2) { // line final Geometry geom = GEOMETRY_FACTORY.createLineString(coords.toArray(new Coordinate[coords.size()])); JTS.setCRS(geom, map.getCanvas().getObjectiveCRS2D()); geoms.add(geom); } else if (coords.size() > 2) { // polygon final Coordinate[] ringCoords = coords.toArray(new Coordinate[coords.size() + 1]); ringCoords[coords.size()] = coords.get(0); final LinearRing ring = GEOMETRY_FACTORY.createLinearRing(ringCoords); final Geometry geom = GEOMETRY_FACTORY.createPolygon(ring, new LinearRing[0]); JTS.setCRS(geom, map.getCanvas().getObjectiveCRS2D()); geoms.add(geom); } layer.getGeometries().setAll(geoms); if (geoms.isEmpty()) { uiArea.setText("-"); } else { uiArea.setText( NumberFormat.getNumberInstance() .format( MeasureUtilities.calculateArea( geoms.get(0), map.getCanvas().getObjectiveCRS2D(), uiUnit.getValue()))); } }
public void deleteEmployee(EmployeeVO employeeVO) { LOG.info("Enter : deleteEmployee"); try { DialogResponse response = Dialogs.showConfirmDialog( new Stage(), "Do you want to delete selected customer(s)", "Confirm", "Delete customer", DialogOptions.OK_CANCEL); if (response.equals(DialogResponse.OK)) { helpDAO.deleteEmployees(employeeVO); message.setText(CommonConstants.EMPLOYEE_DELETE_SUCCESS); message.getStyleClass().remove("failure"); message.getStyleClass().add("success"); message.setVisible(true); fillTableFromData(); } } catch (Exception e) { message.setText(CommonConstants.FAILURE); message.getStyleClass().remove("success"); message.getStyleClass().add("failure"); message.setVisible(true); LOG.error(e.getMessage()); } LOG.info("Exit : deleteEmployee"); }
private void runThread() { try { while (!isFinished) { Thread.sleep(everyupdates); currentTime += 1; if (currentTime < taskSeconds) { Platform.runLater( () -> { double percentageToShow = (currentTime * 100 / taskSeconds); double progressPercentage = (currentTime * 1.0 / taskSeconds); lblStatus.setText(String.format("%s %%", Double.toString(percentageToShow))); prgStatus.setProgress(progressPercentage); lblRemainingTime.setText( String.format("Remaining time: %s seconds", taskSeconds - currentTime)); }); } else { isFinished = true; } } listener.onProgressFinished(); } catch (Exception ex) { } }
private void setFg(int change) { int tmp = cfg + change; if (tmp >= 0 && tmp < this.figures.size() && this.figures.size() > 0) { cfg += change; GenericElement fg = this.figures.get(cfg); fgName.setText((String) fg.getAttr("name").getValue()); fgLive.setText(fg.getAttr("live").getValue().toString()); fgType.setText((String) fg.getAttr("type").getValue()); fgDestroy.setText(fg.getAttr("destroy").getValue().toString()); fgDescription.setText((String) fg.getAttr("description").getValue()); // validate if the picture already exist try { fgGC.setFill(Color.WHITE); fgGC.fillRect(0, 0, 200, 200); fgGC.drawImage( new Image(new File((String) fg.getAttr("picture").getValue()).toURI().toString()), 0, 0, 200, 200); } catch (Exception npe) { npe.printStackTrace(); } } }
@FXML private void buttonCheckClicked(Event event) { DefectSet leftSide = new DefectSet(prefix); DefectSet rightSide = new DefectSet(prefix); leftSide.load(textInputLeft.getText(), textPrefix.getText(), textMax.getText()); rightSide.load(textInputRight.getText(), textPrefix.getText(), textMax.getText()); labelInputLeft.setText(leftSide.size() + " defect(s) found."); labelInputRight.setText(rightSide.size() + " defect(s) found."); DefectSet outputLeft = leftSide.subtract(rightSide); DefectSet outputRight = rightSide.subtract(leftSide); DefectSet intersect = leftSide.intersect(rightSide); textOutputLeft.setStyle("-fx-text-fill: blue;"); textOutputLeft.setText(outputLeft.listAll()); labelOutputLeft.setText(outputLeft.size() + " missed defect(s) found."); textOutputRight.setStyle("-fx-text-fill: red;"); textOutputRight.setText(outputRight.listAll()); labelOutputRight.setText(outputRight.size() + " missed defect(s) found."); textOutputCenter.setStyle("-fx-text-fill: green;"); textOutputCenter.setText(intersect.listAll()); labelOutputCenter.setText(intersect.size() + " defect(s) covered by both side."); }
private void populateAdminHeaders() { HashMap<String, String> adminMap = Main.getAdminDetails(); adminAgencyName.setText(adminMap.get("name")); adminMobileLabel.setText(adminMap.get("mobile")); adminAddrLabel.setText(adminMap.get("addr")); }
@FXML private void buttonListenerEdit(ActionEvent event) { Employee emp = new Employee(); try { emp.setId(Integer.parseInt(tfInfoId.getText())); emp.setName(tfInfoName.getText()); emp.setPosition(tfInfoPos.getText()); emp.setStreet(tfInfoStreet.getText()); StringTokenizer tokens = new StringTokenizer(tfInfoCSZ.getText(), ","); // REQ#2 String cityState = tokens.nextToken().toString(); String zip = tokens.nextToken(); emp.setCity(cityState.substring(0, cityState.length() - 3)); emp.setState(cityState.substring(cityState.length() - 2)); emp.setZip(zip); emp.setPayRate(Double.parseDouble(tfInfoPayRate.getText())); Environment.updateEmployee(emp); lblEditConfirm.setText("Employee Updated"); } catch (MinimumWageException e) { // REQ#11 REQ#12 lblWageError.setVisible(true); } catch (Exception e) { lblEditConfirm.setText("Error Could Not Update Employee"); } if (rbHourly.isSelected()) { initialize(); populateHourlyEmployee(); } else if (rbSalary.isSelected()) { initialize(); populateSalaryEmployee(); } }
/** Action taken on button click Continue. Creates a player or displays an error. */ @FXML public final void confirmChoices() { if (textName.getText().isEmpty()) { lblWarning.setText("Please enter a name."); } else { if (playerCount > 0) { // Gets the currently picked color final String pickedColor = cmbColor.getValue(); // Create new player final Player tempPlayer = new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue()); main.addPlayer(tempPlayer); // Add new player // Remove picked Color from list cmbColor.getItems().remove(pickedColor); // Sets combo boxes back to zero index cmbColor.getSelectionModel().select(0); cmbRace.getSelectionModel().select(0); textName.clear(); lblWarning.setText(""); playerCount--; // Decrement player count after creation playerNum++; // Increment player Label number lblPlayerNum.setText("Player " + playerNum + ": Choose Your Options"); } else { // If just one player, and end case for last player final Player tempPlayer = new Player(textName.getText(), cmbRace.getValue(), cmbColor.getValue()); main.addPlayer(tempPlayer); // Display the map Screen to start game main.showMapScreen(); } } }
/** Handle the KeyEvent when ENTER is pressed in TextInput */ private void handleInput() { upPressed = false; String input; String response; input = textInput.getText(); cmdHistory.addCommand(input); try { if (input.equals(COMMAND_HELP)) { mainApp.switchToHelp(); textInput.clear(); return; } logicOut = TaskieLogic.getInstance().execute(input); // logicOut can never be null as returned by Logic assert !(logicOut == null); // main list can never be empty as the first element is always a description of the content in // the list assert !(logicOut.getMain().isEmpty()); populate(logicOut.getMain(), logicOut.getAll()); response = logicOut.getFeedback(); feedbackLabel.setText(response); textInput.clear(); } catch (UnrecognisedCommandException e) { logger.log(Level.FINE, "invalid command at input", e); feedbackLabel.setText(INVALID_COMMAND_MESSAGE); } }
public void showEDResult(List<String> path) { // intialize alert/dialog to display edit distance result Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Result"); alert.setHeaderText("Word Path : "); alert.initModality(Modality.NONE); alert.setResizable(true); // create layout for content VBox box = new VBox(); HBox midBox = new HBox(); box.setPadding(new Insets(35, 0, 35, 0)); box.setSpacing(35); midBox.setSpacing(15); Label pathLabel = new Label(); Label numStepsLabel = new Label("Number of steps : "); Label numSteps = new Label(); Font font = new Font(14); pathLabel.setFont(font); numStepsLabel.setFont(font); numSteps.setFont(Font.font(font.getFamily(), FontWeight.BOLD, 14)); midBox.getChildren().add(numStepsLabel); midBox.getChildren().add(numSteps); midBox.setAlignment(Pos.CENTER); box.getChildren().add(pathLabel); box.getChildren().add(midBox); box.setAlignment(Pos.CENTER); alert.getDialogPane().setPrefWidth(300); // check for path if (path != null) { numSteps.setText(Integer.toString(path.size() - 1)); pathLabel.setText(String.join(" -> ", path)); Text text = new Text(pathLabel.getText()); text.setFont(font); if (text.getLayoutBounds().getWidth() > 200) { alert.getDialogPane().setPrefWidth(text.getLayoutBounds().getWidth() + 100); } } // no path found else { pathLabel.setText("No Path Found."); numSteps.setText("N/A"); } // set content and styling alert.getDialogPane().setContent(box); alert .getDialogPane() .getStylesheets() .add(getClass().getResource("application.css").toExternalForm()); alert.getDialogPane().getStyleClass().add("myDialog"); alert.showAndWait(); }
/** * Changes the main Greeting. * * @param text The text for the new greeting. */ private void changeGreeting(String text) { if (greeting == null) { topLabel.setText("Hello!"); } else { greeting = text; topLabel.setText(greeting); } }
void updateNowPresentingLabel() { if (livePresentationLabel != null && UI.selectedPresentation != null) { livePresentationLabel.setText( EpicSettings.bundle.getString("now.live.init") + UI.selectedPresentation.toString()); } else { livePresentationLabel.setText(EpicSettings.bundle.getString("now.live")); } }
@Override public void setElementText(ResourceBundle rb) { lbAddress.setText(rb.getString("keyIP")); btnOK.setText(rb.getString("key_miLogin")); btnCancel.setText(rb.getString("key_miExit")); lUser.setText(rb.getString("keyLoginUser")); lPassword.setText(rb.getString("keyLoginPassword")); }
@Override public void handle(ActionEvent pActionEvent) { if (aText.getText().equals(PART_1)) { aText.setText(PART_2); } else { aText.setText(PART_1); } }
@Override public void initialize(URL url, ResourceBundle rb) { formulario.setText(idioma.getMensagem("despesa") + " - " + idioma.getMensagem("item")); Botao.prepararBotaoModal(this, botaoController, categoriaController); labelCategoria.setText(idioma.getMensagem("categoria") + ":"); labelNome.setText(idioma.getMensagem("nome") + ":"); new DespesaCategoria().montarSelectCategoria(categoriaController.getComboCategoria()); }
public void enter(ActionEvent event) throws IOException { EnteredBudget = amt.getText(); if (EnteredBudget.compareTo("") == 0) lb1.setText("Enter something"); else { Available1 = Integer.parseInt(EnteredBudget); lb1.setText("Entered"); lb1.setTextFill(Color.GREEN); fileWrite(EnteredBudget); } }
@Override public void initialize(URL location, ResourceBundle resources) { toValidate = creditRequestService.getNotValidatedCreditRequests(); if (toValidate.isEmpty()) { statusLabel.setText("No Financial Reports to Validate"); } else { statusLabel.setText("Validate the following Financial Reports"); } toValidate.forEach(f -> creditRequestAccordion.getPanes().add(createTitledPane(f))); }
/** Method validate calls when LoginButton was clicked. */ public void validate(ActionEvent event) throws IOException { String username = userField.getText(); String userPassword = passwordBox.getText(); if (username.equals("user") && userPassword.equals("user")) { labelInfo.setText("valid"); loadTableScene(); } else { labelInfo.setText("Username/Password is incorrect"); } }