Java Code Examples for javafx.stage.Stage#initStyle()

The following examples show how to use javafx.stage.Stage#initStyle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoginController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
public void loadCashier(String username)
{
    Stage stage = new Stage();
    CashierController cashier = new CashierController(username);
    
    cashier.loadProfileData(); 
    cashier.makeHistoryTable();
    cashier.fillLineChart();
    cashier.setPaceholders();
    cashier.loadNameList();
    cashier.addFocusListener();
    cashier.loadRefunds();
    
    stage.setScene(new Scene(cashier));
    
    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();
}
 
Example 2
Source File: ReceptionistController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@FXML
public void showPatientAccountSuccessIndicator(String patientId, String pName, String pMobile, String pGender)
{
    Stage stage= new Stage();
    PatientAccountSuccessController success = new PatientAccountSuccessController();
    
    success.fillPatientData( patientId, pName, pMobile, pGender);
    
    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();
}
 
Example 3
Source File: AllMessagesController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@FXML private void showMessage()
{
    AllMessages message = (AllMessages)messagesTable.getSelectionModel().getSelectedItem();
    //System.out.println(message.getMessage());
    
    Stage stage= new Stage();
    ReadMessageController newMessage = new ReadMessageController(message,newSysUser);
    newMessage.fillMessage();
    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();   
    
}
 
Example 4
Source File: DesktopNotification.java    From yfiton with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example 5
Source File: UserAccountController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@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(); 
}
 
Example 6
Source File: ReportsController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example 7
Source File: AdminController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@FXML
private void viewDoctorAccounts()
{
    Stage stage = new Stage();
    UserAccountController userAccounts = new UserAccountController("doctor",admin);
    
    ArrayList<ArrayList<String>> data = admin.getUserInfo("doctor");
    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(); 
}
 
Example 8
Source File: App.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void start(Stage stage) {
  try {
    // load splash
    Parent root = FXMLLoader.load(getClass().getResource("/jupiter/fxml/Splash.fxml"));
    // create scene and add styles
    Scene scene = new Scene(root, 500, 274);
    scene.getStylesheets().addAll(getClass().getResource("/jupiter/css/splash.css").toExternalForm());
    // set stage
    stage.setScene(scene);
    stage.setResizable(false);
    stage.initStyle(StageStyle.UNDECORATED);
    stage.getIcons().add(Icons.favicon());
    stage.toFront();
    stage.show();
  } catch (IOException e) {
    e.printStackTrace();
    Logger.error("could not load Jupiter GUI");
    Jupiter.exit(1);
  }
}
 
Example 9
Source File: AdminController.java    From HealthPlus with Apache License 2.0 6 votes vote down vote up
@FXML
private void viewReceptionistAccounts()
{
    Stage stage = new Stage();
    UserAccountController userAccounts = new UserAccountController("receptionist",admin);
    
    ArrayList<ArrayList<String>> data = admin.getUserInfo("receptionist");
    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(); 
}
 
Example 10
Source File: MusicPlayer.java    From MusicPlayer with MIT License 5 votes vote down vote up
private static void createLibraryXML() {
    try {
        FXMLLoader loader = new FXMLLoader(MusicPlayer.class.getResource(Resources.FXML + "ImportMusicDialog.fxml"));
        BorderPane importView = loader.load();

        // Create the dialog Stage.
        Stage dialogStage = new Stage();
        dialogStage.setTitle("Music Player Configuration");
        // Forces user to focus on dialog.
        dialogStage.initModality(Modality.WINDOW_MODAL);
        // Sets minimal decorations for dialog.
        dialogStage.initStyle(StageStyle.UTILITY);
        // Prevents the alert from being re-sizable.
        dialogStage.setResizable(false);
        dialogStage.initOwner(stage);

        // Sets the import music dialog scene in the stage.
        dialogStage.setScene(new Scene(importView));

        // Set the dialog into the controller.
        ImportMusicDialogController controller = loader.getController();
        controller.setDialogStage(dialogStage);

        // Show the dialog and wait until the user closes it.
        dialogStage.showAndWait();

        // Checks if the music was imported successfully. Closes the application otherwise.
        boolean musicImported = controller.isMusicImported();
        if (!musicImported) {
            System.exit(0);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example 11
Source File: NewFXPreloader.java    From Path-of-Leveling with MIT License 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    stage.initStyle(StageStyle.UNDECORATED);
    stage.setScene(createPreloaderScene());
    stage.show();
}
 
Example 12
Source File: CashierController.java    From HealthPlus with Apache License 2.0 5 votes vote down vote up
@FXML
private void getSelectedRow()
{        
    Bill bill = (Bill)billHistory.getSelectionModel().getSelectedItem();
    //System.out.println(bill.getPatientID());
    
    int serviceFees = Integer.parseInt(bill.getDoctor())+Integer.parseInt(bill.getHospital())+
                      Integer.parseInt(bill.getAppointment())+Integer.parseInt(bill.getLaboratory())+
                      Integer.parseInt(bill.getPharmacy());
    
    
    
    String name = bill.getPatientID();
    String serviceFee = Integer.toString(serviceFees);
    String vatVal = Integer.toString((serviceFees*5)/100);
    String tot = bill.getBill();
    String date = bill.getDate();
    String billID = bill.getBillID();
    
    
    Stage stage = new Stage();
    BillPreviewController billPreview = new BillPreviewController();
    
    billPreview.fillBillPreview(name,serviceFee,vatVal,tot,date,billID);
    
    Scene scene = new Scene(billPreview);
    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();
}
 
Example 13
Source File: Loading.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    long time = System.currentTimeMillis();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/loading.fxml"));
    Parent root = fxmlLoader.load();
    Scene scene = new Scene(root);
    stage.initStyle(StageStyle.UNDECORATED);
    stage.setAlwaysOnTop(true);
    stage.setScene(scene);
    stage.setTitle("启动中");
    stage.getIcons().add(new Image(getClass().getResourceAsStream("/skin/icon.png")));
    stage.show();
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
    System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
    System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
    LoadingController lc = fxmlLoader.getController();
    ApplicationStageManager.putStageAndController(ApplicationStageManager.StateAndController.LOADING, stage, lc);
    ApplicationStageManager.setApplication(this);
    LOGGER.info("启动页加载耗时:" + (System.currentTimeMillis() - time) + "毫秒");
    new Thread(() -> {
        Platform.runLater(() -> {
            startMainApp(stage);
        });
    }).start();
}
 
Example 14
Source File: Dialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Dialog(Stage parentStage) {
    this.response = new CompletableFuture<>();

    // TODO Calling an overridable method during construction should be
    // fixed via an API change
    Scene scene = new Scene(content(), width, height); // NOPMD
    stage = new Stage();
    stage.setScene(scene);
    stage.setTitle(title);
    stage.setOnCloseRequest(this::onClose);
    stage.initOwner(parentStage);
    Modality modality = Modality.APPLICATION_MODAL;
    stage.initModality(modality);
    stage.initStyle(stageStyle);
}
 
Example 15
Source File: RefundController.java    From HealthPlus with Apache License 2.0 5 votes vote down vote up
@FXML private void getRefundInfo()
{
    
    Refund refund = (Refund)refundTable.getSelectionModel().getSelectedItem();
    
    TablePosition pos = refundTable.getFocusModel().getFocusedCell();
    int column = pos.getColumn();
    if (column == 5)
    {
        info.setText("refund " + refund.getPatientID());
        
        Stage stage = new Stage();
        PopupAskController popup = new PopupAskController(info,cashier,this);
        popup.message("  Make the Refund?");    

        Scene scene = new Scene(popup);
        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();
    }    
    
    if (info.getText().equals("1"))
    {
        System.out.println("Yes!");
    }   
    System.out.println(info.getText());
    
}
 
Example 16
Source File: LoginController.java    From Online-Food-Ordering-System with MIT License 5 votes vote down vote up
@FXML
    public void TakeOrderScreen(ActionEvent event) throws Exception  {
	Stage primaryStage =new Stage();
               primaryStage.initStyle(StageStyle.UNDECORATED);
	Parent root =FXMLLoader.load(getClass().getResource("TakeOrder.fxml"));
	Scene scene = new Scene(root);
	primaryStage.setScene(scene);
	primaryStage.show();
               
           // Hide this current window (if this is what you want)
           ((Node)(event.getSource())).getScene().getWindow().hide();
}
 
Example 17
Source File: MainLauncher.java    From JavaFX-Chat with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStageObj = primaryStage;
    Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("views/LoginView.fxml"));
    primaryStage.initStyle(StageStyle.UNDECORATED);
    primaryStage.setTitle("Socket Chat : Client version 0.3");
    primaryStage.getIcons().add(new Image(getClass().getClassLoader().getResource("images/plug.png").toString()));
    Scene mainScene = new Scene(root, 350, 420);
    mainScene.setRoot(root);
    primaryStage.setResizable(false);
    primaryStage.setScene(mainScene);
    primaryStage.show();
    primaryStage.setOnCloseRequest(e -> Platform.exit());
}
 
Example 18
Source File: SplashScreenLoader.java    From OpenLabeler with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    var bundle = ResourceBundle.getBundle("bundle");
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/SplashScreen.fxml"), bundle);
    Parent root = loader.load();
    stage.setScene(new Scene(root));
    stage.initStyle(StageStyle.UNDECORATED);
    stage.show();
}
 
Example 19
Source File: AboutHandler.java    From VocabHunter with Apache License 2.0 4 votes vote down vote up
private void setupStage(final Stage stage, final Parent root) {
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.initStyle(StageStyle.UNDECORATED);
    stage.setScene(new Scene(root));
    stage.showAndWait();
}
 
Example 20
Source File: Overlay.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
public void display() {
    if (owner == null)
        owner = MainView.getRootContainer();

    if (owner != null) {
        Scene rootScene = owner.getScene();
        if (rootScene != null) {
            Scene scene = new Scene(getRootContainer());
            scene.getStylesheets().setAll(rootScene.getStylesheets());
            scene.setFill(Color.TRANSPARENT);

            setupKeyHandler(scene);

            stage = new Stage();
            stage.setScene(scene);
            Window window = rootScene.getWindow();
            setModality();
            stage.initStyle(StageStyle.TRANSPARENT);
            stage.setOnCloseRequest(event -> {
                event.consume();
                doClose();
            });
            stage.sizeToScene();
            stage.show();

            layout();

            addEffectToBackground();

            // On Linux the owner stage does not move the child stage as it does on Mac
            // So we need to apply centerPopup. Further with fast movements the handler loses
            // the latest position, with a delay it fixes that.
            // Also on Mac sometimes the popups are positioned outside of the main app, so keep it for all OS
            positionListener = (observable, oldValue, newValue) -> {
                if (stage != null) {
                    layout();
                    if (centerTime != null)
                        centerTime.stop();

                    centerTime = UserThread.runAfter(this::layout, 3);
                }
            };
            window.xProperty().addListener(positionListener);
            window.yProperty().addListener(positionListener);
            window.widthProperty().addListener(positionListener);

            animateDisplay();
            isDisplayed = true;
        }
    }
}