use of javafx.scene.image.ImageView in project Zong by Xenoage.
the class PlayerFrame method createLanguageItems.
private void createLanguageItems() {
// clear old menu items
mnuSettingsLanguage.getItems().clear();
// add language menu items
List<LanguageInfo> langs = null;
try {
langs = LanguageInfo.getAvailableLanguages(LangManager.defaultLangPath);
} catch (Exception ex) {
handle(Companion.fatal(ex));
}
ToggleGroup toggleGroup = new ToggleGroup();
for (final LanguageInfo lang : langs) {
String name = lang.getLocalName();
String intName = lang.getInternationalName();
ImageView icon = null;
if (lang.getFlag16Path() != null)
icon = new ImageView(imageOrNull(lang.getFlag16Path()));
String text = name + (name.equals(intName) ? "" : " (" + intName + ")");
RadioMenuItem mnu = new RadioMenuItem(text, icon);
mnu.setToggleGroup(toggleGroup);
mnu.setOnAction(e -> app().execute(new LanguageChange(lang.getID())));
if (Lang.getCurrentLanguage().getID().equals(lang.getID()))
mnu.setSelected(true);
mnu.setUserData(lang.getID());
mnuSettingsLanguage.getItems().add(mnu);
}
}
use of javafx.scene.image.ImageView in project CapsLock by chrootRISCassembler.
the class MainFormController method onPanelClicked.
void onPanelClicked(MouseEvent event) {
// 右クリックじゃない
if (!event.getButton().equals(MouseButton.PRIMARY))
return;
// クリックされたパネルの取得
final ImageView view = (ImageView) event.getSource();
// パネルが示すゲーム
final Game NextGame = (Game) view.getUserData();
if (game != NextGame) {
PanelTilePane.getChildren().stream().peek(panel -> panel.setScaleX(1)).peek(panel -> panel.setScaleY(1)).forEach(panel -> panel.setEffect(null));
{
// 選択されたパネルにエフェクトを適応
view.setScaleX(1.15);
view.setScaleY(1.15);
// 影つけて
final DropShadow effect = new DropShadow(20, Color.BLUE);
// 光らせる
effect.setInput(new Glow(0.5));
view.setEffect(effect);
}
game = NextGame;
Logger.INST.debug("ContentsAreaController#setGame() call");
contentsAreaController.setGame(game);
{
final String name = NextGame.getName();
NameLabel.setText("[P-" + NextGame.getGameID() + "]" + name);
}
if (NextGame.getDesc() == null) {
Logger.INST.debug("No desc!");
}
DescriptionLabel.setText(NextGame.getDesc());
DescriptionLabel.setPadding(Insets.EMPTY);
DescriptionLabel.autosize();
}
// ダブルクリックじゃない
if (event.getClickCount() != 2)
return;
handler.launch(game);
}
use of javafx.scene.image.ImageView in project CapsLock by chrootRISCassembler.
the class MainFormController method ShufflePanels.
final void ShufflePanels() {
System.out.println("Shuffle called");
final int last = PanelTilePane.getChildren().size();
final Node FirstView = PanelTilePane.getChildren().get(0);
final List<Node> views = PanelTilePane.getChildren().subList(1, last).stream().map(node -> (ImageView) node).collect(Collectors.toList());
PanelTilePane.getChildren().clear();
Collections.shuffle(views);
PanelTilePane.getChildren().add(FirstView);
PanelTilePane.getChildren().addAll(views);
System.out.println("shuffle end");
}
use of javafx.scene.image.ImageView in project latexdraw by arnobl.
the class ViewShape method getActivatedGroupNodes.
private static Collection<Shape> getActivatedGroupNodes(final Group gp) {
// Adding all the shape children
final Collection<Shape> shapes = gp.getChildren().stream().filter(node -> node instanceof Shape && node.isVisible() && !node.isDisable()).map(node -> (Shape) node).collect(Collectors.toList());
// Adding all the view shape children
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof ViewShape<?> && node.isVisible() && !node.isDisable()).map(vs -> ((ViewShape<?>) vs).getActivatedShapes()).flatMap(st -> st.stream()).collect(Collectors.toList()));
// Adding the shapes contained in groups that are not view shapes
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof Group && !(node instanceof ViewShape<?>)).map(node -> getActivatedGroupNodes((Group) node)).flatMap(st -> st.stream()).collect(Collectors.toList()));
// Adding the images contained in the group
shapes.addAll(gp.getChildren().stream().filter(node -> node instanceof ImageView && node.isVisible() && !node.isDisable()).map(node -> {
final Bounds bounds = node.getBoundsInParent();
Rectangle rec = new Rectangle(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
rec.setFill(Color.WHITE);
rec.getTransforms().setAll(gp.getLocalToSceneTransform());
return rec;
}).collect(Collectors.toList()));
return shapes;
}
use of javafx.scene.image.ImageView in project latexdraw by arnobl.
the class LaTeXDraw method showSplash.
private void showSplash(final Stage initStage, final Task<Void> task) {
final ProgressBar loadProgress = new ProgressBar();
loadProgress.progressProperty().bind(task.progressProperty());
final Pane splashLayout = new VBox();
// NON-NLS
final Image img = new Image("res/LaTeXDrawSmall.png");
final ImageView splash = new ImageView(img);
splashLayout.getChildren().addAll(splash, loadProgress);
splashLayout.setEffect(new DropShadow());
loadProgress.setPrefWidth(img.getWidth());
task.stateProperty().addListener((observableValue, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
loadProgress.progressProperty().unbind();
loadProgress.setProgress(1d);
final FadeTransition fadeSplash = new FadeTransition(Duration.seconds(0.8), splashLayout);
fadeSplash.setFromValue(1d);
fadeSplash.setToValue(0d);
fadeSplash.setOnFinished(evt -> {
initStage.hide();
mainStage.setIconified(false);
mainStage.toFront();
});
fadeSplash.play();
}
});
final Scene splashScene = new Scene(splashLayout);
initStage.initStyle(StageStyle.UNDECORATED);
initStage.setScene(splashScene);
// NON-NLS
initStage.getIcons().add(new Image("/res/LaTeXDrawIcon.png"));
initStage.centerOnScreen();
initStage.toFront();
initStage.show();
}
Aggregations