本文整理汇总了Java中javafx.stage.Stage.initStyle方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.initStyle方法的具体用法?Java Stage.initStyle怎么用?Java Stage.initStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Stage
的用法示例。
在下文中一共展示了Stage.initStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AboutView
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* Creates an instance of a {@link AboutView}.
*
* @throws IOException if unable to load the controller
*/
@Inject
public AboutView(final FXMLLoader fxmlLoader) throws UIInitialisationException, IOException {
stage = new Stage();
stage.initStyle(StageStyle.UNDECORATED);
stage.setResizable(false);
final URL resource = getClass().getResource(ABOUT_VIEW);
fxmlLoader.setLocation(resource);
final Scene rootScene = new Scene(fxmlLoader.load());
rootScene.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
if (event.getCode() == KeyCode.ESCAPE) {
stage.hide();
}
});
stage.setScene(rootScene);
stage.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) {
stage.hide();
}
});
}
示例2: loadImageArchiveEditor
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void loadImageArchiveEditor() {
try {
FXMLLoader loader = new FXMLLoader(App.class.getResource("/ImageArchiveUI.fxml"));
Parent root = loader.load();
ImageArchiveController controller = loader.getController();
Stage stage = new Stage();
controller.setStage(stage);
stage.setTitle("Image Archive Editor");
Scene scene = new Scene(root);
scene.getStylesheets().add(App.class.getResource("/style.css").toExternalForm());
stage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/app_icon_128.png")));
stage.setScene(scene);
stage.initStyle(StageStyle.TRANSPARENT);
stage.setResizable(false);
stage.centerOnScreen();
stage.setTitle("Archive Editor");
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(final Stage primaryStage) throws Exception
{
this.preloaderStage = primaryStage;
final ImageView splash = new ImageView(new Image(Constant.IMG_DIR + "banner.png"));
this.loadProgressPhase = new JFXProgressBar();
this.loadProgressPhase.setPrefWidth(Constant.SPLASH_WIDTH);
this.splashLayout = new VBox();
this.splashLayout.getChildren().addAll(splash, this.loadProgressPhase);
this.splashLayout.setStyle("-fx-padding: 5; " + "-fx-background-color: gainsboro; " + "-fx-border-width:2; "
+ "-fx-border-color: " + "linear-gradient(" + "to bottom, " + "MediumSeaGreen, "
+ "derive(MediumSeaGreen, 50%)" + ");");
this.splashLayout.setEffect(new DropShadow());
final Scene splashScene = new Scene(this.splashLayout, Color.TRANSPARENT);
final Rectangle2D bounds = Screen.getPrimary().getBounds();
primaryStage.setScene(splashScene);
primaryStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - Constant.SPLASH_WIDTH / 2);
primaryStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - Constant.SPLASH_HEIGHT / 2);
primaryStage.getIcons().add(new Image(Constant.IMG_DIR + "icon.png"));
primaryStage.setTitle(Constant.APP_NAME);
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setAlwaysOnTop(true);
primaryStage.show();
}
示例4: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
App.stage = stage;
try {
Parent root = FXMLLoader.load(App.class.getResource("/ui/Main.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("/style.css").toExternalForm());
stage.setTitle("OSRS Data To 317 Converter");
stage.centerOnScreen();
stage.setResizable(false);
stage.sizeToScene();
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.getIcons().add(new Image(App.class.getResourceAsStream("/icons/icon.png")));
stage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
示例5: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
URL location = getClass().getResource("MainFXMLDocument.fxml");
Parent root = FXMLLoader.load(location);
root.setOnMouseDragged(e -> this.dragStage(e, stage));
root.setOnMouseMoved(e -> this.calculateGap(e, stage));
Scene scene = new Scene(root, Color.TRANSPARENT);
scene.getStylesheets().add("/com/shekkar/xpanderfx/mainStyler.css");
stage.setScene(scene);
stage.setAlwaysOnTop(true);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
示例6: EditorDialog
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* Instantiates a new Editor dialog.
*/
public EditorDialog() {
this.showedTime = LocalTime.now();
container = new VBox();
container.setAlignment(CENTER);
final EditorConfig editorConfig = EditorConfig.getInstance();
final CssColorTheme theme = editorConfig.getTheme();
final Scene scene = new Scene(container);
final ObservableList<String> stylesheets = scene.getStylesheets();
stylesheets.addAll(CSS_REGISTRY.getAvailableCssFiles());
stylesheets.add(theme.getCssFile());
createControls(container);
dialog = new Stage();
dialog.setTitle(getTitleText());
dialog.initStyle(StageStyle.UTILITY);
dialog.initModality(Modality.WINDOW_MODAL);
dialog.setResizable(isResizable());
dialog.setScene(scene);
configureSize(container);
}
示例7: buildWindow
import javafx.stage.Stage; //导入方法依赖的package包/类
private static Stage buildWindow (String title)
{
tempStage = new Stage();
tempStage.initStyle(StageStyle.UTILITY); // Einfaches Fenster
// ohne 'minimiere'
// und 'maximiere'
// Buttons
tempStage.setResizable(false); // Verbiete �nderung
// der Gr�sse
tempStage.initModality(Modality.APPLICATION_MODAL); // Blockiere alle
// anderen
// Fenster
tempStage.setTitle(title); // Setze Titel
return tempStage;
}
示例8: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(final Stage primaryStage) throws IOException, UIInitialisationException {
stage = primaryStage;
primaryStage.setTitle(Hygene.TITLE);
primaryStage.initStyle(StageStyle.UNDECORATED);
progress = new ProgressBar();
final URL resource = getClass().getResource(PRELOADER_VIEW);
final Parent root = FXMLLoader.load(resource);
if (root == null) {
throw new UIInitialisationException("Root of Preloader could not be found.");
}
final Scene rootScene = new Scene(root);
primaryStage.setScene(rootScene);
primaryStage.show();
}
示例9: wait
import javafx.stage.Stage; //导入方法依赖的package包/类
public static void wait(WebView view) {
Stage stage = new Stage();
WebEngine engine = view.getEngine();
engine.documentProperty().addListener((observable, o, n) -> stage.close());
Scene scene = new Scene(view);
stage.initStyle(StageStyle.UNDECORATED);
stage.setWidth(1);
stage.setHeight(1);
stage.setScene(scene);
stage.showAndWait();
stage.close();
}
示例10: start
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* Método responsável por tratatar e executar a cena
*/
@Override
public void start(Stage primaryStage) throws Exception {
stage = primaryStage;
Pane telaInicialStage = FXMLLoader.load(getClass().getResource("/view/LayoutTelaInicial.fxml"));
telaInicial = new Scene(telaInicialStage, 800, 600);
// A linha abaixo adiciona o arquivo CSS à cena
telaInicialStage.getStylesheets().add("css/buttonStyle.css");
// A linha abaixo atribui título à Janela
//primaryStage.setTitle("Show do Milhão");
// A linha abaixo não permite maximizar ou minimizar a janela (false) caso a aplicação tenha borda
//primaryStage.setResizable(false);
// A linha abaixo tira a borda da aplicação
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setScene(telaInicial);
primaryStage.show();
// MÚSICA DE ABERTURA COM REPRODUÇÃO CONTÍNUA
thePlayer = new MyAudioPlayer(path, true);
thePlayer.start();
// MÚSICA DE ABERTURA SEM REPRODUÇÃO CONTÍNUA
//tocarMusica();
}
示例11: start
import javafx.stage.Stage; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
示例12: loadArchiveEditor
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void loadArchiveEditor() {
try {
FXMLLoader loader = new FXMLLoader(App.class.getResource("/ArchiveUI.fxml"));
Parent root = (Parent) loader.load();
ArchiveController controller = (ArchiveController) loader.getController();
Stage stage = new Stage();
controller.setStage(stage);
stage.setTitle("Archive Editor");
Scene scene = new Scene(root);
scene.getStylesheets().add(App.class.getResource("/style.css").toExternalForm());
stage.getIcons().add(new Image(getClass().getResourceAsStream("/icons/app_icon_128.png")));
stage.setScene(scene);
stage.initStyle(StageStyle.TRANSPARENT);
stage.setResizable(false);
stage.centerOnScreen();
stage.setTitle("Archive Editor");
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
示例13: showMasterDetailInWindow
import javafx.stage.Stage; //导入方法依赖的package包/类
private void showMasterDetailInWindow(final Stage stage, final Database database, final MasterDetailViewFeatures features) throws JAXBException, IOException {
final Parent viewRoot = ViewFactory.createMasterDetailView(database, features);
final Rectangle clip = new Rectangle();
clip.setArcHeight(18);
clip.setArcWidth(18);
clip.widthProperty().bind(stage.widthProperty());
clip.heightProperty().bind(stage.heightProperty());
//TODO: Only clipping or PerspectiveCamera is working... :(
features.customWindowClipProperty().addListener((obs, oldVal, newVal) -> {
if (newVal) {
viewRoot.setClip(clip);
} else {
viewRoot.setClip(null);
}
});
final Scene scene = new Scene(viewRoot);
features.useCssProperty().addListener((obs, oldVal, newVal) -> {
updateStylesheets(scene, newVal);
});
updateStylesheets(scene, features.isUseCss());
scene.setFill(Color.TRANSPARENT);
scene.setCamera(new PerspectiveCamera());
if (features.isCustomWindowUI()) {
stage.initStyle(StageStyle.TRANSPARENT);
}
stage.setTitle("Movie Database");
stage.setScene(scene);
stage.setWidth(1100);
stage.setHeight(720);
stage.centerOnScreen();
stage.show();
final FeaturesDialog featuresDialog = new FeaturesDialog(stage);
featuresDialog.addFeature(new Feature("Layout & Style", "demo2-css", features.useCssProperty()));
featuresDialog.addFeature(new Feature("Image Background", "demo2-image-background",features.movieBackgroundProperty()));
featuresDialog.addFeature(new Feature("List Animation", "demo2-list-animation",features.listAnimationProperty()));
featuresDialog.addFeature(new Feature("List Shadow", "demo2-list-shadow",features.listShadowProperty()));
// featuresDialog.addFeature(new Feature("List Cache", "demo2-list-cache",features.listCacheProperty()));
featuresDialog.addFeature(new Feature("Poster Transform", "demo2-poster-transform",features.posterTransformProperty()));
featuresDialog.addFeature(new Feature("Custom Window UI", "demo2-custom-window-ui",features.customWindowUIProperty()));
featuresDialog.addFeature(new Feature("Custom Window Clip", "demo2-custom-window-clip", features.customWindowClipProperty()));
featuresDialog.show();
}
示例14: create
import javafx.stage.Stage; //导入方法依赖的package包/类
private BaseDialog create() {
mStage = new Stage();
mStage.initModality(Modality.WINDOW_MODAL);
mStage.initOwner(getOwner());
mStage.initStyle(StageStyle.DECORATED);
mStage.setResizable(false);
viewTuple = createContent();
BaseView view = null;
if(viewTuple.getView() instanceof BaseView){
view = (BaseView) viewTuple.getView();
view.onDialogSet(this);
root = (Pane) viewTuple.getRoot();
alignCenter(root.getPrefWidth(), root.getPrefHeight());
if(isDragable)
dragDialogAbleNode(root);
} else {
try {
throw new Exception("your view is not a BaseView!");
} catch (Exception e) {
e.printStackTrace();
}
}
mScene = new Scene(viewTuple.getRoot());
// mScene.getStylesheets().setAll(TestinStage.getInstance().getStylesheet());
mStage.setScene(mScene);
mStage.setTitle(view.getTitle());
return this;
}
示例15: create
import javafx.stage.Stage; //导入方法依赖的package包/类
public void create(Stage primaryStage) {
this.primaryStage = primaryStage;
FunnyCreator.getLogger().info("Creating primary view");
ScreenUtils.to(primaryStage, 960, 480);
ScreenUtils.center(primaryStage);
WebView view = new WebView();
this.engine = view.getEngine();
engine.getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != State.SUCCEEDED) {
return;
}
FunnyCreator.getLogger().info("Showing view");
primaryStage.show();
FunnyCreator.getLogger().info("Injecting FGC bridge");
JSObject window = (JSObject) engine.executeScript("window");
window.setMember("FunnyGuildsCreator", new FunnyBridge());
creator.runAsync(() -> {
try {
creator.load();
} catch (Exception e) {
e.printStackTrace();
AlertUtils.alert("FunnyCreator Exception", "Cannot load creator", ExceptionUtils.getStackTrace(e), creator::shutdown);
}
});
});
String style = IOUtils.toString(getClass().getResourceAsStream("/panel/front.css"), Charset.forName("UTF-8"));
String script = IOUtils.toString(getClass().getResourceAsStream("/panel/front.js"), Charset.forName("UTF-8"));
String html = IOUtils.toString(getClass().getResourceAsStream("/panel/front.html"), Charset.forName("UTF-8"));
String content = html
.replace("{{STYLE}}", style)
.replace("{{SCRIPT}}", script)
.replace("{{VERSION}}", FunnyConstants.VERSION);
engine.loadContent(content);
Scene scene = new Scene(view, primaryStage.getWidth(), primaryStage.getHeight());
primaryStage.getIcons().add(new Image(FunnyCreator.class.getResourceAsStream("/icon.png")));
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setTitle("FunnyGuilds Creator " + FunnyConstants.VERSION);
primaryStage.setScene(scene);
}