Java Examples for javafx.scene.image.Image
The following java examples will help you to understand the usage of javafx.scene.image.Image. These source code samples are taken from different open source projects.
Example 1
| Project: javafx-TKMapEditor-master File: AboutDialog.java View source code |
public static void showAlertDialog() {
if (newAlertDialog == null) {
newAlertDialog = new Stage(StageStyle.DECORATED);
newAlertDialog.setResizable(false);
wiAlertDialog = new AboutDialog();
newAlertDialog.setTitle("关于");
newAlertDialog.getIcons().add(new Image(Main.class.getResourceAsStream("icon.png")));
newAlertDialog.setScene(new Scene(wiAlertDialog, 600, 400));
newAlertDialog.show();
} else {
newAlertDialog.show();
}
}Example 2
| Project: JavaFXTutorials-master File: Main.java View source code |
@Override
public void start(Stage primaryStage) {
try {
Parent root = FXMLLoader.load(getClass().getResource("/fxml/Main.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("/css/application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.setTitle("JavaFX and Maven");
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/images/icon.png")));
primaryStage.show();
} catch (Exception e) {
e.printStackTrace();
}
}Example 3
| Project: AndroidDevToolbox-master File: Main.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
setUserAgentStylesheet(STYLESHEET_CASPIAN);
FXMLLoader fxmlLoader = new FXMLLoader();
ResourceBundle resourceBundle = ResourceBundle.getBundle("bundles.Bundle", LocaleHelper.getLocale());
Parent root = fxmlLoader.load(FileHelper.getFxmlUrl(getClass(), "MainScreen.fxml"), resourceBundle);
Scene scene = new Scene(root);
String cssURL = getClass().getClassLoader().getResource(AppConfig.APP_CSS_PATH).toExternalForm();
scene.getStylesheets().add(cssURL);
String appURL = getClass().getClassLoader().getResource(AppConfig.APP_ICON_PATH).toExternalForm();
primaryStage.setTitle(resourceBundle.getString("AppName"));
primaryStage.getIcons().add(new Image(appURL));
primaryStage.setScene(scene);
primaryStage.setResizable(false);
primaryStage.setMinWidth(850);
primaryStage.setMinHeight(750);
primaryStage.show();
}Example 4
| Project: behaviorsearch-master File: MainGUI.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
try {
// root gets layout from BSearchMain.fxml file, created with FX
// Scene Builder.
FXMLLoader loader = new FXMLLoader(getClass().getResource("BSearchMain.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.setTitle("Untitled" + getWindowTitleSuffix());
Platform.setImplicitExit(false);
MainController controller = (MainController) loader.getController();
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
if (!controller.checkDiscardOkay()) {
event.consume();
} else {
Platform.exit();
System.exit(0);
}
}
});
primaryStage.show();
Image icon = new Image(GeneralUtils.getResource("icon_behaviorsearch.png").toURI().toString());
primaryStage.getIcons().add(icon);
//controller.actionNew();
} catch (Exception e) {
e.printStackTrace();
}
}Example 5
| Project: downlords-faf-client-master File: ModDetailControllerTest.java View source code |
@Test
public void testSetMod() throws Exception {
ModInfoBean mod = ModInfoBeanBuilder.create().defaultValues().name("Mod name").author("Mod author").thumbnailUrl(getClass().getResource("/theme/images/tray_icon.png").toExternalForm()).get();
when(modService.loadThumbnail(mod)).thenReturn(new Image("/theme/images/tray_icon.png"));
instance.setMod(mod);
assertThat(instance.nameLabel.getText(), is("Mod name"));
assertThat(instance.authorLabel.getText(), is("Mod author"));
assertThat(instance.thumbnailImageView.getImage(), is(notNullValue()));
verify(modService).loadThumbnail(mod);
}Example 6
| Project: ElggConnect-master File: MainController.java View source code |
@FXML
/**
* Set up the Main View with configured Values
*/
void initialize() {
PropertyLoader propertyLoader = new PropertyLoader();
if (propertyLoader.valuesNotEmpty()) {
this.appname.setText(propertyLoader.getAppname());
this.subline.setText(propertyLoader.getSubline());
this.logo.setImage(new Image(propertyLoader.getImage()));
}
}Example 7
| Project: Icew1nd-master File: Main.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
//iCloudTest.dryRun("email", "password");
Font.loadFont(Main.class.getResource("binResc/Roboto-Thin.ttf").toExternalForm(), 24);
StaticStage.mainStage = primaryStage;
primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setTitle("Icew1nd");
StaticStage.loadScreen(Lite.splash() ? "Splash" : "Title");
primaryStage.setMinHeight(600);
primaryStage.setMinWidth(800);
primaryStage.setHeight(600);
primaryStage.setWidth(800);
primaryStage.getIcons().addAll(//This isn't working with my ultra-high DPI. :(
new Image(Main.class.getResourceAsStream("binResc/icon.png")));
}Example 8
| Project: livestreamer-twitch-gui-master File: App.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setMinWidth(100.0);
primaryStage.setMinHeight(80.0);
URL location = getClass().getResource("/main.fxml");
FXMLLoader loader = new FXMLLoader(location);
Parent root = loader.load();
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.setTitle("Livestreamer Twitch GUI");
MainController controller = loader.getController();
controller.setPrimaryStage(primaryStage);
controller.setHostServices(getHostServices());
primaryStage.getIcons().add(new Image("/app-icon.png"));
primaryStage.show();
SysTrayUtil.init(primaryStage);
primaryStage.setOnCloseRequest( e -> {
Platform.exit();
System.exit(0);
});
}Example 9
| Project: MiscellaneousStudy-master File: CustomCell.java View source code |
@Override
public void updateItem(CustomCellItem item, boolean isEmpty) {
super.updateItem(item, isEmpty);
if (isEmpty || item == null) {
Pane p = new Pane();
setGraphic(p);
return;
}
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/CustomCell.fxml"));
Pane root = loader.load();
CustomCellController c = loader.getController();
Image image = new Image(getClass().getResourceAsStream("/icon.png"));
c.icon.setImage(image);
c.text.setText(item.getName());
setGraphic(root);
} catch (Exception e) {
e.printStackTrace();
System.out.println("erroe!");
}
return;
}Example 10
| Project: osc-tools-master File: WorkingStatusTableCell.java View source code |
/**
* This will take the value and lookup the appropriate icon for display in
* the cell.
*/
@Override
protected void updateItem(Integer item, boolean empty) {
if (!empty) {
if (item < ICONS.length) {
String iconName = ICONS[item];
Image goImage = IMAGES[item];
if (goImage == null) {
InputStream stream = getClass().getResourceAsStream(iconName);
goImage = new Image(stream);
}
imageView.setImage(goImage);
setGraphic(hBox);
}
}
}Example 11
| Project: sea-master File: SearchThread.java View source code |
@Override
public void run() {
if (getSearchField.getText().isEmpty()) {
return;
}
try {
if (!FXController.fileList.isEmpty()) {
FXController.fileList.remove(0);
}
if (!FXController.fullTitleList.isEmpty()) {
FXController.fullTitleList.remove(0);
}
boolean validSong;
image = null;
// reset GUI view
playButton.setVisible(false);
pauseButton.setVisible(false);
albumArt.setImage(FXController.greyImage);
if (!"".equals(songLabelText.toString())) {
songLabelText.setText("");
}
loadingImage.setVisible(true);
rightSearch.setVisible(false);
leftSearch.setVisible(false);
// parse itunes info for song
String songInfoQuery = getSearchField.getText();
try {
Connection.getiTunesSongInfo(songInfoQuery, songLabelText);
// grab cover art image
CoverArtThread cat = new CoverArtThread();
cat.start();
// get download link for song
Connection.getSongFromPleer(songLabelText);
} catch (NullPointerException e) {
songLabelText.setText("Song not found");
}
try {
songLabelText.setText("[" + FXController.qualityList.get(0) + "] " + FXController.fullTitleList.get(0));
validSong = true;
} catch (IndexOutOfBoundsException e) {
songLabelText.setText("Song not found");
validSong = false;
}
if (validSong) {
if (quickDownload) {
FXController.downloadSong(progressBar);
}
// if the cover art hasn't been displayed yet, spin until it has
while (image == null) {
//spin
}
FXController.fileCounter = 0;
albumArt.setImage(null);
loadingImage.setVisible(false);
albumArt.setImage(image);
playButton.setVisible(true);
rightSearch.setVisible(true);
leftSearch.setVisible(true);
if (FXController.songPlaying == true) {
FXController.songPlaying = false;
SongControl.stopSong();
}
} else {
BufferedImage img = ImageIO.read(getClass().getClassLoader().getResource("resources/placeholder.png"));
Image test = SwingFXUtils.toFXImage(img, null);
albumArt.setImage(test);
loadingImage.setVisible(false);
rightSearch.setVisible(false);
leftSearch.setVisible(false);
}
} catch (IOExceptionInterruptedException | e) {
loadingImage.setVisible(false);
e.printStackTrace();
}
}Example 12
| Project: SlideshowFX-master File: CustomSlideshowFXStage.java View source code |
private void setDefaultProperties(final String title) {
this.initOwner(SlideshowFX.getStage());
this.setTitle(title);
this.getIcons().addAll(new Image(ResourceHelper.getInputStream("/com/twasyl/slideshowfx/images/appicons/16.png")), new Image(ResourceHelper.getInputStream("/com/twasyl/slideshowfx/images/appicons/32.png")), new Image(ResourceHelper.getInputStream("/com/twasyl/slideshowfx/images/appicons/64.png")), new Image(ResourceHelper.getInputStream("/com/twasyl/slideshowfx/images/appicons/128.png")), new Image(ResourceHelper.getInputStream("/com/twasyl/slideshowfx/images/appicons/256.png")), new Image(ResourceHelper.getInputStream("/com/twasyl/slideshowfx/images/appicons/512.png")));
}Example 13
| Project: Starbound-Mod-Manager-master File: MessageDialogueConfirm.java View source code |
@Override
protected void build(final String message, final String title, final MessageType messageType) {
this.title = title;
root = new GridPane();
root.setPadding(new Insets(43, 50, 30, 20));
root.setHgap(25);
if (messageType == MessageType.CONFIRM) {
icon = new ImageView(new Image(MessageDialogueConfirm.class.getClassLoader().getResourceAsStream("delete-file-icon.png")));
} else if (messageType == MessageType.ERROR) {
icon = new ImageView(new Image(MessageDialogueConfirm.class.getClassLoader().getResourceAsStream("error-icon.png")));
} else {
icon = new ImageView(new Image(MessageDialogueConfirm.class.getClassLoader().getResourceAsStream("delete-file-icon.png")));
}
Color color = CSSHelper.getColor("message-dialogue-confirm-warning-color", settings.getPropertyString("theme"));
FXHelper.setColor(icon, color);
messageText = new Text(message);
messageText.setId("message-dialogue-text");
messageText.setWrappingWidth(285);
HBox buttonBox = new HBox();
confirmButton = new Button(localizer.formatMessage("messagedialogueconfirm.yeswaiting", settings.getPropertyInt("confirmdelay")));
confirmButton.setId("message-dialogue-button");
confirmButton.setPrefWidth(120);
confirmButton.setPrefHeight(40);
confirmButton.setAlignment(Pos.CENTER);
noButton = new Button(localizer.getMessage("messagedialogueconfirm.no"));
noButton.setId("message-dialogue-button");
noButton.setPrefWidth(120);
noButton.setPrefHeight(40);
noButton.setAlignment(Pos.CENTER);
confirmButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
actionPerformed = DialogueAction.YES;
stage.close();
}
});
confirmButton.setDisable(true);
noButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
actionPerformed = DialogueAction.NO;
stage.close();
}
});
buttonBox.getChildren().addAll(confirmButton, noButton);
buttonBox.setSpacing(30);
buttonBox.setAlignment(Pos.CENTER);
root.add(icon, 1, 1);
root.add(messageText, 2, 1);
root.add(buttonBox, 2, 2);
}Example 14
| Project: SyncNotes-master File: NotesList.java View source code |
public void initRootLayout() {
try {
// Load root layout from fxml file.
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Register.class.getResource("NotesList.fxml"));
rootLayout = (AnchorPane) loader.load();
// Show the scene containing the root layout.
Scene scene = new Scene(rootLayout);
primaryStage.setScene(scene);
primaryStage.getIcons().add(new Image("file:logo.png"));
primaryStage.show();
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent we) {
//AutoUpdater.running = false;
}
});
} catch (IOException e) {
e.printStackTrace();
}
}Example 15
| Project: URL-pad-master File: Main.java View source code |
@Override
public void start(final Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/Launcher.fxml"));
primaryStage.setTitle("URL pad");
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/images/icon.png")));
Scene scene = new Scene(root, 300, 64);
primaryStage.setScene(scene);
primaryStage.show();
}Example 16
| Project: webcam-capture-master File: WebCamService.java View source code |
@Override
protected Image call() throws Exception {
try {
cam.open();
while (!isCancelled()) {
if (cam.isImageNew()) {
BufferedImage bimg = cam.getImage();
updateValue(SwingFXUtils.toFXImage(bimg, null));
}
}
System.out.println("Cancelled, closing cam");
cam.close();
System.out.println("Cam closed");
return getValue();
} finally {
cam.close();
}
}Example 17
| Project: bgfinancas-master File: Splash.java View source code |
@Override
public void start(Stage stage) throws Exception {
palco = stage;
palco.initStyle(StageStyle.UNDECORATED);
ImageView splash = new ImageView(new Image("/badernageral/bgfinancas/recursos/imagem/layout/splash.gif"));
VBox layout = new VBox(20);
layout.getChildren().add(splash);
Scene scene = new Scene(layout);
palco.setWidth(300);
palco.setHeight(220);
palco.setScene(scene);
palco.show();
}Example 18
| Project: chunky-master File: ChunkyLauncherFx.java View source code |
@Override
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("ChunkyLauncher.fxml"));
ChunkyLauncherController controller = new ChunkyLauncherController(settings);
loader.setController(controller);
Parent root = loader.load();
stage.getIcons().add(new Image(getClass().getResourceAsStream("chunky-cfg.png")));
stage.setTitle("Chunky Launcher");
stage.setScene(new Scene(root));
stage.setOnShowing(controller::onShowing);
ChunkyLauncherFx.stage = stage;
latch.countDown();
callback.accept(stage);
}Example 19
| Project: closurefx-builder-master File: ClosureFXPreloader.java View source code |
private Scene createPreloaderScene() {
ImageView splash = new ImageView(new Image(getClass().getResourceAsStream("resources/splash.jpg")));
bar = new ProgressBar();
bar.setMaxWidth(Double.MAX_VALUE);
VBox.setVgrow(bar, Priority.NEVER);
VBox.setVgrow(splash, Priority.NEVER);
HBox.setHgrow(bar, Priority.ALWAYS);
VBox p = new VBox();
p.getChildren().add(splash);
p.getChildren().add(bar);
return new Scene(p);
}Example 20
| Project: CSTIB-Echo-master File: avitarCellFactory.java View source code |
@Override
public void updateItem(Object item, boolean empty) {
super.updateItem(item, empty);
if (!isEmpty()) {
cellContents = new GridPane();
User user = (User) item;
String dispName;
if (user.getUsername() == null)
dispName = "Anonymous";
else if (user.getDisplayName() != null)
dispName = user.getDisplayName();
else
dispName = user.getUsername();
name = new Text(dispName);
name.setWrappingWidth(50);
avitar = new ImageView();
avitar.setFitHeight(50);
avitar.setFitWidth(50);
avitar.setImage(user.getAvatarLink() == null ? new Image("http://www.gravatar.com/avatar/") : new Image(user.getAvatarLink()));
cellContents.add(avitar, 0, 0);
cellContents.add(name, 0, 1);
setGraphic(cellContents);
this.setDisable(true);
}
}Example 21
| Project: e-fx-clipse-master File: DetailsView.java View source code |
private Node createDetailsPanel() {
uiProp = JFXBeanProperties.value("text");
ctx = new DataBindingContext();
grid = new GridPane();
grid.getStyleClass().add("my-gridpane");
grid.setHgap(10);
grid.setVgap(5);
grid.setPadding(new Insets(10, 10, 10, 10));
detailsPanelRow = 0;
addSeparator("General");
addProperty("Title", "title");
addProperty("Name", "name");
addProperty("Company", "company");
addProperty("Job Title", "jobTitle");
addProperty("Note", "note", 2);
Image portrait = new Image(getClass().getResourceAsStream("dummy.png"));
imageView = new ImageView(portrait);
grid.add(imageView, 3, 0, 1, 5);
GridPane.setValignment(imageView, VPos.BOTTOM);
GridPane.setHalignment(imageView, HPos.LEFT);
addSeparator("Business Address");
TextField street = addProperty("Street", "street", 2);
addProperty("City", "city", 2);
addProperty("Zip", "zip", 2);
addProperty("Country", "country", 2);
addSeparator("Business Phones");
addProperty("Phone", "phone", 2);
addProperty("Mobile", "mobile", 2);
addSeparator("Business Internet");
addProperty("E-Mail", "email", 2);
addProperty("Web Site", "webPage", 2);
fadeOutTransition = new FadeTransition(Duration.millis(1000), street);
fadeOutTransition.setFromValue(1.0f);
fadeOutTransition.setToValue(0.0f);
// fadeOutTransition.setAutoReverse(true);
fadeInTransition = new FadeTransition(Duration.millis(1000), street);
fadeInTransition.setFromValue(0.0f);
fadeInTransition.setToValue(1.0f);
return grid;
}Example 22
| Project: fx-inject-master File: ContactRendererFactory.java View source code |
@PostConstruct
protected void initialize() {
this.defaultPersonImage = new Image(this.getClass().getResourceAsStream("/com/cathive/fx/apps/contacts/icons/avatar-default.png"));
this.defaultFamilyImage = new Image(this.getClass().getResourceAsStream("/com/cathive/fx/apps/contacts/icons/system-users.png"));
this.defaultCompanyImage = new Image(this.getClass().getResourceAsStream("/com/cathive/fx/apps/contacts/icons/avatar-default.png"));
}Example 23
| Project: FxProjects-master File: JFXPoetry.java View source code |
@Override
public void start(Stage stage) {
stage.setTitle("Pippa's Song by Robert Browning");
stage.setResizable(false);
StackPane root = new StackPane();
stage.setScene(new Scene(root, 500, 375));
Image image = new Image("http://farm1.static.flickr.com/39/121693644_75491b23b0.jpg");
ImageView imageView = new ImageView(image);
root.getChildren().add(imageView);
Text text = new Text("The year's at the spring,\n" + "And day's at the morn;\n" + "Morning's at seven;\n" + "The hill-side's dew-pearled;\n" + "The lark's on the wing;\n" + "The snail's on the thorn;\n" + "God's in His heaven--\n" + "All's right with the world!");
text.setFont(Font.font("Serif", FontWeight.BOLD, 30));
text.setFill(Color.GOLDENROD);
text.setEffect(DropShadowBuilder.create().radius(3).spread(0.5).build());
text.setCache(true);
root.getChildren().add(text);
final TranslateTransition translate = TranslateTransitionBuilder.create().duration(Duration.seconds(24)).node(text).fromY(image.getHeight()).toY(0).interpolator(Interpolator.EASE_OUT).build();
translate.play();
final FadeTransition fade = FadeTransitionBuilder.create().duration(Duration.seconds(5)).node(imageView).fromValue(0).toValue(1).interpolator(Interpolator.EASE_OUT).build();
fade.play();
Media media = new Media("http://video.fws.gov/sounds/35indigobunting.mp3");
final MediaPlayer mediaPlayer = new MediaPlayer(media);
mediaPlayer.play();
Button play = new Button("Play Again");
root.getChildren().add(play);
play.visibleProperty().bind(translate.statusProperty().isEqualTo(Animation.Status.STOPPED));
play.addEventHandler(ActionEvent.ACTION, new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
fade.playFromStart();
translate.playFromStart();
mediaPlayer.stop();
mediaPlayer.play();
}
});
stage.show();
}Example 24
| Project: gef-master File: CustomNodeExample.java View source code |
@Override
protected Group doCreateVisual() {
ImageView ian = new ImageView(new javafx.scene.image.Image(getClass().getResource("ibull.jpg").toExternalForm()));
Polyline body = new Polyline(0, 0, 0, 60, 25, 90, 0, 60, -25, 90, 0, 60, 0, 25, 25, 0, 0, 25, -25, 0);
body.setTranslateX(ian.getLayoutBounds().getWidth() / 2 - body.getLayoutBounds().getWidth() / 2 - 5);
body.setTranslateY(-15);
labelText = new Text();
vbox = new VBox();
vbox.getChildren().addAll(ian, body, labelText);
return new Group(vbox);
}Example 25
| Project: itol-master File: FileListViewHandler.java View source code |
@Override
public void updateItem(File item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setGraphic(null);
setText(null);
} else {
Image fxImage = getFileIcon(item);
if (fxImage != null) {
ImageView imageView = new ImageView(fxImage);
setGraphic(imageView);
}
setText(item.getName());
}
}Example 26
| Project: jabref-master File: PdfDocumentPageViewModel.java View source code |
// Taken from http://stackoverflow.com/a/9417836/873661
private static BufferedImage resize(BufferedImage img, int newWidth, int newHeight) {
java.awt.Image tmp = img.getScaledInstance(newWidth, newHeight, java.awt.Image.SCALE_SMOOTH);
BufferedImage dimg = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = dimg.createGraphics();
g2d.drawImage(tmp, 0, 0, null);
g2d.dispose();
return dimg;
}Example 27
| Project: JacpFX-demos-master File: ChatMessageRight.java View source code |
private void initLayout() {
Text messageText = new Text(message);
HBox.setMargin(messageText, new Insets(20, 45, 0, 0));
VBox userView = new VBox();
HBox.setMargin(userView, new Insets(0, 10, 0, 0));
ImageView imageView = new ImageView(new Image("/images/user.png", 55, 55, false, false));
imageView.setFitHeight(60);
imageView.setFitWidth(60);
userView.setAlignment(Pos.CENTER);
Text nameText = new Text(name);
VBox.setVgrow(nameText, Priority.ALWAYS);
userView.getChildren().addAll(imageView, nameText);
getChildren().addAll(messageText, userView);
}Example 28
| Project: javamoney-examples-master File: FXDemo.java View source code |
public void start(final Stage primaryStage) {
try {
Scene scene = new Scene(new MainScreen());
primaryStage.setScene(scene);
primaryStage.centerOnScreen();
primaryStage.setTitle("JSR 354 JavaMoney - Demo");
// set icon
primaryStage.getIcons().add(new Image("/images/javamoney_s.png"));
primaryStage.initStyle(StageStyle.DECORATED);
primaryStage.show();
} catch (Exception e) {
LOGGER.error("Failed to start application.", e);
System.exit(-1);
}
}Example 29
| Project: JfxBrowser-master File: ImageFetcher.java View source code |
public static List<Image> getIconSeries(String property, IconSize... sizes) { List<Image> ikoner = new ArrayList<>(sizes.length); for (IconSize iconSize : sizes) { String path = getPathWithDefaultValue(property, null, iconSize.getPrefix()); InputStream stream = ImageFetcher.class.getResourceAsStream(path); if (stream != null) { ikoner.add(new Image(stream)); } else { logger.warning(String.format("Could not find resource at %s", path)); } } return ikoner; }
Example 30
| Project: jointry-master File: FileManager.java View source code |
public static void save(String title, Image image) {
refreshChooser(title);
File file = fc.showSaveDialog(null);
if (file == null) {
//ä¿?å˜å…ˆã?ŒæŒ‡å®šã?•れã?ªã?‹ã?£ã?Ÿ
return;
}
targetDirectory = file.getParent();
try {
ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", file);
} catch (IOException ex) {
Logger.getLogger(FileManager.class.getName()).log(Level.SEVERE, null, ex);
}
}Example 31
| Project: Lily-master File: LilyUI.java View source code |
public void initialize() {
Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
Stage stage = lily.getStage();
stage.setWidth(bounds.getWidth() - 2);
stage.setHeight(bounds.getHeight() * 0.9);
stage.setX((bounds.getWidth() - stage.getWidth()) / 2);
stage.setY((bounds.getHeight() - stage.getHeight()) / 2);
Parent root = layout.getBorderPane();
root.getStylesheets().add("/ui/themes/light_material.css");
Scene scene = new Scene(root, stage.getWidth(), stage.getHeight());
stage.setScene(scene);
CloseHandler handler = new CloseHandler(lily);
stage.setOnCloseRequest(handler);
stage.getIcons().add(new Image("/ui/icons/icon.png"));
stage.setTitle(LilyConstants.NAME + " " + LilyConstants.VERSION);
}Example 32
| Project: mavenize-master File: WorkingTableCell.java View source code |
/**
* This will take the value and lookup the appropriate icon for display in
* the cell.
*/
@Override
protected void updateItem(Integer item, boolean empty) {
super.updateItem(item, empty);
if (!empty) {
if (item < ICONS.length) {
String iconName = ICONS[item];
InputStream stream = getClass().getResourceAsStream(iconName);
Image goImage = new Image(stream);
imageView.setImage(goImage);
setGraphic(hBox);
}
}
}Example 33
| Project: mephisto_iii-master File: ComponentUtil.java View source code |
public static Image toFXImage(ImageResource image) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); ImageIO.write(image.getImage(), image.getImageFormat(), os); InputStream is = new ByteArrayInputStream(os.toByteArray()); return new Image(is, image.getImage().getWidth(), image.getImage().getHeight(), false, true); } catch (Exception e) { LOG.error("Error converting buffered image to FX image: " + e.getMessage(), e); } return null; }
Example 34
| Project: metastone-master File: SandboxModeView.java View source code |
private void startPlayMode(ActionEvent actionEvent) {
sidebar.getChildren().setAll(getActionPromptView(), navigationPane);
backButton.setVisible(false);
playButton.setText("Stop");
ImageView buttonGraphic = (ImageView) playButton.getGraphic();
buttonGraphic.setImage(new Image(IconFactory.getImageUrl("ui/pause_icon.png")));
playButton.setOnAction(this::stopPlayMode);
NotificationProxy.sendNotification(GameNotification.START_PLAY_SANDBOX);
}Example 35
| Project: Offene-Pflege.de-master File: FXTools.java View source code |
/**
* https://community.oracle.com/message/11145722#11145722
*
* @return
*/
public static TitledPane createTitledPane(Pane root, String text, Image icon, Node content, Node... buttons) {
// final VBox root = new VBox();
final TitledPane titledPane = new TitledPane();
titledPane.setText(text);
final HBox buttonBox = new HBox(5);
buttonBox.getChildren().addAll(buttons);
final Label label = new Label();
label.textProperty().bind(titledPane.textProperty());
final AnchorPane title = new AnchorPane();
AnchorPane.setLeftAnchor(label, 0.0);
AnchorPane.setRightAnchor(buttonBox, 0.0);
title.getChildren().addAll(label, buttonBox);
titledPane.setGraphic(title);
titledPane.setContent(content);
titledPane.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
titledPane.setExpanded(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
final Region arrow = (Region) titledPane.lookup(".arrow-button");
title.prefWidthProperty().bind(new DoubleBinding() {
{
super.bind(arrow.widthProperty(), root.widthProperty());
}
@Override
protected double computeValue() {
double breathingSpace = 20;
double value = root.getWidth() - arrow.getWidth() - breathingSpace;
return value;
}
});
}
});
return titledPane;
}Example 36
| Project: pieShare-master File: WorkingMessageController.java View source code |
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
spinAnimation = beanService.getBean(SpinAnimation.class);
InputStream stDelete = getClass().getResourceAsStream("/images/wait_24.png");
Image imageDelete = new Image(stDelete);
labelImage.setText("");
labelImage.setGraphic(new ImageView(imageDelete));
spinAnimation.setNode(labelImage);
}Example 37
| Project: RegexGolf2-master File: ChallengeTitleUI.java View source code |
private void initLayout() {
_nameLabel.fontProperty().bind(_font);
_textField.fontProperty().bind(_font);
_nameLabel.textProperty().bind(_text);
_textField.textProperty().bindBidirectional(_text);
_root.spacingProperty().bind(_nameLabel.heightProperty().multiply(0.6));
_root.setAlignment(Pos.CENTER_LEFT);
_imageView.visibleProperty().bind(_root.hoverProperty().and(_editable));
// _imageView.fitHeightProperty().bind(_nameLabel.heightProperty().multiply(0.75));
//TODO fix Bug with scaling issues on initialization
_imageView.setFitHeight(18);
_imageView.setPreserveRatio(true);
Image editImage = new Image(this.getClass().getResourceAsStream("/regexgolf2/ui/img/edit.png"));
_imageView.setImage(editImage);
_root.getChildren().addAll(_nameLabel, _imageView);
}Example 38
| Project: speedment-master File: BrandUtil.java View source code |
private static void apply(Brand brand, InfoComponent info, Stage stage, Scene scene) {
if (stage != null) {
stage.setTitle(info.getTitle());
}
brand.logoSmall().map(Image::new).ifPresent( icon -> {
if (stage != null) {
stage.getIcons().add(icon);
}
@SuppressWarnings("unchecked") final Stage dialogStage = (Stage) scene.getWindow();
if (dialogStage != null) {
dialogStage.getIcons().add(icon);
}
});
brand.stylesheets().forEachOrdered(scene.getStylesheets()::add);
}Example 39
| Project: stupidwarriors-master File: StartUp.java View source code |
@Override
public void start(Stage stage) throws Exception {
//stage = new Stage(StageStyle.DECORATED);
stage = SceneBuilder.setFullScreen(stage);
stage.setScene(new Scene(SceneBuilder.setFxmlLoader(Url.START_UP, new StartUpController(stage))));
//cursor
//pass in the image path
Image image = new Image(Url.CURSOR);
stage.getScene().setCursor(new ImageCursor(image));
setUserAgentStylesheet(STYLESHEET_MODENA);
stage.show();
}Example 40
| Project: svarog-master File: ImageRefresher.java View source code |
@Override
protected Image call() throws Exception {
try {
BufferedImage image = computer.renderImage(chart.getXAxis(), chart.getYAxis(), new ImageRendererStatus(this, waiting.progressProperty()));
return (image == null) ? null : SwingFXUtils.toFXImage(image, null);
} catch (Exception ex) {
logger.warn(ex);
throw ex;
}
}Example 41
| Project: TrayNotification-master File: ReadMeTest.java View source code |
@Test
public void creatingACustomTrayNotification() {
Image whatsAppImg = new Image("https://cdn4.iconfinder.com/data/icons/iconsimple-logotypes/512/whatsapp-128.png");
Platform.runLater(() -> {
tray.setTitle("New WhatsApp Message");
tray.setMessage("Github - I like your new notification release. Nice one.");
tray.setRectangleFill(Paint.valueOf("#2A9A84"));
tray.setAnimation(Animations.POPUP);
tray.setImage(whatsAppImg);
tray.showAndDismiss(Duration.seconds(2));
});
}Example 42
| Project: Trydent-master File: Sprite.java View source code |
private void loadImages(String[] filenames) {
Image[] result = new Image[filenames.length];
for (int i = 0; i < filenames.length; i++) {
try {
result[i] = Images.getImage(filenames[i]);
} catch (IllegalArgumentException ex) {
throw new TrydentException("Could not find the image filename. " + filenames[i], ex);
}
}
images = result;
}Example 43
| Project: VickyWarAnalyzer-master File: Main.java View source code |
@Override
public void start(Stage stage) throws Exception {
// start is called on the FX Application Thread,
// so Thread.currentThread() is the FX application thread:
// Thread.setDefaultUncaughtExceptionHandler(Main::showError);
Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("Main.fxml"));
stage.setTitle("Victoria II war analyzer");
stage.setScene(new Scene(root));
stage.show();
/* Cause I'm Estonian, thats why */
stage.getIcons().add(new Image("/flags/EST.png"));
}Example 44
| Project: XR3Player-master File: SettingsWindowController.java View source code |
/**
* Will be called as soon as FXML file is loaded.
*/
@FXML
private void initialize() {
setTitle("Settings");
getIcons().add(new Image(getClass().getResourceAsStream("/image/icon.png")));
setScene(new Scene(root));
centerOnScreen();
// orientation
orientation.selectedProperty().addListener(( observable, oldValue, newValue) -> {
if (// selected
newValue) {
mainWindowController.getRoot().setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
orientation.setText("Current : LEFT -> TO -> RIGHT");
} else {
mainWindowController.getRoot().setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
orientation.setText("Current : RIGHT -> TO -> LEFT");
}
});
}Example 45
| Project: autopsy-master File: SortChooser.java View source code |
@Override
protected void updateItem(Y item, boolean empty) {
//To change body of generated methods, choose Tools | Templates.
super.updateItem(item, empty);
if (empty || null == item) {
setText(null);
setGraphic(null);
} else {
try {
String displayName = (String) item.getClass().getMethod("getDisplayName").invoke(item);
setText(displayName);
Image icon = (Image) item.getClass().getMethod("getIcon").invoke(item);
setGraphic(new ImageView(icon));
} catch (NoSuchMethodExceptionSecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | ex) {
setText(item.toString());
setGraphic(null);
}
}
}Example 46
| Project: AIGS-master File: MinesweeperPane.java View source code |
/**
* Uncover the field. This changes the style of the image and shows the number
* of surrounding mines or the mine if there is one.
* @param field The logical reprsentation of that field.
*/
public void uncover(MinesweeperField field) {
this.width = getWidth();
this.height = getHeight();
// Invoke
addStyle(this, "empty");
if (field.getHasFlag()) {
removeImage();
}
if (field.getSurroundingMinesCount() > 0) {
// Invoke
setImage(imageView, new Image("/Assets/Images/" + field.getSurroundingMinesCount() + ".png", height, width, true, false));
}
if (field.getContainsMine()) {
removeImage();
// Invoke
addStyle(this, "mineRed");
}
}Example 47
| Project: ColloidUI-master File: Ability.java View source code |
protected void setIcon() {
String iconName = name;
if (iconName.indexOf("(") != -1) {
iconName = iconName.substring(0, iconName.indexOf("(") - 1);
}
if (iconName.indexOf("[") != -1) {
iconName = iconName.substring(0, iconName.indexOf("[") - 1);
}
String iconPath = String.format("/img/small/%s.jpg", iconName.trim().replaceAll(" ", "_").toLowerCase());
try {
icon = new ImageView(new Image(getClass().getResourceAsStream(iconPath)));
} catch (NullPointerException ex) {
icon = null;
}
}Example 48
| Project: context-master File: ContextFX.java View source code |
/**
*
* @param stage
* @throws Exception
*/
@Override
public void start(Stage stage) throws Exception {
initialize();
FXMLLoader loader = new FXMLLoader(getClass().getResource("ContextFX.fxml"));
Parent root = (Parent) loader.load();
//root.getStylesheets().add("style-default.css");
appController = (ContextFXController) loader.getController();
appController.setStageAndSetupListeners(stage);
Scene scene = new Scene(root);
stage.setScene(scene);
//From August 2015, it becomes ConText 1.1 //Jan 2016 - 1.2.X
stage.setTitle("ConText 1.2.0");
stage.getIcons().add(new Image("resources/context-blue.png"));
Screen screen = Screen.getPrimary();
Rectangle2D bounds = screen.getVisualBounds();
stage.setX(bounds.getMinX());
stage.setY(bounds.getMinY());
stage.setWidth(bounds.getWidth());
stage.setHeight(bounds.getHeight());
stage.show();
}Example 49
| Project: Density-master File: GUI.java View source code |
public static GUIController setup(Stage primaryStage, IPreferenceStore store, Dimension screenSize) throws IOException {
primaryStage.setTitle("Density Converter");
ResourceBundle bundle = ResourceBundle.getBundle("bundles.strings", Locale.getDefault());
FXMLLoader loader = new FXMLLoader(GUI.class.getClassLoader().getResource("main.fxml"));
loader.setResources(bundle);
Parent root = loader.load();
GUIController controller = loader.<GUIController>getController();
controller.onCreate(primaryStage, store, bundle);
if (screenSize.getHeight() <= 768) {
MIN_HEIGHT = 740;
}
Scene scene = new Scene(root, 600, MIN_HEIGHT);
primaryStage.setScene(scene);
primaryStage.setResizable(true);
primaryStage.setMinWidth(400);
primaryStage.setMinHeight(500);
primaryStage.getIcons().add(new Image("img/density_converter_icon_16.png"));
primaryStage.getIcons().add(new Image("img/density_converter_icon_24.png"));
primaryStage.getIcons().add(new Image("img/density_converter_icon_48.png"));
primaryStage.getIcons().add(new Image("img/density_converter_icon_64.png"));
primaryStage.getIcons().add(new Image("img/density_converter_icon_128.png"));
primaryStage.getIcons().add(new Image("img/density_converter_icon_256.png"));
return controller;
}Example 50
| Project: drive-uploader-master File: DriveDirectoryChooserViewController.java View source code |
@Override
protected void updateItem(File file, boolean empty) {
super.updateItem(file, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
Node graphic = new ImageView(new Image(getClass().getResourceAsStream("/icons/folder.png")));
setText(getItem() == null ? "" : getItem().getTitle());
setGraphic(graphic);
setContentDisplay(ContentDisplay.LEFT);
}
}Example 51
| Project: e4-rendering-master File: DetailsView.java View source code |
private Node createDetailsPanel() {
uiProp = JFXBeanProperties.value("text");
ctx = new DataBindingContext();
grid = new GridPane();
grid.getStyleClass().add("my-gridpane");
grid.setHgap(10);
grid.setVgap(5);
grid.setPadding(new Insets(10, 10, 10, 10));
detailsPanelRow = 0;
addSeparator("General");
titleText = addProperty("Title", "title");
addProperty("Name", "name");
addProperty("Company", "company");
addProperty("Job Title", "jobTitle");
addProperty("Note", "note", 2);
Image image = new Image(getClass().getResourceAsStream("dummy.png"));
imageView = new ImageView(image);
grid.add(imageView, 3, 0, 1, 5);
GridPane.setValignment(imageView, VPos.BOTTOM);
GridPane.setHalignment(imageView, HPos.LEFT);
double scaleFactor = 102 / image.getHeight();
imageView.setFitHeight(scaleFactor * image.getHeight());
imageView.setFitWidth(scaleFactor * image.getWidth());
titleText.heightProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
Image image = imageView.getImage();
double scaleFactor = ((Double) newValue + 3.5) * 4 / image.getHeight();
imageView.setFitHeight(scaleFactor * image.getHeight());
imageView.setFitWidth(scaleFactor * image.getWidth());
}
});
addSeparator("Business Address");
addProperty("Street", "street", 2);
addProperty("City", "city", 2);
addProperty("Zip", "zip", 2);
addProperty("Country", "country", 2);
addSeparator("Business Phones");
addProperty("Phone", "phone", 2);
addProperty("Mobile", "mobile", 2);
addSeparator("Business Internet");
addProperty("E-Mail", "email", 2);
addProperty("Web Site", "webPage", 2);
ColumnConstraints separatorConstraints = new ColumnConstraints();
separatorConstraints.setHalignment(HPos.LEFT);
grid.getColumnConstraints().add(separatorConstraints);
ColumnConstraints labelConstraints = new ColumnConstraints();
labelConstraints.setHalignment(HPos.RIGHT);
grid.getColumnConstraints().add(labelConstraints);
ScrollPane scrollPane = new ScrollPane();
scrollPane.setFitToWidth(true);
scrollPane.setContent(grid);
scrollPane.autosize();
return scrollPane;
}Example 52
| Project: Enzo-master File: Util.java View source code |
public static Image createGrayNoise(final double WIDTH, final double HEIGHT, final Color COLOR, final int VARIATION) {
int red = (int) (255 * COLOR.getRed());
int green = (int) (255 * COLOR.getRed());
int blue = (int) (255 * COLOR.getRed());
int variation = clamp(0, 255, VARIATION) / 2;
Color darkColor = Color.rgb(clamp(0, 255, red - variation), clamp(0, 255, green - variation), clamp(0, 255, blue - variation));
Color brightColor = Color.rgb(clamp(0, 255, red + variation), clamp(0, 255, green + variation), clamp(0, 255, blue + variation));
return createGrayNoise(WIDTH, HEIGHT, darkColor, brightColor);
}Example 53
| Project: FrostBite3Editor-master File: ModLoaderListFactory.java View source code |
@Override
public void handle(MouseEvent arg0) {
Mod mod = getItem();
ModLoaderController ctrlr = Core.getJavaFXHandler().getMainWindow().getModLoaderWindow().getController();
if (mod != null) {
Core.getGame().setCurrentMod(mod);
Core.getModTools().getPackages().clear();
Core.getModTools().fetchPackages();
ctrlr.getModName().setText(mod.getName());
ctrlr.getAuthorName().setText(mod.getAuthor());
ctrlr.getGameName().setText(mod.getGame());
ctrlr.getDesc().setWrapText(true);
ctrlr.getDesc().setText(mod.getDesc());
File image = new File(mod.getPath() + "/logo.png");
if (image.exists()) {
ctrlr.getLogo().setImage(new Image(FileHandler.getStream(image.getAbsolutePath())));
} else {
ctrlr.getLogo().setImage(null);
}
ctrlr.getRunEditor().setDisable(false);
ctrlr.getPlayButton().setDisable(false);
File destFolder = new File(mod.getDestFolderPath());
if (destFolder.isDirectory()) {
ctrlr.getCheckBox().setVisible(true);
ctrlr.getCheckBox().setDisable(false);
} else {
ctrlr.getCheckBox().setVisible(false);
ctrlr.getCheckBox().setDisable(true);
}
} else {
ctrlr.getRunEditor().setDisable(true);
Core.getGame().setCurrentMod(null);
ctrlr.getModName().setText("No mod currently selected!");
ctrlr.getAuthorName().setText("");
ctrlr.getGameName().setText("");
ctrlr.getDesc().setWrapText(true);
ctrlr.getDesc().setText("");
ctrlr.getLogo().setImage(null);
ctrlr.getRunEditor().setDisable(true);
ctrlr.getPlayButton().setDisable(true);
ctrlr.getCheckBox().setVisible(false);
ctrlr.getCheckBox().setDisable(true);
}
}Example 54
| Project: gcexplorer-master File: GCExplorer.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
processController = new RunningProcessUpdater(this);
Thread controllerThread = new Thread(processController, "GUI Stats Updater Controller");
controllerThread.setDaemon(true);
controllerThread.setName("GUI Process Controller");
controllerThread.start();
FXMLLoader loader = new FXMLLoader(getClass().getResource("mainForm.fxml"));
loader.setController(new MainForm(processController, this));
Parent pane = loader.load();
Scene scene = new Scene(pane, 800, 600);
primaryStage.setTitle("GC Explorer");
primaryStage.setScene(scene);
primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("gcExplorer.png")));
primaryStage.show();
}Example 55
| Project: GeoFroggerFX-v1-master File: GeocachingIcons.java View source code |
public static Image getIcon(Cache cache, IconManager.IconSize size) {
String iconName = "iconmonstr-map-5-icon.png";
switch(cache.getType()) {
case MULTI_CACHE:
iconName = "iconmonstr-map-6-icon.png";
break;
case TRADITIONAL_CACHE:
iconName = "iconmonstr-map-5-icon.png";
break;
case UNKNOWN_CACHE:
iconName = "iconmonstr-help-3-icon.png";
break;
case EARTH_CACHE:
iconName = "iconmonstr-globe-4-icon.png";
break;
case LETTERBOX:
iconName = "iconmonstr-email-4-icon.png";
break;
case EVENT:
case CITO_EVENT:
case MEGA_EVENT:
iconName = "iconmonstr-calendar-4-icon.png";
break;
case WHERIGO:
iconName = "iconmonstr-navigation-6-icon.png";
break;
case WEBCAM_CACHE:
iconName = "iconmonstr-webcam-3-icon.png";
break;
case VIRTUAL_CACHE:
iconName = "iconmonstr-network-2-icon.png";
break;
default:
System.out.println(cache.getType());
}
return IconManager.getIcon(iconName, size);
}Example 56
| Project: griffon-javafx-plugin-master File: ImagePropertyEditor.java View source code |
protected void setValueInternal(Object value) {
if (null == value) {
super.setValueInternal(null);
} else if (value instanceof CharSequence) {
handleAsString(String.valueOf(value));
} else if (value instanceof File) {
handleAsFile((File) value);
} else if (value instanceof URL) {
handleAsURL((URL) value);
} else if (value instanceof URI) {
handleAsURI((URI) value);
} else if (value instanceof InputStream) {
handleAsInputStream((InputStream) value);
} else if (value instanceof Image) {
super.setValueInternal(value);
} else {
throw illegalValue(value, Image.class);
}
}Example 57
| Project: griffon-master File: ImagePropertyEditor.java View source code |
protected void setValueInternal(Object value) {
if (null == value) {
super.setValueInternal(null);
} else if (value instanceof CharSequence) {
handleAsString(String.valueOf(value));
} else if (value instanceof File) {
handleAsFile((File) value);
} else if (value instanceof URL) {
handleAsURL((URL) value);
} else if (value instanceof URI) {
handleAsURI((URI) value);
} else if (value instanceof InputStream) {
handleAsInputStream((InputStream) value);
} else if (value instanceof Image) {
super.setValueInternal(value);
} else {
throw illegalValue(value, Image.class);
}
}Example 58
| Project: idnadrev-master File: ImageLoader.java View source code |
@Override public Image load(String key) throws Exception { URL resource = getClass().getResource(key); if (resource == null) { log.debug("Could not load image {} from classpath", key); } else { Image image = loadFromUrl(resource); log.info("Loaded image {} from classpath", key); return image; } resource = getClass().getResource(DEFAULT_IMAGE_PACKAGE + key); if (resource == null) { log.debug("Could not load image {} from default image package {}", key, DEFAULT_IMAGE_PACKAGE); } else { Image image = loadFromUrl(resource); log.info("Loaded image {} from default image package {}", key, DEFAULT_IMAGE_PACKAGE); return image; } File file = new File(key); if (file.exists()) { Image image = loadFromFile(file); log.info("Loaded image {} from file {}", key, file); return image; } else { log.debug("Could not load image {} from filesystem", key); } try { URL url = new URL(key); Image image = loadFromUrl(url); log.info("Loaded image {} from url {}", key, url); return image; } catch (MalformedURLException e) { log.debug("Could not load image {} via URL", key); } throw new FileNotFoundException(key); }
Example 59
| Project: Illarion-Java-master File: GuiApplication.java View source code |
@Override
public void start(@Nonnull Stage primaryStage) throws Exception {
model = new GuiModel(primaryStage, getHostServices(), this);
primaryStage.initStyle(StageStyle.TRANSPARENT);
stage = primaryStage;
primaryStage.getIcons().add(new Image("illarion_download256.png"));
showNormal();
primaryStage.setResizable(false);
primaryStage.show();
}Example 60
| Project: jace-master File: Font.java View source code |
private static void initalize() {
initialized = true;
font = new int[256][8];
Thread fontLoader = new Thread(() -> {
InputStream in = ClassLoader.getSystemResourceAsStream("jace/data/font.png");
Image image = new Image(in);
PixelReader reader = image.getPixelReader();
for (int i = 0; i < 256; i++) {
int x = (i >> 4) * 13 + 2;
int y = (i & 15) * 13 + 4;
for (int j = 0; j < 8; j++) {
int row = 0;
for (int k = 0; k < 7; k++) {
Color color = reader.getColor((7 - k) + x, j + y);
boolean on = color.getRed() != 0;
row = (row << 1) | (on ? 0 : 1);
}
font[i][j] = row;
}
}
});
fontLoader.start();
}Example 61
| Project: JacpFX-misc-master File: ContactMain.java View source code |
@Override
public void postInit(final Stage stage) {
this.scene = stage.getScene();
stage.getIcons().add(new Image("images/icons/JACP_512_512.png"));
// add style sheet
// this.scene.getStylesheets().addAll(ContactMain.class.getResource("/styles/main.css").toExternalForm(), ContactMain.class.getResource("/styles/windowbuttons.css").toExternalForm());
// ScenicView.show(stage.getScene());
}Example 62
| Project: javafx-minesweeper-master File: Tiles.java View source code |
public static Image getImage(Squares square) {
switch(square) {
case BLANK:
return Tiles.BLANK;
case FLAG:
return Tiles.FLAG;
case MINE:
return Tiles.MINE;
case EXPOSED:
return Tiles.EXPOSED;
case HITMINE:
return Tiles.HITMINE;
case WRONGMINE:
return Tiles.WRONGMINE;
default:
throw new AssertionError("Unknown square type: " + square);
}
}Example 63
| Project: latexdraw-master File: ShapeFreeHandCustomiser.java View source code |
@Override
public void initialize(final URL location, final ResourceBundle resources) {
mainPane.managedProperty().bind(mainPane.visibleProperty());
final Map<FreeHandStyle, Image> cache = new HashMap<>();
cache.put(FreeHandStyle.LINES, new Image("/res/freehand/line.png"));
cache.put(FreeHandStyle.CURVES, new Image("/res/freehand/curve.png"));
initComboBox(freeHandType, cache, FreeHandStyle.values());
scrollOnSpinner(gapPoints);
}Example 64
| Project: Musclide-master File: MainSlide.java View source code |
public void openDirectory(File path) {
images.clear();
File[] files = path.listFiles(new FileFilter() {
@Override
public boolean accept(File name) {
return (name.isFile() && name.getName().endsWith("png"));
}
});
for (File file : files) {
images.add(new Image(file.toURI().toString()));
}
index.set(0);
}Example 65
| Project: mytime-master File: VolunteerTopViewController.java View source code |
/**
* Binds the labels to the values of the current volunteer, and sets the image
*/
private void dataBindGuiComponents() {
VolunteerModel vmodel = VolunteerModel.getInstance();
//lblName.textProperty().bind(vmodel.getCurrentVolunteer().getFullName());
lblName.setText(vmodel.getCurrentVolunteer().getFullName());
lblEmail.textProperty().bind(vmodel.getCurrentVolunteer().getEmail());
lblPhonenumber.textProperty().bind(vmodel.getCurrentVolunteer().getPhonenumber());
Image img = new Image(vmodel.getCurrentVolunteer().getProfilePicture().get());
imageView.setImage(img);
}Example 66
| Project: PeerWasp-master File: IconUtils.java View source code |
/** * Creates a list of icons that can be used to decorate application windows, e.g. in the tray or in * the top window bar. The collection contains icons in different sizes. * * @return list of icons in increasing size. */ public static List<Image> createWindowIcons() { List<Image> icons = new ArrayList<>(); for (String icon : applicationIcons) { try (InputStream in = IconUtils.class.getResourceAsStream(icon)) { if (in != null) { icons.add(new Image(in)); } } catch (IOException e) { logger.warn("Could not open icon resource for icon '{}'.", icon, e); } } return icons; }
Example 67
| Project: POL-POM-5-master File: JavaFXApplication.java View source code |
@Override
public void start(Stage primaryStage) {
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("views/common/phoenicis.png")));
primaryStage.setTitle("Phoenicis");
loadFonts();
ConfigurableApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfiguration.class);
final MainController mainController = applicationContext.getBean(MainController.class);
mainController.show();
mainController.setOnClose(() -> {
applicationContext.getBean(ControlledThreadPoolExecutorServiceCloser.class).setCloseImmediately(true);
applicationContext.close();
});
}Example 68
| Project: Projectiler-master File: ClientStarter.java View source code |
private void initStage(final Stage stage, final MovablePane rootElement) {
rootElement.setStyle("-fx-background-color:transparent;");
final Scene scene = new Scene(rootElement);
stage.setScene(scene);
stage.setTitle("Projectiler");
stage.initStyle(StageStyle.TRANSPARENT);
scene.setFill(Color.TRANSPARENT);
stage.getIcons().add(new Image(ClientStarter.class.getResourceAsStream("/projectiler.png")));
stage.show();
Tray.getInstance().initTrayForStage(stage);
}Example 69
| Project: skadi-master File: ImageUtil.java View source code |
public static ImageView getGameBoxFromTwitch(final String game) {
final Result<Image> imageResponse = TwitchUtil.getTwitch().imageUtil.getGameBox(game, ImageSize.SMALL_GAME_BOX, CONVERTER);
if (!imageResponse.isOk()) {
LOGGER.error("exception getting game logo for " + game, imageResponse.getErrorRaw());
return null;
}
return new ImageView(imageResponse.getResultRaw());
}Example 70
| Project: spyfs-master File: A.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
A.a = this;
fxmll = new FXMLLoader(SpyFS.class.getResource("UI.fxml"));
ui = fxmll.load();
uic = fxmll.getController();
uic.setStage(primaryStage);
Scene scene = new Scene(ui, 600, 320);
primaryStage.setTitle("SpyFS");
primaryStage.setScene(scene);
primaryStage.getIcons().add(new Image(A.class.getResourceAsStream("spyfs.png")));
primaryStage.show();
new Thread(() -> {
Settings s = getSettingsCopy();
Platform.runLater(() -> {
uic.dstdir.setText(s.destinationPath());
uic.srcdir.setText(s.sourcePath());
uic.virloc.setText(s.virtualLocation());
uic.reportpth.setText(s.reportPath());
});
}, "load settings").start();
}Example 71
| Project: timey-master File: TimeyApplication.java View source code |
/**
* Startet die Anwendung.
* @param stage Fenster der Anwendung
* @throws IOException Fehler beim Laden der FXML-Datei.
*/
public final void start(final Stage stage) throws IOException {
ConfigManager.setCurrentConfig(new FileConfigStorage().loadFromFile(CONFIG_FILENAME));
final GuiHelper guiHelper = new GuiHelper();
guiHelper.setFacade(new TimeyFacade());
final ResourceBundle resources = guiHelper.getResourceBundle(ConfigManager.getCurrentConfig().getLocale());
final FXMLLoader loader = new FXMLLoader(getClass().getResource("Timey.fxml"), resources);
final Parent root = (Parent) loader.load();
stage.setScene(new Scene(root));
stage.setTitle(resources.getString("application.title"));
stage.setResizable(false);
stage.getIcons().add(new Image(getClass().getResourceAsStream("img/clock.png")));
stage.show();
final TimeyController timeyController = loader.getController();
timeyController.setGuiHelper(guiHelper);
timeyController.setStage(stage);
}Example 72
| Project: Turnierserver-master File: AiOnline.java View source code |
public Image call() { try { Image img = connector.getImage(json.getInt("id")); if (img == null) { // zweiter Versuch (das geht aber auch elleganter :D) img = connector.getImage(json.getInt("id")); if (img == null) { return Resources.defaultPicture(); } else return img; } else return img; } catch (IOException e) { return Resources.defaultPicture(); } }
Example 73
| Project: bikingFX-master File: GalleryPictureTableCell.java View source code |
@Override
protected void updateItem(final Integer item, boolean empty) {
super.updateItem(item, empty);
if (item == null || empty) {
setText(null);
setGraphic(null);
} else {
this.image = images.computeIfAbsent(item, id -> new Image(String.format("%s/galleryPictures/%d.jpg", JsonRetrievalTask.BASE_URL, id), 800, 600, true, true, true));
if (image.getProgress() == 1.0) {
displayImage(image);
} else {
final ProgressIndicator progressIndicator = new ProgressIndicator();
container.getChildren().set(0, progressIndicator);
progressIndicator.progressProperty().bind(image.progressProperty());
image.progressProperty().addListener(new ImageLoadedListener(this.image));
}
setGraphic(container);
}
}Example 74
| Project: blackmarket-master File: ImageLoadTracker.java View source code |
@Override
public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) {
// reset the error text.
statusLabel.setText("Loading image . . .");
statusLabel.setStyle("-fx-text-fill: silver;");
// load an image in the background.
final String newImageUrl = (String) newValue.getUserData();
final Image newImage = new Image(newImageUrl, true);
imageView.setImage(newImage);
// track the image's error property.
newImage.errorProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean imageError) {
if (imageError) {
statusLabel.setText("Oh-oh there was an error loading: " + newImageUrl);
statusLabel.setStyle("-fx-text-fill: firebrick;");
imageView.setImage(ERROR_IMAGE);
}
}
});
// track the image's loading progress.
progressBar.progressProperty().bind(newImage.progressProperty());
newImage.progressProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number progress) {
if ((Double) progress == 1.0 && !newImage.isError()) {
statusLabel.setText("Loading complete");
statusLabel.setStyle("-fx-text-fill: forestgreen;");
}
}
});
}Example 75
| Project: Carry-master File: Resources.java View source code |
private void getImage() throws ImageNotFoundException {
if (ClassLoader.getSystemResourceAsStream("humanwalk-clipart.png") != null)
isFoundHuman = true;
if (ClassLoader.getSystemResourceAsStream("clock-clipart.png") != null)
isFoundClock = true;
if (!isFoundHuman) {
if (!isFoundClock)
throw new ImageNotFoundException(2);
else
throw new ImageNotFoundException(0);
} else if (!isFoundClock)
throw new ImageNotFoundException(1);
Resources.clock = new Image(ClassLoader.getSystemResourceAsStream("clock-clipart.png"));
Resources.people = new Image(ClassLoader.getSystemResourceAsStream("humanwalk-clipart.png"));
}Example 76
| Project: chvote-1-0-master File: OfflineAdminApp.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
PropertyConfigurator.configure(getLog4jProperties());
ResourceBundle resourceBundle = getBundle();
initializeDefaultExceptionHandler(resourceBundle);
primaryStage.setTitle(resourceBundle.getString("primaryStage.title"));
primaryStage.getIcons().add(new Image(OfflineAdminApp.class.getResourceAsStream("images/icon.gif")));
BorderPane rootLayout = initRootLayout(resourceBundle);
Scene mainScene = new Scene(rootLayout);
mainScene.getStylesheets().add(getStyleSheet().toExternalForm());
primaryStage.setScene(mainScene);
primaryStage.show();
}Example 77
| Project: code-of-gotham-master File: CityStyle.java View source code |
private static void initImages() {
imagesMap.put(Style.GOTHAM.name(), new Image(CityStyle.class.getResource("cog.jpg").toString()));
imagesMap.put(Style.TECH_DEBT.name(), new Image(CityStyle.class.getResource("td.jpg").toString()));
imagesMap.put(Style.TECH_DEBT_PER_LINE.name(), new Image(CityStyle.class.getResource("tdpl.jpg").toString()));
imagesMap.put(Style.TEST_COVERAGE.name(), new Image(CityStyle.class.getResource("tc.jpg").toString()));
imagesMap.put(Style.COMPLEXITY_PER_LINE.name(), new Image(CityStyle.class.getResource("cc.jpg").toString()));
}Example 78
| Project: CupCarbon-master File: CupCarbon.java View source code |
@Override
public void start(Stage stage) throws IOException {
String os = System.getProperty("os.name", "UNKNOWN");
if (os != null && os.startsWith("Mac")) {
macos = true;
}
CupActionStack.init();
CupCarbon.stage = stage;
try {
System.out.println("> CupCarbon U-One");
FileInputStream licenceFile = new FileInputStream("utils/cupcarbon_licence.txt");
int c;
while ((c = licenceFile.read()) != -1) {
System.out.print((char) c);
}
System.out.println();
licenceFile.close();
setProxy();
} catch (Exception e) {
e.printStackTrace();
}
setUserAgentStylesheet(STYLESHEET_MODENA);
stage.setTitle("CupCarbon " + CupCarbonVersion.VERSION);
stage.getIcons().add(new Image(getClass().getResourceAsStream("cupcarbon_logo_small.png")));
stage.setMaximized(true);
FXMLLoader loader = new FXMLLoader();
loader.setLocation(CupCarbon.class.getResource("cupcarbon.fxml"));
BorderPane panneau = (BorderPane) loader.load();
Scene scene = new Scene(panneau);
stage.setScene(scene);
stage.show();
}Example 79
| Project: emfdatabinding-tutorial-master File: ToolItemRenderer.java View source code |
@Override
public Object createWidget(MUIElement element) {
Button button = new Button();
button.getStyleClass().add("toolbarButton");
MToolItem item = (MToolItem) element;
String uri = item.getIconURI();
if (uri != null) {
try {
URL url = new URL(URI.createURI(uri).toString());
ImageView icon = new ImageView(new Image(url.openStream()));
button.setGraphic(icon);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
return button;
}Example 80
| Project: FxHeatMap-master File: HeatMapViewer.java View source code |
private void handleControlPropertyChanged(final String PROPERTY) {
if ("LOAD_BACKGROUND".equals(PROPERTY)) {
Image image = getImage(buttonLoadBackgroundImage.getScene().getWindow());
if (null == image)
return;
backgroundImage.setImage(image);
backgroundImage.toBack();
} else if ("LOAD_HEATMAP".equals(PROPERTY)) {
Image image = getImage(buttonLoadHeatMapImage.getScene().getWindow());
if (null == image)
return;
heatMapImage.setImage(image);
toggleButtonShowHeatMap.setSelected(true);
} else if ("TOGGLE_HEATMAP".equals(PROPERTY)) {
toggleButtonShowHeatMap.setText(toggleButtonShowHeatMap.isSelected() ? "show" : "hide");
heatMapImage.setVisible(!toggleButtonShowHeatMap.isSelected());
}
}Example 81
| Project: gmap-master File: MarkerImageFactory.java View source code |
/** Takes a URI for an image contained within an application jar file and
* converts it into a data URI for use in a MarkerOptions object.
* <p>
* Usage:
* <p>
* markerOptions.icon(MarkerImageFactory.createMarkerImage("/path/to/my/image.jpg", "jpg"));
* <p>
* Currently tested to work with "jpg" and "png" files.
*
* @param uri
* @param type
* @return
*/
public static String createMarkerImage(String uri, String type) {
Logger.getLogger(MarkerImageFactory.class.getName()).log(Level.FINEST, "createMarkerImage using: {0}", uri);
String dataURI = null;
if (uri.startsWith("file:")) {
return createMarkerImageFromFile(uri, type);
}
URL myURL = MarkerImageFactory.class.getResource(uri);
if (myURL != null) {
String myURI = myURL.toExternalForm();
Image img = new Image(myURI);
String imageMimeType = "image/" + type;
try {
dataURI = "data:" + imageMimeType + ";base64,(" + javax.xml.bind.DatatypeConverter.printBase64Binary(getImageBytes(SwingFXUtils.fromFXImage(img, null), type)) + ")";
} catch (IOException ioe) {
Logger.getLogger(MarkerImageFactory.class.getName()).log(Level.WARNING, "Cannot create marker image", ioe);
dataURI = null;
}
}
return dataURI;
}Example 82
| Project: GMapsFX-master File: MarkerImageFactory.java View source code |
/** Takes a URI for an image contained within an application jar file and
* converts it into a data URI for use in a MarkerOptions object.
* <p>
* Usage:
* <p>
* markerOptions.icon(MarkerImageFactory.createMarkerImage("/path/to/my/image.jpg", "jpg"));
* <p>
* Currently tested to work with "jpg" and "png" files.
*
* @param uri
* @param type
* @return
*/
public static String createMarkerImage(String uri, String type) {
Logger.getLogger(MarkerImageFactory.class.getName()).log(Level.FINEST, "createMarkerImage using: {0}", uri);
String dataURI = null;
if (uri.startsWith("file:")) {
return createMarkerImageFromFile(uri, type);
}
URL myURL = MarkerImageFactory.class.getResource(uri);
if (myURL != null) {
String myURI = myURL.toExternalForm();
Image img = new Image(myURI);
String imageMimeType = "image/" + type;
try {
dataURI = "data:" + imageMimeType + ";base64,(" + javax.xml.bind.DatatypeConverter.printBase64Binary(getImageBytes(SwingFXUtils.fromFXImage(img, null), type)) + ")";
} catch (IOException ioe) {
Logger.getLogger(MarkerImageFactory.class.getName()).log(Level.WARNING, "Cannot create marker image", ioe);
dataURI = null;
}
}
return dataURI;
}Example 83
| Project: JavaFX-HelpMaker-master File: Main.java View source code |
public boolean showXMLParameterEditDialog(XMLParameter xmlParameter, String windowName, Image icon) {
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("view/XMLParameterEdit.fxml"));
AnchorPane panel = loader.load();
Stage dialogStage = new Stage();
dialogStage.setTitle(windowName);
dialogStage.getIcons().add(icon);
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.initOwner(primaryStage);
dialogStage.setResizable(false);
Scene scene = new Scene(panel);
dialogStage.setScene(scene);
XMLParameterEditController controller = loader.getController();
controller.setDialogStage(dialogStage);
controller.setXmlParameter(xmlParameter);
dialogStage.showAndWait();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}Example 84
| Project: javafx-ws-client-master File: MainApp.java View source code |
/**
* Set application icon
*
* @param stage Stage
*/
private void setApplicationIcon(Stage stage, MainController controller) {
try {
if (Platform.getCurrent() == OSX) {
java.awt.Image imageForMac = new ImageIcon(getClass().getResource("/images/icon-512.png")).getImage();
com.apple.eawt.Application.getApplication().setDockIconImage(imageForMac);
// Menu bar position for mac os
controller.getMenuBar().setUseSystemMenuBar(true);
controller.getExitAppMenu().setVisible(false);
} else {
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/icon-16.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/icon-32.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/icon-64.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/icon-128.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/icon-256.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/icon-512.png")));
}
} catch (Exception e) {
LOGGER.error("Error load application icon: {}", e.getMessage());
}
}Example 85
| Project: JFoenix-master File: ExtendedAnimatedFlowContainer.java View source code |
private void updatePlaceholder(Node newView) {
if (view.getWidth() > 0 && view.getHeight() > 0) {
SnapshotParameters parameters = new SnapshotParameters();
parameters.setFill(Color.TRANSPARENT);
Image placeholderImage = view.snapshot(parameters, new WritableImage((int) view.getWidth(), (int) view.getHeight()));
placeholder.setImage(placeholderImage);
placeholder.setFitWidth(placeholderImage.getWidth());
placeholder.setFitHeight(placeholderImage.getHeight());
} else {
placeholder.setImage(null);
}
placeholder.setVisible(true);
placeholder.setOpacity(1.0);
view.getChildren().setAll(placeholder, newView);
placeholder.toFront();
}Example 86
| Project: jfxvnc-master File: VncClientApp.java View source code |
@Override
public void start(Stage stage) throws Exception {
stageRef = stage;
stage.titleProperty().bind(headerExpr);
stage.setResizable(true);
offlineImg = new Image(VncClientApp.class.getResourceAsStream("icon.png"));
onlineImg = new Image(VncClientApp.class.getResourceAsStream("icon_green.png"));
Injector.setLogger(logger::trace);
VncRenderService vncService = Injector.instantiateModelOrService(VncRenderService.class);
vncService.fullSceenProperty().addListener(( l, a, b) -> Platform.runLater(() -> stage.setFullScreen(b)));
vncService.restartProperty().addListener( l -> restart());
vncService.connectInfoProperty().addListener(( l, a, b) -> Platform.runLater(() -> headerProperty.set(b.getServerName())));
vncService.onlineProperty().addListener(( l, a, b) -> Platform.runLater(() -> {
stage.getIcons().add(b ? onlineImg : offlineImg);
stage.getIcons().remove(!b ? onlineImg : offlineImg);
}));
// update property on exit full screen by key combination
stage.fullScreenProperty().addListener(( l, a, b) -> vncService.fullSceenProperty().set(b));
SessionContext session = Injector.instantiateModelOrService(SessionContext.class);
session.setSession("jfxvnc.app");
session.loadSession();
session.bind(sceneWidthProperty, "scene.width");
session.bind(sceneHeightProperty, "scene.height");
MainView main = new MainView();
final Scene scene = new Scene(main.getView(), sceneWidthProperty.get(), sceneHeightProperty.get());
stage.setOnCloseRequest(( e) -> {
sceneWidthProperty.set(scene.getWidth());
sceneHeightProperty.set(scene.getHeight());
Injector.forgetAll();
System.exit(0);
});
stage.setScene(scene);
stage.getIcons().add(offlineImg);
stage.show();
}Example 87
| Project: jitwatch-master File: UserInterfaceUtil.java View source code |
private static Image loadResource(String path) { InputStream inputStream = UserInterfaceUtil.class.getResourceAsStream(path); Image result = null; if (inputStream != null) { result = new Image(inputStream); } else { logger.error("Could not load resource {}. If running in an IDE please add [ui,core]/src/main/resources to your classpath", path); } return result; }
Example 88
| Project: jskat-multimodule-master File: JSkatGraphicRepository.java View source code |
private void loadAllJSkatImages() {
final MediaTracker tracker = new MediaTracker(new Canvas());
loadImages(tracker);
//$NON-NLS-1$
log.debug("Bitmaps for JSkat logo and skat table loaded...");
this.awtIcons = new ArrayList<List<Image>>();
this.icons = new HashMap<>();
loadIcons(tracker);
//$NON-NLS-1$
log.debug("Bitmaps for icons loaded...");
this.cards = new HashMap<CardSet, Map<Card, Image>>();
this.cardBacks = new HashMap<CardSet, Image>();
loadCards(tracker);
//$NON-NLS-1$
log.debug("Bitmaps for cards loaded...");
this.flags = new ArrayList<>();
loadFlags(tracker);
//$NON-NLS-1$
log.debug("Bitmaps for flags loaded...");
}Example 89
| Project: many-ql-master File: Main.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Questionnaire");
primaryStage.getIcons().add(new Image("questionnaire.png"));
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(25, 25, 25, 25));
ColumnConstraints columnConstraints = new ColumnConstraints();
columnConstraints.setFillWidth(true);
columnConstraints.setHgrow(Priority.ALWAYS);
grid.getColumnConstraints().add(columnConstraints);
RowConstraints rowConstraints = new RowConstraints();
rowConstraints.setFillHeight(true);
rowConstraints.setVgrow(Priority.ALWAYS);
grid.getRowConstraints().add(new RowConstraints());
grid.getRowConstraints().add(new RowConstraints());
grid.getRowConstraints().add(rowConstraints);
String defaultLocation = DEFAULT_QL_INPUT_FILE_DIRECTORY + DEFAULT_QL_INPUT_FILE_NAME;
final TextField inputFileTextField = new TextField(defaultLocation);
Button chooseInputButton = new Button("Choose input file...");
Button parseButton = new Button("Parse");
Button showButton = new Button("Show");
grid.add(inputFileTextField, 0, 0);
grid.add(chooseInputButton, 1, 0);
grid.add(parseButton, 2, 0);
grid.add(showButton, 3, 0);
showButton.setVisible(false);
PathSelectedCallback pathSelectedCallback = path -> inputFileTextField.setText(path);
chooseInputButton.setOnAction(new ChooseInputButtonHandler(pathSelectedCallback, defaultLocation));
StackPane stackPane = new StackPane();
ValidationsGridPane validationsGridPane = new ValidationsGridPane();
InputFileTextCallback inputFileTextCallback = () -> inputFileTextField.getText();
ParseResultCallback parseResultCallback = parsingResult -> {
QuestionnaireParsingResult qlParsingResult = (QuestionnaireParsingResult) parsingResult;
showNode(stackPane, validationsGridPane);
ValidationResult validationResult = qlParsingResult.validate();
showButton.setVisible(!validationResult.containsErrors());
validationsGridPane.showValidations(validationResult.getValidationMessages());
questionnaire = qlParsingResult.getQuestionnaire();
};
parseButton.setOnAction(new ParseQLButtonHandler(inputFileTextCallback, parseResultCallback));
showButton.setOnAction( event -> {
QuestionnaireToRuntimeQuestions questionnaireToRuntimeQuestions = new QuestionnaireToRuntimeQuestions();
List<RuntimeQuestion> runtimeQuestions = questionnaireToRuntimeQuestions.createRuntimeQuestions(questionnaire);
QuestionnaireGridPane questionnaireGridPane = new QuestionnaireGridPane();
questionnaireGridPane.showQuestions(runtimeQuestions, runtimeQuestions);
ScrollPane scrollPane = new ScrollPane(questionnaireGridPane);
showNode(stackPane, scrollPane);
});
grid.add(stackPane, 0, 1, 4, 1);
Scene scene = new Scene(grid, WIDTH, HEIGHT);
primaryStage.setScene(scene);
primaryStage.show();
}Example 90
| Project: medusa-master File: TimeSectionBuilder.java View source code |
public final TimeSection build() {
final TimeSection SECTION = new TimeSection();
for (String key : properties.keySet()) {
if ("start".equals(key)) {
SECTION.setStart(((ObjectProperty<LocalTime>) properties.get(key)).get());
} else if ("stop".equals(key)) {
SECTION.setStop(((ObjectProperty<LocalTime>) properties.get(key)).get());
} else if ("text".equals(key)) {
SECTION.setText(((StringProperty) properties.get(key)).get());
} else if ("icon".equals(key)) {
SECTION.setIcon(((ObjectProperty<Image>) properties.get(key)).get());
} else if ("color".equals(key)) {
SECTION.setColor(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("highlightColor".equals(key)) {
SECTION.setHighlightColor(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("textColor".equals(key)) {
SECTION.setTextColor(((ObjectProperty<Color>) properties.get(key)).get());
} else if ("onTimeSectionEntered".equals(key)) {
SECTION.setOnTimeSectionEntered(((ObjectProperty<EventHandler>) properties.get(key)).get());
} else if ("onTimeSectionLeft".equals(key)) {
SECTION.setOnTimeSectionLeft(((ObjectProperty<EventHandler>) properties.get(key)).get());
}
}
return SECTION;
}Example 91
| Project: simplejavayoutubeuploader-master File: PlaylistGridCell.java View source code |
@Override
public void changed(final ObservableValue<? extends Playlist> observable, final Playlist oldValue, final Playlist playlist) {
getChildren().clear();
if (null == playlist) {
setGraphic(null);
return;
}
getStyleClass().add("image-grid-cell");
final Tooltip tooltip = new Tooltip(playlist.getTitle());
final Pane pane = new Pane();
final ImageView imageView;
if (null != playlist.getThumbnail()) {
if (!images.containsKey(playlist.getThumbnail())) {
final Image image = new Image(playlist.getThumbnail());
images.put(playlist.getThumbnail(), image);
}
imageView = new ImageView(images.get(playlist.getThumbnail()));
imageView.setPreserveRatio(true);
final double width = 0 < imageView.getImage().getWidth() ? imageView.getImage().getWidth() : 0;
final double height = 90 < imageView.getImage().getHeight() ? imageView.getImage().getHeight() : 180;
imageView.setViewport(new Rectangle2D(0, 45, width, height - 90));
} else {
imageView = new ImageView(getDefaultThumbnail());
}
imageView.fitHeightProperty().bind(heightProperty());
imageView.fitWidthProperty().bind(widthProperty());
pane.getChildren().add(imageView);
setGraphic(pane);
getGraphic().setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(final MouseEvent event) {
tooltip.show(getGraphic(), event.getScreenX(), event.getScreenY());
}
});
getGraphic().setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(final MouseEvent event) {
tooltip.hide();
}
});
}Example 92
| Project: support-tools-master File: Gui.java View source code |
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("main.fxml"));
Parent root = fxmlLoader.load();
primaryStage.setTitle("Support");
primaryStage.setScene(new Scene(root, 800, 700));
primaryStage.setMinHeight(600);
primaryStage.setMinWidth(800);
primaryStage.setOnCloseRequest( e -> Platform.exit());
primaryStage.getIcons().add(new Image(Gui.class.getResourceAsStream("adeptius64.png")));
primaryStage.show();
hostServices = getHostServices();
if (!VpsDao.getValue("enabled").equals("true")) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("alert.fxml"));
Stage stage = new Stage();
stage.setOnCloseRequest( e -> Platform.exit());
Parent root2 = loader.load();
Scene scene = new Scene(root2);
stage.setTitle("ТеÑ?товый период");
// Перекрывающее окно
stage.initModality(Modality.WINDOW_MODAL);
// Указание кого оно перекрывает
stage.initOwner(primaryStage);
stage.setScene(scene);
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
int availableVerdion = Integer.parseInt(VpsDao.getValue("latestVersion"));
if (availableVerdion > VERSION) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("update.fxml"));
Stage stage = new Stage();
// stage.setOnCloseRequest(e -> Platform.exit());
Parent root2 = loader.load();
Scene scene = new Scene(root2);
stage.setTitle("Обновление");
// Перекрывающее окно
stage.initModality(Modality.WINDOW_MODAL);
// Указание кого оно перекрывает
stage.initOwner(primaryStage);
stage.setScene(scene);
stage.show();
} catch (Exception e) {
e.printStackTrace();
}
}
}Example 93
| Project: thundernetwork-master File: ReceiveMoneyRequestController.java View source code |
public void update() {
System.out.println(Tools.bytesToHex(Main.node.pubKeyServer.getPubKey()));
if (secret == null) {
secret = new PaymentSecret(Tools.getRandomByte(20));
Main.dbHandler.addPaymentSecret(secret);
System.out.println("HASH: " + Tools.bytesToHex(secret.hash));
}
try {
byte[] payload = getPayload();
FieldAddress.setText(Tools.bytesToHex(payload));
FieldHash.setText(Tools.bytesToHex(secret.hash));
System.out.println(Tools.bytesToHex(payload));
final byte[] imageBytes = QRCode.from(Tools.bytesToHex(payload)).withSize(250, 250).to(ImageType.PNG).stream().toByteArray();
Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
ImageQR.setImage(qrImage);
ImageQR.setEffect(new DropShadow());
StringSelection stringSelection = new StringSelection(Tools.bytesToHex(payload));
Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
clpbrd.setContents(stringSelection, null);
} catch (Exception e) {
e.printStackTrace();
}
}Example 94
| Project: Augendiagnose-master File: Application.java View source code |
@Override
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "Intentionally write the stage statically")
public final void start(final Stage primaryStage) throws IOException, IllegalAccessException {
Application.mStage = primaryStage;
primaryStage.setTitle(ResourceUtil.getString("app_name"));
MainController mainController = (MainController) FxmlUtil.getRootFromFxml(FxmlConstants.FXML_MAIN);
// In case of screen change, ensure that window is not bigger than screen.
Rectangle2D mainScreen = Screen.getPrimary().getVisualBounds();
double width = Math.min(mainScreen.getWidth(), PreferenceUtil.getPreferenceDouble(KEY_WINDOW_SIZE_X));
double height = Math.min(mainScreen.getHeight(), PreferenceUtil.getPreferenceDouble(KEY_WINDOW_SIZE_Y));
mScene = new Scene(mainController.getRoot(), width, height);
// Store window size on close.
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(final WindowEvent event) {
// do not close window.
event.consume();
exitAfterConfirmation();
}
});
primaryStage.setScene(mScene);
primaryStage.setMaximized(PreferenceUtil.getPreferenceBoolean(KEY_WINDOW_MAXIMIZED));
primaryStage.getIcons().add(new Image("img/Augendiagnose.png"));
primaryStage.show();
FxmlUtil.displaySubpage(FxmlConstants.FXML_DISPLAY_PHOTOS, 0, false);
mHostServices = getHostServices();
VersioningUtil.checkForNewerVersion(false);
}Example 95
| Project: AsciidocFX-master File: ParserService.java View source code |
public Optional<String> toImageBlock(Image image) {
Path currentPath = directoryService.currentParentOrWorkdir();
IOHelper.createDirectories(currentPath.resolve("images"));
List<String> buffer = new LinkedList<>();
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(asciiDocController.getClipboardImageFilePattern());
Path path = Paths.get(dateTimeFormatter.format(LocalDateTime.now()));
Path targetImage = currentPath.resolve("images").resolve(path.getFileName());
try {
BufferedImage fromFXImage = SwingFXUtils.fromFXImage(image, null);
ImageIO.write(fromFXImage, "png", targetImage.toFile());
} catch (Exception e) {
logger.error("Problem occured while saving clipboard image {}", targetImage);
}
buffer.add(String.format("image::images/%s[]", path.getFileName()));
if (buffer.size() > 0)
return Optional.of(String.join("\n", buffer));
return Optional.empty();
}Example 96
| Project: CCAutotyper-master File: Strings.java View source code |
public static void setAppIcons(Stage stage) {
if (img[0] == null) {
for (int i = 0, size = 32; (i < img.length) && (size <= 128); size += 16) {
final Resource res = Resources.getImage("icon" + size + ".png");
if ((res.url() != null) && (res.stream() != null)) {
Console.debug("Found icon" + size + ".png");
img[i++] = new Image(res.stream());
} else if ((((size % 32) == 0) || (size == 48)) && (size != 96)) {
Console.error("Could not find icon" + size + ".png!");
}
}
}
stage.getIcons().addAll(img);
}Example 97
| Project: CoinJoin-master File: ClickableBitcoinAddress.java View source code |
@FXML
protected void showQRCode(MouseEvent event) {
// Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
// lazy tonight.
final byte[] imageBytes = QRCode.from(uri()).withSize(320, 240).to(ImageType.PNG).stream().toByteArray();
Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
ImageView view = new ImageView(qrImage);
view.setEffect(new DropShadow());
// Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
// Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
// non-centered on the screen. Finally fade/blur it in.
Pane pane = new Pane(view);
pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
view.setOnMouseClicked( event1 -> overlay.done());
}Example 98
| Project: cryptomator-master File: DraggableListCell.java View source code |
private void onDragDetected(MouseEvent event) {
if (getItem() == null) {
return;
}
final ClipboardContent content = new ClipboardContent();
content.putString(Integer.toString(getIndex()));
final Image snapshot = this.snapshot(new SnapshotParameters(), null);
final Dragboard dragboard = startDragAndDrop(TransferMode.MOVE);
dragboard.setDragView(snapshot);
dragboard.setContent(content);
event.consume();
}Example 99
| Project: DesktopWidget-master File: Pidget.java View source code |
@Override
public void start() {
ImageView imgView = new ImageView();
getChildren().add(imgView);
System.out.println("Opening directory...");
String picDir = loadDirectory();
File dir = new File(picDir);
File[] files = dir.listFiles((File dir1, String name) -> name.endsWith(".jpg"));
if (files.length == 0) {
// Notify user of extreme lack of photographic material. :-)
Label noFilesLabel = new Label("No files in directory " + picDir + ", please add 'picdir=<path>' entry to Pidget.properties file.");
noFilesLabel.setPrefSize(widgetBounds.getWidth(), widgetBounds.getHeight());
noFilesLabel.setMaxSize(widgetBounds.getWidth(), widgetBounds.getHeight());
noFilesLabel.setAlignment(Pos.CENTER);
getChildren().add(noFilesLabel);
} else {
ArrayList<Image> images = new ArrayList<>();
for (File picFile : files) {
System.out.println(picFile);
try {
images.add(new Image(new FileInputStream(picFile)));
System.out.println("Adding picture " + picFile.toString() + " to the picture carousel...");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
// Start the clock & counter for picture rotation
startTime = System.currentTimeMillis() - 10000;
curPic = 0;
timer = new AnimationTimer() {
@Override
public void handle(long now) {
if ((curTime = System.currentTimeMillis()) - startTime > 9999) {
System.out.println("Now displaying " + images.get(curPic).toString() + " in Pidget...");
imgView.setImage(images.get(curPic));
imgView.setFitHeight(widgetBounds.getHeight());
imgView.setPreserveRatio(true);
curPic = curPic == images.size() - 1 ? 0 : curPic + 1;
startTime = curTime;
}
}
};
timer.start();
}
}Example 100
| Project: dwoss-master File: SubscribtionController.java View source code |
@Override
public void initialize(URL location, ResourceBundle resources) {
introduction.setText("" + "Vielen Dank für ihr Interesse an der Deutschen Warenwirtschaft Open Source Software (DWOSS).\n\n" + "Dies ist eine Testversion, die bei jedem Start neue Testdaten generiert. " + "Änderungen und von ihnen erstellte Daten gehen beim beenden der Applikation verloren.\n\n" + "Bei Fragen, Anregunden oder weiterführende Informationen für Unterstützung seitens der GG-Net GmbH " + "füllen Sie gern die in diesem Fenter abgebildete Form aus und Schicken diese per Knopfdruck ab.\n\n" + "Schließen Sie dieses Fenster oder senden Sie uns Ihre Anregungen und Fragen um DWOSS zu starten.");
try {
dwossLogo.setImage(new Image(loadDwossLogo().openStream()));
ggnetLogo.setImage(new Image(loadGgnetLogo().openStream()));
} catch (IOException ex) {
Logger.getLogger(SubscribtionController.class.getName()).log(Level.SEVERE, null, ex);
}
sendMessageButton.setOnAction(( eh) -> {
if (validateFields(name, mail, message)) {
progress.setProgress(-1);
sendPost(name.getText(), mail.getText(), message.getText());
progress.setProgress(100.);
stage.close();
}
});
}Example 101
| Project: ewidgetfx-master File: Pidget.java View source code |
@Override
public void start() {
ImageView imgView = new ImageView();
getChildren().add(imgView);
System.out.println("Opening directory...");
String picDir = loadDirectory();
File dir = new File(picDir);
File[] files = dir.listFiles((File dir1, String name) -> name.endsWith(".jpg"));
if (files.length == 0) {
// Notify user of extreme lack of photographic material. :-)
Label noFilesLabel = new Label("No files in directory " + picDir + ", please add 'picdir=<path>' entry to Pidget.properties file.");
noFilesLabel.setPrefSize(widgetBounds.getWidth(), widgetBounds.getHeight());
noFilesLabel.setMaxSize(widgetBounds.getWidth(), widgetBounds.getHeight());
noFilesLabel.setAlignment(Pos.CENTER);
getChildren().add(noFilesLabel);
} else {
ArrayList<Image> images = new ArrayList<>();
for (File picFile : files) {
System.out.println(picFile);
try {
images.add(new Image(new FileInputStream(picFile)));
System.out.println("Adding picture " + picFile.toString() + " to the picture carousel...");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
// Start the clock & counter for picture rotation
startTime = System.currentTimeMillis() - 10000;
curPic = 0;
timer = new AnimationTimer() {
@Override
public void handle(long now) {
if ((curTime = System.currentTimeMillis()) - startTime > 9999) {
System.out.println("Now displaying " + images.get(curPic).toString() + " in Pidget...");
imgView.setImage(images.get(curPic));
imgView.setFitHeight(widgetBounds.getHeight());
imgView.setPreserveRatio(true);
curPic = curPic == images.size() - 1 ? 0 : curPic + 1;
startTime = curTime;
}
}
};
timer.start();
}
}