/** Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { handeller = new hang(); switch (hang.lang) { case "AR": handeller.loadWords(hang.wordpathAR); break; case "FR": handeller.loadWords(hang.wordpathFR); break; case "EN": handeller.loadWords(hang.wordpathEN); break; case "ES": handeller.loadWords(hang.wordpathES); break; default: handeller.loadWords(hang.wordpathEN); } handeller.loadWords(hang.wordpathEN); Breload.setDisable(true); Btest.setDisable(true); Rword.setDisable(true); LHisto.setItems(data); Toption.setText("............"); Image image = new Image("/resource/original.gif"); img.setImage(image); // Set languag Menu imglang.setImage(new Image("/resource/en.png")); }
public ImageView getIcon() { Image image = FileFetch.getImageFromFile("pin56_small.svg", 22, 22, true, true); ImageView imageView = new ImageView(image); imageView.setFitHeight(22); imageView.setFitWidth(22); return imageView; }
public AlertHandler(String message, EventHandler<ActionEvent> confirmHandler) { super(14); // add controls to the popup. final Label promptMessage = new Label(message); final ImageView alertImage = new ImageView(ResourceUtil.getImage("alert_48.png")); alertImage.setFitHeight(32); alertImage.setPreserveRatio(true); promptMessage.setGraphic(alertImage); promptMessage.setWrapText(true); promptMessage.setPrefWidth(350); // action button text setup. HBox buttonBar = new HBox(20); final Button confirmButton = new Button(getString("dialog.continue")); confirmButton.setDefaultButton(true); buttonBar.getChildren().addAll(confirmButton); // layout the popup. setPadding(new Insets(10)); getStyleClass().add("alert-dialog"); getChildren().addAll(promptMessage, buttonBar); final DropShadow dropShadow = new DropShadow(); setEffect(dropShadow); // confirm and close the popup. confirmButton.setOnAction(confirmHandler); }
@Override public void start(Stage primaryStage) throws Exception { top = new Top(this); tWindow = new TeacherWindow(); sWindow = new StudentWindow(); // Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); primaryStage.setTitle("Jeopardy"); background.setImage(jeopardy); stack.getChildren().add(background); stack.getChildren().add(border); border.setTop(top); Scene scene = new Scene(stack, 800, 800); primaryStage.setScene(scene); background.fitWidthProperty().bind(scene.widthProperty()); background.fitHeightProperty().bind(scene.heightProperty()); primaryStage.show(); top.tButton.setOnAction( e -> { System.out.println("clicked"); displayTeacherWindow(); }); top.sButton.setOnAction( e -> { displayStudentWindow(); }); }
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); }
@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 loadMapEditor(Group root) { Logic.Images.LoadImagesEditor li = new LoadImagesEditor(); li.loadMapEditor(); Group meGroup = new Group(); ivHover = new ImageView(Objekte.getImgMapEditor().getSingleBorderHover()); ivHover.setVisible(true); Gui.Listener.EditorHoverListener eHoverL = new Gui.Listener.EditorHoverListener(ivHover); for (int y = 0; y < Objekte.getMapData().getMapSizeY(); y++) { for (int x = 0; x < Objekte.getMapData().getMapSizeX(); x++) { ImageView iv = new ImageView(Objekte.getImgMapEditor().getSingleBorder()); iv.setLayoutX(x * 25); iv.setLayoutY(y * 25); eHoverL.addImageView(iv); iv.hoverProperty().addListener(eHoverL); meGroup.getChildren().add(iv); } } root.getChildren().add(meGroup); root.getChildren().add(ivHover); loadEditorPalette(root); loadMapUI(root); loadEditorButtons(root); loadMapNumbers(root); }
@FXML private void Play(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { if (j == 0) { listView.getSelectionModel().select(j); listView.getFocusModel().focus(j); } if (mp != null) { MediaPlayer.Status status = mp.getStatus(); if (status == MediaPlayer.Status.UNKNOWN || status == MediaPlayer.Status.HALTED) { return; } if (status == MediaPlayer.Status.PAUSED || status == MediaPlayer.Status.READY || status == MediaPlayer.Status.STOPPED) { if (atEndOfMedia) { atEndOfMedia = false; } onPlay(); mp.play(); statusDisplay.toBack(); play = true; } else { mp.pause(); statusDisplay.toFront(); play = false; } } } }
// wyœwietla wszystkie playlisty private void drawPlaylists() { for (int i = 0; i < playlistList.size(); i++) { VBox vBox = new VBox(5); ImageView playlistCover = new ImageView(new Image(new File("temp_cover.png").toURI().toString())); playlistCover.setFitWidth(130); playlistCover.setPreserveRatio(true); playlistCover.setSmooth(true); int ext = playlistList.get(i).getName().lastIndexOf('.'); Text playlistTitle = new Text(playlistList.get(i).getName().substring(0, ext)); playlistTitle.getStyleClass().add("text"); vBox.getChildren().addAll(playlistCover, playlistTitle); vBox.setAlignment(Pos.CENTER); vBox.setOnMouseClicked( e -> { Text tempText = (Text) vBox.getChildren().get(1); showCurrentPlaylist(new File("Playlists/" + tempText.getText() + ".fpl")); }); flowPane.getChildren().add(vBox); } }
/** Sets the events for each label in the grid. */ private void setEvents() { for (Label label : labels) { label.setOnMouseClicked( event -> { int index = gridPane.getRowIndex(label); chosenPlugin[0] = plugins.get(index).get(0); curIndex = index; chosenPlugin[1] = plugins.get(index).get(1); chosenPreview = preview.get(index).get(0); description = appData.get(index).get(1); goToNextScreen("/fxml/PluginInfo.fxml"); }); } for (ImageView image : iconsView) { image.setOnMouseClicked( event -> { int index = gridPane.getRowIndex(image); chosenPlugin[0] = plugins.get(index).get(0); curIndex = index; chosenPlugin[1] = plugins.get(index).get(1); chosenPreview = preview.get(index).get(0); description = appData.get(index).get(1); goToNextScreen("/fxml/PluginInfo.fxml"); }); } }
@FXML private void onOkButtonClicked() { if (!headerTextField.getText().isEmpty() || picturePreview.getImage() != null) { HTMLHeader header; if (!headerTextField.getText().isEmpty() && picturePreview.getImage() == null) { header = new HTMLHeader(headerTextField.getText()); System.out.println("Header only has text."); } else if (headerTextField.getText().isEmpty() && picturePreview.getImage() != null) { header = new HTMLHeader(picturePreview.getImage()); System.out.println("Header only has image."); } else { header = new HTMLHeader(headerTextField.getText(), picturePreview.getImage()); System.out.println("Header has both image and text."); } ApplicationManager.getInstance().setWebPageHeader(header); System.out.println("Attempting to set header to webpage."); // --------------------Added By James------------------------------------------------ // JavaToHTML HTML = new JavaToHTML(); // ApplicationManager.getInstance().getHtmlGenerator().setHeaderFromGUI(headerTextField.getText(),picturePath.getText()); // writeAndRefresh(); // --------------------End Added By James------------------------------------------------ } else { System.out.println("Header has nothing. Not creating an object."); } Stage stage = (Stage) okButton.getScene().getWindow(); stage.close(); }
private Scene createMainTetrisScene() { mainPane = new BorderPane(); VBox mainBox = new VBox(); mainBox.setPadding(new Insets(200, 0, 0, 20)); mainBox.getChildren().add(mainGrid); mainGrid.setOnKeyPressed(new KeyboardHandler()); mainPane.setBottom(mainBox); mainPane.setTop(createActionPane()); mainPane.setRight(createStatePane()); Group group = new Group(); for (int i = 19; i >= 0; i--) { for (int j = 0; j < 10; j++) { Image img; if (mainGrid.getColor(i, j) != Color.DARKGRAY) { img = new Image(getClass().getResourceAsStream("RED.png")); } else { img = new Image(getClass().getResourceAsStream("EMPTY.png")); } ImageView iView = new ImageView(img); iView.setX(j * 17); iView.setY(i * 16); iView.setOpacity(1); iView.setPreserveRatio(true); group.getChildren().addAll(iView); } } Scene scene = new Scene(group, 600, 600); mainPane.setCenter(group); return new Scene(mainPane, 380, 540); // 540 }
// ******************** Methods ******************************************* protected void handleEvents(final String EVENT_TYPE) { if ("REDRAW".equals(EVENT_TYPE)) { pane.setEffect(getSkinnable().isShadowsEnabled() ? mainInnerShadow1 : null); shadowGroup.setEffect(getSkinnable().isShadowsEnabled() ? FOREGROUND_SHADOW : null); updateLcdDesign(height); redraw(); } else if ("RESIZE".equals(EVENT_TYPE)) { aspectRatio = getSkinnable().getPrefHeight() / getSkinnable().getPrefWidth(); resize(); redraw(); } else if ("LCD".equals(EVENT_TYPE)) { updateLcdDesign(height); } else if ("VISIBILITY".equals(EVENT_TYPE)) { crystalOverlay.setManaged(getSkinnable().isLcdCrystalEnabled()); crystalOverlay.setVisible(getSkinnable().isLcdCrystalEnabled()); unitText.setManaged(!getSkinnable().getUnit().isEmpty()); unitText.setVisible(!getSkinnable().getUnit().isEmpty()); upperLeftText.setManaged(getSkinnable().isMinMeasuredValueVisible()); upperLeftText.setVisible(getSkinnable().isMinMeasuredValueVisible()); upperRightText.setManaged(getSkinnable().isMaxMeasuredValueVisible()); upperRightText.setVisible(getSkinnable().isMaxMeasuredValueVisible()); lowerRightText.setManaged(!getSkinnable().getSubTitle().isEmpty()); lowerRightText.setVisible(!getSkinnable().getSubTitle().isEmpty()); lowerCenterText.setManaged(getSkinnable().isOldValueVisible()); lowerCenterText.setVisible(getSkinnable().isOldValueVisible()); resize(); redraw(); } else if ("SECTION".equals(EVENT_TYPE)) { sections = getSkinnable().getSections(); updateSectionColors(); resize(); redraw(); } }
// wyœwietla wszystkie albumy private void drawAlbums() { for (int i = 0; i < albumList.size(); i++) { VBox vBox = new VBox(5); // ok³adka albumu Song tempSong = new Song(albumList.get(i).albumSongList.get(0)); ImageView albumCover = new ImageView(tempSong.getAlbumCover()); albumCover.setFitWidth(130); albumCover.setPreserveRatio(true); albumCover.setSmooth(true); albumCover.imageProperty().bind(tempSong.albumCoverProperty()); // tytu³ albumu Text albumTitle = new Text(albumList.get(i).getAlbumTitle()); albumTitle.getStyleClass().add("text"); vBox.getChildren().addAll(albumCover, albumTitle); vBox.setAlignment(Pos.CENTER); // dodaje do ka¿dego albumu listener którym otwiera listê z piosenkami vBox.setOnMouseClicked( e -> { Text tempText = (Text) vBox.getChildren().get(1); for (int j = 0; j < albumList.size(); j++) { if (albumList.get(j).getAlbumTitle().equals(tempText.getText())) { showCurrentAlbum(albumList.get(j)); break; } } }); flowPane.getChildren().add(vBox); } }
public void openImageFile(Resource resource) { Tab tab = new Tab(); tab.setClosable(true); if (resource == null) { Dialogs.create() .owner(tabPane) .title("Datei nicht vorhanden") .message( "Die angeforderte Datei ist nicht vorhanden und kann deshalb nicht geöffnet werden.") .showError(); return; } tab.setText(resource.getFileName()); ImageResource imageResource = (ImageResource) resource; ImageViewerPane pane = new ImageViewerPane(); pane.setImageResource(imageResource); ImageView imageView = pane.getImageView(); imageView.setImage(imageResource.asNativeFormat()); imageView.setFitHeight(-1); imageView.setFitWidth(-1); Label imagePropertiesLabel = pane.getImagePropertiesLabel(); imagePropertiesLabel.setText(imageResource.getImageDescription()); tab.setContent(pane); tab.setUserData(resource); tabPane.getTabs().add(tab); tabPane.getSelectionModel().select(tab); }
public ArrayList<Location> displayRange( ArrayList<ImageView> tiles, BattleMem player, Location[][] map, ArrayList<BattleMem> people) { ArrayList<Location> ans = new ArrayList<Location>(); int range = player.member.getMove(); int xLimit = map[0].length; int yLimit = map.length; for (int i = player.mapLoc.x - range; i <= player.mapLoc.x + range; i++) { for (int j = player.mapLoc.y - range; j <= player.mapLoc.y + range; j++) { if (j >= 0 && j < yLimit) { if (i >= 0 && i < xLimit) { if (Math.abs(j - player.mapLoc.y) + Math.abs(i - player.mapLoc.x) <= range) { Image t = new Image("fantasytactics/images/tile.png", 66, 98, false, false); boolean nonaccess = false; for (BattleMem k : people) { if (k.mapLoc.equals(new Location(i, j))) { nonaccess = true; break; } } if (!nonaccess) { if (map[j][i] != null) { ans.add(map[j][i]); ImageView tile = new ImageView(t); tile.setX(map[j][i].x); tile.setY(map[j][i].y); tiles.add(tile); } } } } } } } return ans; }
@SuppressWarnings("JavadocMethod") public ProjectSettingsEditor( Parent root, ProjectSettings projectSettings, AppSettings appSettings) { super(); VBox content = new VBox( new CustomPropertySheet(BeanPropertyUtils.getProperties(projectSettings)), new Separator(), new CustomPropertySheet(BeanPropertyUtils.getProperties(appSettings))); content.setSpacing(5.0); DialogPane pane = getDialogPane(); pane.getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL); pane.setContent(content); pane.styleProperty().bind(root.styleProperty()); pane.getStylesheets().addAll(root.getStylesheets()); pane.setPrefSize(DPIUtility.SETTINGS_DIALOG_SIZE, DPIUtility.SETTINGS_DIALOG_SIZE); ImageView graphic = new ImageView(new Image(getClass().getResourceAsStream("icons/settings.png"))); graphic.setFitWidth(DPIUtility.SMALL_ICON_SIZE); graphic.setFitHeight(DPIUtility.SMALL_ICON_SIZE); setTitle("Settings"); setHeaderText("Settings"); setGraphic(graphic); setResizable(true); }
private void createImageViews() { for (int visibleX = 0; visibleX < getViewModel().getNbVisibleTilesX(); visibleX++) { for (int visibleY = 0; visibleY < getViewModel().getNbVisibleTilesY(); visibleY++) { ImageView node = spritesheet.createImageView(0); node.setLayoutX(getViewModel().visibleTileToScreenX(visibleX)); node.setLayoutY(getViewModel().visibleTileToScreenY(visibleY)); /* final int vX = visibleX; final int vY = visibleY; node.setOnMouseClicked(e -> { double screenX = getViewModel().visibleTileToScreenX(vX) + e.getX(); double screenY = getViewModel().visibleTileToScreenY(vY) + e.getY(); double worldX = getViewModel().screenToWorldX(screenX); double worldY = getViewModel().screenToWorldY(screenY); double worldZ = getViewModel().getCurrentZLevel(); //double worldZ = getViewModel().getLowestVisibleZ(vX, vY); //getUserInputHandler().worldPointClicked(worldX, worldY, worldZ, e); //e.consume(); }); */ visibleImageViews[getIndexForView(visibleX, visibleY)] = node; tilePanels[0].getChildren().add(node); showAsAnchored( visibleX, visibleY, getViewModel().getAnchorMatrix().getValueAt(visibleX, visibleY)); } } }
@Override public void initialize(URL url, ResourceBundle rb) { listView .getSelectionModel() .selectedItemProperty() .addListener( (ObservableValue<? extends String> ov, String oldValue, String newValue) -> { j = listView.getSelectionModel().getSelectedIndex(); if (!fileList.isEmpty()) { statusDisplay.toBack(); file = new File(fileList.get(j).getPath()); String MEDIA_URL = file.toURI().toString(); Media media = new Media(MEDIA_URL); albumCover.setImage(DEFAULT_ALBUM_COVER); media .getMetadata() .addListener( (Change<? extends String, ? extends Object> ch) -> { if (ch.wasAdded()) { handleMetadata(ch.getKey(), ch.getValueAdded()); } }); if (MEDIA_URL.endsWith(".mp3") || MEDIA_URL.endsWith(".MP3")) { playAudio(media); } if (MEDIA_URL.endsWith(".mp4") || MEDIA_URL.endsWith(".MP4")) { playVideo(media); } onPlay(); } }); }
private void configureButton(final ImageView imageView) { imageView.setFitHeight(32); imageView.setFitWidth(32); imageView.setPreserveRatio(true); imageView.setSmooth(true); imageView.getStyleClass().add("launcherIcon"); }
public PannelloDado(Integer i1, GameManagerAstratta gm) { media = new Media(new File(path).toURI().toString()); this.gm = gm; if (i1 != 0) primo = i1.toString(); else primo = "roll"; setMinWidth(GridPane.USE_COMPUTED_SIZE); setMinHeight(GridPane.USE_COMPUTED_SIZE); setPrefWidth(GridPane.USE_COMPUTED_SIZE); setPrefHeight(GridPane.USE_COMPUTED_SIZE); setMaxWidth(GridPane.USE_COMPUTED_SIZE); setMaxHeight(GridPane.USE_COMPUTED_SIZE); imgDadoUno = new Image("file:dadi/" + primo + ".gif"); imageViewUno = new ImageView(imgDadoUno); ColumnConstraints column1 = new ColumnConstraints(); column1.setPercentWidth(25); getColumnConstraints().addAll(column1); add(imageViewUno, 1, 0); imageViewUno.setTranslateZ(-1); eventoDado = new DadiListener(); imageViewUno.addEventHandler(MouseEvent.MOUSE_RELEASED, eventoDado); }
@FXML private void gotoNP(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { if (go == false) { npView.setVisible(true); mView.toBack(); timeProgress.setTextFill(Color.WHITE); Stage stage = (Stage) root.getScene().getWindow(); stage.setResizable(true); btnPaFull.setImage(new Image("icon/Full_button/full.png")); go = true; } else { if (play == true) { Stage stage = (Stage) root.getScene().getWindow(); if (full == false) { stage.setFullScreen(true); btnPaFull.setImage(new Image("icon/Full_button/full_off.png")); full = true; } else { stage.setFullScreen(false); btnPaFull.setImage(new Image("icon/Full_button/full.png")); full = false; } } } } }
private void setCountry(String country) { if (StringUtils.isEmpty(country)) { countryImageView.setVisible(false); } else { countryImageView.setImage(countryFlagService.loadCountryFlag(country)); countryImageView.setVisible(true); } }
private void updateDepth(int visibleX, int visibleY, int newDepth) { if (newDepth < tilePanels.length) { int index = getIndexForView(visibleX, visibleY); ImageView view = visibleImageViews[index]; ((Pane) view.getParent()).getChildren().remove(view); tilePanels[newDepth].getChildren().add(view); } }
private void gamePicture() throws FileNotFoundException { ImageView coloredBoxImg = new ImageView(new Image(new FileInputStream("lib/" + selectedGame + ".png"))); coloredBoxImg.setFitHeight(gamePicture.getPrefHeight() - 25); coloredBoxImg.setFitWidth(gamePicture.getPrefWidth() - 25); gamePicture.setGraphic(coloredBoxImg); gamePicture.setStyle(buttonStyle); }
private void setAvatarUrl(String avatarUrl) { if (StringUtils.isEmpty(avatarUrl)) { avatarImageView.setVisible(false); } else { avatarImageView.setImage(avatarService.loadAvatar(avatarUrl)); avatarImageView.setVisible(true); } }
@FXML private void btvolumeChange1(MouseEvent event) { if (volumeSlider.getValue() != 0) { volumeButton.setImage(new Image("icon/Volume_button/volume_hover.png")); } else { volumeButton.setImage(new Image("icon/Volume_button/mute_hover.png")); } }
public void drawBarUp() { barUpR = new Rectangle(0, 0, 1000, 50); barUpR.setFill(new ImagePattern(barUp, 0, 0, barUp.getWidth(), barUp.getHeight(), false)); i = new ImageView(); i.setImage(barUpRight); i.setX(1000); i.setY(0); }
void setPrimo(int risultato) { imgDadoUno = new Image("file:dadi/" + risultato + ".gif"); imageViewUno = new ImageView(imgDadoUno); imageViewUno.addEventHandler(MouseEvent.MOUSE_RELEASED, eventoDado); imageViewUno.setTranslateZ(-1); this.getChildren().clear(); add(imageViewUno, 1, 0); }
@FXML private void btplayChange2(MouseEvent event) { if (play == false) { playButton.setImage(new Image("icon/PlayPause_button/play.png")); } else { playButton.setImage(new Image("icon/PlayPause_button/pause.png")); } }