本文整理汇总了Java中javafx.stage.Stage.initModality方法的典型用法代码示例。如果您正苦于以下问题:Java Stage.initModality方法的具体用法?Java Stage.initModality怎么用?Java Stage.initModality使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.stage.Stage
的用法示例。
在下文中一共展示了Stage.initModality方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showPersonDialog
import javafx.stage.Stage; //导入方法依赖的package包/类
public boolean showPersonDialog(Person person) throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(this.getClass().getResource("personDialog.fxml"));
GridPane dialog = loader.load();
Stage dialogStage = new Stage();
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.initOwner(stage);
Scene scene = new Scene(dialog);
dialogStage.setScene(scene);
PersonDialogController pdc = loader.getController();
pdc.setDialogStage(dialogStage);
pdc.setPerson(person);
dialogStage.showAndWait();
return pdc.isOkButtonClicked();
}
示例2: AlertBox
import javafx.stage.Stage; //导入方法依赖的package包/类
public AlertBox(Stage primaryStage, FXMLLoader fxmlLoader, boolean alertType, String msg) {
try {
Parent root = (Parent) fxmlLoader.load();
Scene scene = new Scene(root);
Label alertText = (Label) scene.lookup("#alert_text");
alertText.setText(msg);
if (alertType == true)
alertText.setStyle("-fx-text-fill: chartreuse");
else
alertText.setStyle("-fx-text-fill: red");
Stage stage = new Stage();
stage.setResizable(false);
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(primaryStage);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.showAndWait();
} catch (Exception e) {
}
}
示例3: Exe
import javafx.stage.Stage; //导入方法依赖的package包/类
void Exe(int i) {
if(i==1) {
warnmesse="プレイ開始から5分経過しました\n混雑している場合は次の人に\n交代してください";
fontsize=25;
}else if(i==2) {
warnmesse="プレイ開始から10分経過しました\n混雑している場合は次の人に\n交代してください";
fontsize=25;
}else if(i==-1) {
warnmesse="user timer is reset";
fontsize=35;
}
final Stage primaryStage = new Stage(StageStyle.TRANSPARENT);
primaryStage.initModality(Modality.NONE);
final StackPane root = new StackPane();
final Scene scene = new Scene(root, 350, 140);
scene.setFill(null);
final Label label = new Label(warnmesse);
label.setFont(new Font("Arial", fontsize));
BorderPane borderPane = new BorderPane();
borderPane.setCenter(label);
borderPane.setStyle("-fx-background-radius: 10;-fx-background-color: rgba(0,0,0,0.3);");
root.getChildren().add(borderPane);
final Rectangle2D d = Screen.getPrimary().getVisualBounds();
primaryStage.setScene(scene);
primaryStage.setAlwaysOnTop(true);
primaryStage.setX(d.getWidth()-350);
primaryStage.setY(d.getHeight()-300);
primaryStage.show();
final Timeline timer = new Timeline(new KeyFrame(Duration.seconds(CLOSE_SECONDS), (ActionEvent event) -> primaryStage.close()));
timer.setCycleCount(Timeline.INDEFINITE);
timer.play();
}
示例4: studyProfileDetails
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* Displays the StudyProfile details page
*
* @param profile StudyProfile for which the details should be shown.
*/
public void studyProfileDetails(StudyProfile profile) throws IOException
{
StudyProfileController spc = new StudyProfileController(profile);
// Load in the .fxml file:
FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/StudyProfile.fxml"));
loader.setController(spc);
Parent root = loader.load();
// Set the scene:
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setScene(new Scene(root, 550, 232));
stage.setTitle(profile.getName());
stage.resizableProperty().setValue(false);
stage.getIcons().add(new Image("file:icon.png"));
stage.showAndWait();
}
示例5: btnAboutAction
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void btnAboutAction()
{
try
{
FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/AboutDialog.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.show();
}
catch(IOException e)
{
e.printStackTrace();
}
}
示例6: start
import javafx.stage.Stage; //导入方法依赖的package包/类
public void start() {
stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("Create File");
stage.setWidth(400);
stage.setHeight(150);
stage.setResizable(false);
Screen screen = new Screen();
Point point = screen.calculateCenter(400, 150);
stage.setX(point.getX());
stage.setY(point.getY());
CustomIcons customIcons = new CustomIcons();
stage.getIcons().add(customIcons.getLogo());
CreateFileView createFileView = new CreateFileView();
Scene scene = new Scene(createFileView.getView());
stage.setScene(scene);
stage.show();
}
示例7: showErrorDialog
import javafx.stage.Stage; //导入方法依赖的package包/类
private static void showErrorDialog(Throwable e) {
e.printStackTrace();
StringWriter errorMsg = new StringWriter();
e.printStackTrace(new PrintWriter(errorMsg));
Stage dialog = new Stage();
dialog.initModality(Modality.APPLICATION_MODAL);
FXMLLoader loader = new FXMLLoader(ErrorController.class.getResource("Error.fxml"));
try {
Parent root = loader.load();
((ErrorController) loader.getController()).setErrorText(errorMsg.toString());
dialog.setScene(new Scene(root, 250, 400));
dialog.show();
} catch (IOException exc) {
exc.printStackTrace();
}
}
示例8: editDrug
import javafx.stage.Stage; //导入方法依赖的package包/类
private void editDrug(Drug drug) {
FXMLLoader fXMLLoader = new FXMLLoader(getClass().getResource("/view/drug/EditDrug.fxml"));
try {
Parent root = fXMLLoader.load();
EditDrugController controller = fXMLLoader.getController();
controller.setDrugId(drug.getId());
controller.taNote.setText(drug.getNote());
controller.tfTradeName.setText(drug.getName());
controller.tfGenericName.setText(drug.getGenricName());
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("Edit Drug");
stage.setScene(new Scene(root));
stage.show();
} catch (IOException ex) {
Logger.getLogger(PatientsController.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例9: openPrintablePrescription
import javafx.stage.Stage; //导入方法依赖的package包/类
private void openPrintablePrescription(int prescriptionId) {
FXMLLoader fXMLLoader = new FXMLLoader(getClass().getResource("/view/prescription/ViewPrescription.fxml"));
try {
Parent root = fXMLLoader.load();
ViewPrescriptionController controller = fXMLLoader.getController();
controller.loadPrescription(prescriptionId);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setTitle("Print Prescription");
stage.setScene(new Scene(root));
stage.show();
} catch (IOException ex) {
Logger.getLogger(PrescriptionsController.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例10: setupLogController
import javafx.stage.Stage; //导入方法依赖的package包/类
public static void setupLogController() {
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL fxmlUrl = classLoader.getResource("gui/log.fxml");
if (fxmlUrl == null) {
OneClientLogging.logger.error("An error has occurred loading instance_creation.fxml!");
return;
}
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(fxmlUrl);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = fxmlLoader.load(fxmlUrl.openStream());
stage = new Stage();
stage.setTitle("One Client - Log");
stage.getIcons().add(new Image("images/icon.png"));
stage.setResizable(true);
stage.setAlwaysOnTop(false);
stage.initOwner(Main.stage);
stage.initModality(Modality.NONE);
Scene scene = new Scene(root, 600, 300);
scene.getStylesheets().add("gui/css/theme.css");
stage.setScene(scene);
logController = fxmlLoader.getController();
logController.setStage(stage);
TextAreaAppender.setTextArea(logController.logArea);
} catch (Exception e) {
OneClientLogging.error(e);
}
}
示例11: 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;
}
示例12: settingsButton
import javafx.stage.Stage; //导入方法依赖的package包/类
@FXML
private void settingsButton() {
Stage dialog = new Stage();
Scene scene = getScene("settingsDialog.fxml");
dialog.setTitle("Giant Multi Robot Java-Client");
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setScene(scene);
dialog.show();
}
示例13: ProgressBarView
import javafx.stage.Stage; //导入方法依赖的package包/类
/**
* Create instance of {@link ProgressBarView}.
*/
public ProgressBarView() {
try {
final Stage newStage = new Stage();
newStage.setResizable(false);
final URL resource = getClass().getResource(PROGRESS_BAR_VIEW);
fxmlLoader = new FXMLLoader(resource);
final Stage primaryStage = Hygene.getInstance().getPrimaryStage();
newStage.initOwner(primaryStage);
newStage.initStyle(StageStyle.UTILITY);
newStage.initModality(Modality.APPLICATION_MODAL);
final double centerXPosition = primaryStage.getX() + primaryStage.getWidth() / 2;
final double centerYPosition = primaryStage.getY() + primaryStage.getHeight() / 2;
newStage.setOnShowing(event -> newStage.hide());
newStage.setOnShown(event -> {
newStage.setX(centerXPosition - newStage.getWidth() / 2);
newStage.setY(centerYPosition - newStage.getHeight() / 2);
newStage.show();
});
setStage(newStage);
} catch (final UIInitialisationException e) {
LOGGER.error("Progress bar view could not be loaded.", e);
}
}
示例14: show
import javafx.stage.Stage; //导入方法依赖的package包/类
public T show(Window parent) {
Stage stage = getStage();
stage.initModality(Modality.APPLICATION_MODAL);
focusOnFirstControl(stage.getScene().getRoot());
stage.showAndWait();
return getReturnValue();
}
示例15: getStage
import javafx.stage.Stage; //导入方法依赖的package包/类
public static Stage getStage(Window owner) {
Stage stage = new Stage();
ResourceBundle resources = ResourceBundle.getBundle("fxml/i18n/klc");
URL location = ExternalMonitor.class.getResource("/fxml/ExternalMonitor.fxml");
FXMLLoader loader = new FXMLLoader(location, resources);
try {
loader.load();
} catch (IOException e) {
throw new RuntimeException(e);
}
stage.setTitle("Server Monitor");
stage.initModality(Modality.NONE);
stage.initStyle(StageStyle.UTILITY);
stage.initOwner(owner);
stage.setScene(new Scene(loader.getRoot()));
return stage;
}