下面列出了javafx.scene.control.cell.CheckBoxTreeCell#javafx.stage.StageStyle 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
void loadMain() {
try {
Parent parent = FXMLLoader.load(getClass().getResource("/library/assistant/ui/main/main.fxml"));
Stage stage = new Stage(StageStyle.DECORATED);
stage.setTitle("Library Assistant");
stage.setScene(new Scene(parent));
stage.show();
LibraryAssistantUtil.setStageIcon(stage);
}
catch (IOException ex) {
LOGGER.log(Level.ERROR, "{}", ex);
}
}
public static void showSelectableTextModal(String title, String text) {
TextArea textArea = new BisqTextArea();
textArea.setText(text);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setPrefSize(800, 600);
Scene scene = new Scene(textArea);
Stage stage = new Stage();
if (null != title) {
stage.setTitle(title);
}
stage.setScene(scene);
stage.initModality(Modality.NONE);
stage.initStyle(StageStyle.UTILITY);
stage.show();
}
public static Stage createAboutStage(ResourceBundle bundle) {
try {
FXMLLoader loader = new FXMLLoader(OpenLabeler.class.getResource("/fxml/AboutPane.fxml"), bundle);
Parent root = loader.load();
Stage stage = new Stage();
stage.setTitle(bundle.getString("app.name"));
stage.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) {
stage.close();
}
});
stage.initStyle(StageStyle.UNDECORATED);
stage.setResizable(false);
stage.setScene(new Scene(root));
return stage;
}
catch (Exception ex) {
LOG.log(Level.WARNING, "Failed to load ICNS file", ex);
}
return null;
}
@FXML
private void viewLabAccounts()
{
Stage stage = new Stage();
UserAccountController userAccounts = new UserAccountController("lab_assistant",admin);
ArrayList<ArrayList<String>> data = admin.getUserInfo("lab_assistant");
userAccounts.fillUserDetail(data);
Scene scene = new Scene(userAccounts);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
public void showSuccessIndicator()
{
Stage stage= new Stage();
SuccessIndicatorController success = new SuccessIndicatorController();
Scene scene = new Scene(success);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
@FXML
public void showSuccessIndicator()
{
Stage stage= new Stage();
SuccessIndicatorController success = new SuccessIndicatorController();
Scene scene = new Scene(success);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
@Override
public void start(Stage primaryStage) throws Exception {
this.primaryStage = primaryStage;
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStage.setMinWidth(1000);
primaryStage.setMinHeight(100);
ProjectManager.getRecent();
if (initialProject != null) ProjectManager.switchProject(ProjectManager.readProject(initialProject));
if (ProjectManager.getPPFProject() == null) {
new WelcomeWindow(this);
} else {
refreshProject();
}
}
@FXML
protected void handleStartAction(ActionEvent event) {
try {
clientExecutor.setListeners(Arrays.asList(new ProgressBarUpdater(), new RunButtonUpdater()));
clientExecutor.setConfig(configMap);
clientExecutor.run();
} catch (IllegalArgumentException | NullPointerException | ConfigException e) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.initModality(Modality.APPLICATION_MODAL);
alert.initStyle(StageStyle.UTILITY);
alert.setTitle("Ошибка");
alert.setHeaderText("Произошла ошибка");
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}
@FXML
private void viewCashierAccounts()
{
Stage stage = new Stage();
UserAccountController userAccounts = new UserAccountController("cashier",admin);
ArrayList<ArrayList<String>> data = admin.getUserInfo("cashier");
System.out.println(data);
userAccounts.fillUserDetail(data);
Scene scene = new Scene(userAccounts);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
@FXML private void sendMsg3()
{
Stage stage= new Stage();
NewMessageController newMessage = new NewMessageController(admin);
newMessage.userid.setText(msgLabel3.getText());
newMessage.receivertxt.setText(" "+userName3.getText());
Scene scene = new Scene(newMessage);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
@Override
public void start(final Stage stage) throws Exception {
stage.initStyle(StageStyle.UTILITY);
stage.setScene(new Scene(new Group(), 100, 100));
stage.setX(0);
stage.setY(Screen.getPrimary().getBounds().getHeight() + 100);
stage.show();
Stage app = new Stage();
app.setScene(new Scene(new Group(), 300, 200));
app.setTitle("JavaFX隐藏任务栏");
app.initOwner(stage);
app.initModality(Modality.APPLICATION_MODAL);
app.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
event.consume();
stage.close();
}
});
app.show();
}
@FXML
private void viewPharmacistAccounts()
{
Stage stage = new Stage();
UserAccountController userAccounts = new UserAccountController("pharmacist",admin);
ArrayList<ArrayList<String>> data = admin.getUserInfo("pharmacist");
userAccounts.fillUserDetail(data);
Scene scene = new Scene(userAccounts);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
private void buildCircleStage() {
circleStage = new Stage();
circleStage.initStyle(StageStyle.TRANSPARENT);
circleStage.initOwner(this);
circleZone = new Circle(CIRCLE_RADIUS);
circleZone.setCenterX(CIRCLE_RADIUS);
circleZone.setCenterY(CIRCLE_RADIUS);
circleZone.getStyleClass().add("dockzone-circle-container-selectors");
circleStageRoot = new Pane(circleZone);
circleStageRoot.setStyle("-fx-background-color:rgba(0,0,0,0);");
circleStageScene = new Scene(circleStageRoot, CIRCLE_RADIUS * 2, CIRCLE_RADIUS * 2, Color.TRANSPARENT);
circleStage.setScene(circleStageScene);
circleStageRoot.setOpacity(0);
}
/**
* 打开一个新窗口
*
* @param fxmlUrl fxml文件的url
* @param isShowTitle 是否显示title
* @return Stage,如果出现异常返回null
*/
public static Stage newWindow(URL fxmlUrl, boolean isShowTitle){
try {
Stage stage = new Stage();
if (!isShowTitle){
setNoBroder(stage);
}
// 背景透明
stage.initStyle(StageStyle.TRANSPARENT);
Parent layout = FXMLLoader.load(fxmlUrl);
Scene scene = new Scene(layout, Color.TRANSPARENT);
stage.setScene(scene);
// 在屏幕中间
stage.centerOnScreen();
return stage;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static void openNotification(String text) {
Stage stage = new Stage();
stage.setWidth(300);
stage.setHeight(125);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
NotificationView notificationView = new NotificationView();
stage.setScene(new Scene(notificationView.getNotificationView(), 300, 125));
stage.setResizable(false);
stage.setAlwaysOnTop(true);
stage.setX(primaryScreenBounds.getMinX() + primaryScreenBounds.getWidth() - 300);
stage.setY(primaryScreenBounds.getMinY() + primaryScreenBounds.getHeight() - 125);
stage.initStyle(StageStyle.UNDECORATED);
notificationView.getNotificationText().setWrapText(true);
notificationView.getNotificationText().setAlignment(Pos.CENTER);
notificationView.getNotificationText().setPadding(new Insets(0, 5, 0, 20));
notificationView.getNotificationText().setText(text);
stage.show();
PauseTransition delay = new PauseTransition(Duration.seconds(5));
delay.setOnFinished(event -> stage.close());
delay.play();
}
@FXML
public void showSuccessIndicator()
{
Stage stage= new Stage();
SuccessIndicatorController success = new SuccessIndicatorController();
Scene scene = new Scene(success);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
@Override
public void start(Stage primaryStage) {
Map<String, String> parameters = getParameters().getNamed();
primaryStage.initStyle(StageStyle.TRANSPARENT);
Scene scene = new Scene(new VBox(), 1, 1);
scene.setFill(null);
primaryStage.setScene(scene);
primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("/yfiton-icon.png")));
primaryStage.show();
Notifications.create()
.darkStyle()
.graphic(new ImageView(Notifications.class.getResource("/" + parameters.get("type") + ".png").toExternalForm()))
.hideAfter(Duration.seconds(Integer.parseInt(parameters.get("hideAfter"))))
.onHideAction(event -> System.exit(0))
.position(Pos.valueOf(parameters.get("position")))
.text(parameters.get("message"))
.show();
}
public void configure() {
try {
final var stage = new Stage();
stage.setResizable(false);
stage.initStyle(StageStyle.UTILITY);
final var theLoader = new FXMLLoader(getClass().getResource("/scenes/configuration.fxml"));
final Parent theConfigurationRoot = theLoader.load();
stage.setScene(new Scene(theConfigurationRoot));
stage.setTitle("Configuration");
stage.initModality(Modality.APPLICATION_MODAL);
final ConfigurationController theConfigController = theLoader.getController();
theConfigController.initialize(application.getConfigurationManager(), stage);
stage.initOwner(window);
stage.show();
} catch (final IOException e) {
log.error("Error running configuration dialog", e);
}
}
public Reason showReasonEditor() throws Exception {
// Load the fxml file and create a new stage for the pop-up dialog.
if (reasonController == null) {
FXMLLoader loader = FXMLLoaderFactory.reasonEditorLoader();
AnchorPane page = (AnchorPane) loader.getRoot();
// Create the dialog Stage.
Stage dialogStage = new Stage(StageStyle.DECORATED);
dialogStage.setTitle(DesignerLocalizer.instance().getLangString("reason.editor.title"));
dialogStage.initModality(Modality.NONE);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
// get the controller
reasonController = loader.getController();
reasonController.setDialogStage(dialogStage);
reasonController.initialize(this);
}
// Show the dialog and wait until the user closes it
if (!reasonController.getDialogStage().isShowing()) {
reasonController.getDialogStage().showAndWait();
}
return reasonController.getSelectedReason();
}
public Material showMaterialEditor() throws Exception {
if (this.materialController == null) {
FXMLLoader loader = FXMLLoaderFactory.materialEditorLoader();
AnchorPane pane = (AnchorPane) loader.getRoot();
// Create the dialog Stage.
Stage dialogStage = new Stage(StageStyle.DECORATED);
dialogStage.setTitle(DesignerLocalizer.instance().getLangString("material.editor.title"));
dialogStage.initModality(Modality.NONE);
Scene scene = new Scene(pane);
dialogStage.setScene(scene);
// get the controller
materialController = loader.getController();
materialController.setDialogStage(dialogStage);
materialController.initialize(this);
}
// Show the dialog and wait until the user closes it
if (!materialController.getDialogStage().isShowing()) {
materialController.getDialogStage().showAndWait();
}
return materialController.getSelectedMaterial();
}
@FXML private void searchUser()
{
String userid = userIDlbl.getText();
if (!userid.equals(""))
{
Stage stage= new Stage();
SysUserController user = new SysUserController(this,userid);
user.load();
Scene scene = new Scene(user);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}
}
public void about(){
final Stage stage = new Stage();
stage.setResizable(false);
stage.initModality(Modality.WINDOW_MODAL);
stage.initStyle(StageStyle.UTILITY);
stage.setTitle("About SONDY");
WebView webView = new WebView();
webView.getEngine().loadContent(getReferences());
webView.setMaxWidth(Main.columnWidthLEFT);
webView.setMinWidth(Main.columnWidthLEFT);
webView.setMaxHeight(Main.columnWidthLEFT);
webView.setMinHeight(Main.columnWidthLEFT);
Scene scene = new Scene(VBoxBuilder.create().children(new Label("SONDY "+Main.version),new Label("Main developper: Adrien Guille <[email protected]>"),webView).alignment(Pos.CENTER).padding(new Insets(10)).spacing(3).build());
scene.getStylesheets().add("resources/fr/ericlab/sondy/css/GlobalStyle.css");
stage.setScene(scene);
stage.show();
}
public ModalDialog(Window parent, Node content) {
Stage stage = new Stage();
Scene scene = new Scene(this);
scene.setFill(null);
stage.setScene(scene);
stage.initModality(Modality.WINDOW_MODAL);
stage.initStyle(StageStyle.TRANSPARENT);
stage.initOwner(parent);
stage.setX(parent.getX());
stage.setY(parent.getY());
setPrefSize(parent.getWidth(), parent.getHeight());
setStyle("-fx-background-color: rgba(0, 0, 0, 0.5);");
getChildren().add(content);
stage.show();
}
public ConfirmationDialog(StylesConfig styles, DialogStyle style, String positiveButtonText,
String negativeButtonText) {
initModality(Modality.WINDOW_MODAL);
initStyle(StageStyle.UTILITY);
setResizable(false);
this.dialogContent = new ConfirmationDialogContent(style.icon);
VBox containerPane = new VBox();
containerPane.getStyleClass().addAll(Style.CONTAINER.css());
containerPane.getStyleClass().addAll("-pdfsam-dialog", style.style);
HBox buttons = new HBox(buildPositiveButton(positiveButtonText, true),
buildCancelButton(negativeButtonText, false));
buttons.getStyleClass().add("-pdfsam-dialog-buttons");
containerPane.getChildren().addAll(dialogContent, buttons);
Scene scene = new Scene(containerPane);
scene.getStylesheets().addAll(styles.styles());
setScene(scene);
}
@Override public void start(Stage stage) {
layout.getChildren().setAll(background, createContent());
layout.setStyle("-fx-background-color: null");
Scene scene = new Scene(
layout,
200, 300,
Color.TRANSPARENT
);
Platform.setImplicitExit(false);
scene.setOnMouseClicked(event -> {
if (event.getClickCount() == 2) Platform.exit();
});
makeSmoke(stage);
stage.initStyle(StageStyle.TRANSPARENT);
stage.setScene(scene);
stage.show();
background.setImage(copyBackground(stage));
background.setEffect(frostEffect);
makeDraggable(stage, layout);
}
FileEventSource showFileShareEditor() throws Exception {
FXMLLoader loader = FXMLLoaderFactory.fileShareLoader();
AnchorPane page = (AnchorPane) loader.getRoot();
// Create the dialog Stage.
Stage dialogStage = new Stage(StageStyle.DECORATED);
dialogStage.setTitle(DesignerLocalizer.instance().getLangString("file.editor.title"));
dialogStage.initModality(Modality.WINDOW_MODAL);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
// get the controller
FileShareController fileShareController = loader.getController();
fileShareController.setDialogStage(dialogStage);
fileShareController.initialize(this);
// Show the dialog and wait until the user closes it
if (!fileShareController.getDialogStage().isShowing()) {
fileShareController.getDialogStage().showAndWait();
}
return fileShareController.getSource();
}
CronEventSource showCronEditor() throws Exception {
FXMLLoader loader = FXMLLoaderFactory.cronEditorLoader();
AnchorPane page = (AnchorPane) loader.getRoot();
// Create the dialog Stage.
Stage dialogStage = new Stage(StageStyle.DECORATED);
dialogStage.setTitle(DesignerLocalizer.instance().getLangString("cron.editor.title"));
dialogStage.initModality(Modality.WINDOW_MODAL);
Scene scene = new Scene(page);
dialogStage.setScene(scene);
// get the controller
CronEditorController cronController = loader.getController();
cronController.setDialogStage(dialogStage);
cronController.initialize(this);
// Show the dialog and wait until the user closes it
if (!cronController.getDialogStage().isShowing()) {
cronController.getDialogStage().showAndWait();
}
return cronController.getSource();
}
public DockZones(DockStation station, DockNode nodeToMove) {
this.nodeToMove = nodeToMove;
this.ownerStation = station;
initOwner(ownerStation.getStationWindow());
initStyle(StageStyle.TRANSPARENT);
buildUI();
buildCircleStage();
makeSelectors();
createRectangleForPreview();
setAlwaysOnTop(true);
circleStage.setAlwaysOnTop(true);
}
public void loadLabAssistant(String username)
{
Stage stage = new Stage();
LabAssistantController lab = new LabAssistantController(username);
lab.loadProfileData();
lab.fillPieChart();
lab.setAppointments();
lab.fillLabAppiontments();
lab.addFocusListener();
lab.setPaceholders();
lab.fillTodayAppointments();
stage.setScene(new Scene(lab));
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
stage.show();
}
@FXML
public void showSuccessIndicator()
{
Stage stage= new Stage();
SuccessIndicatorController success = new SuccessIndicatorController();
Scene scene = new Scene(success);
stage.setScene(scene);
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//set Stage boundaries to visible bounds of the main screen
stage.setX(primaryScreenBounds.getMinX());
stage.setY(primaryScreenBounds.getMinY());
stage.setWidth(primaryScreenBounds.getWidth());
stage.setHeight(primaryScreenBounds.getHeight());
stage.initStyle(StageStyle.UNDECORATED);
scene.setFill(null);
stage.initStyle(StageStyle.TRANSPARENT);
stage.show();
}