本文整理匯總了Java中javafx.stage.Screen類的典型用法代碼示例。如果您正苦於以下問題:Java Screen類的具體用法?Java Screen怎麽用?Java Screen使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Screen類屬於javafx.stage包,在下文中一共展示了Screen類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import javafx.stage.Screen; //導入依賴的package包/類
@Override
public void start(Stage stage) {
this.stage = stage;
stage.initStyle(StageStyle.TRANSPARENT);
VBox box = new VBox(20);
box.setMaxWidth(Region.USE_PREF_SIZE);
box.setMaxHeight(Region.USE_PREF_SIZE);
box.setBackground(Background.EMPTY);
String style = "-fx-background-color: rgba(255, 255, 255, 0.5);";
box.setStyle(style);
box.setPadding(new Insets(50));
BorderPane root = new BorderPane(box);
root.setStyle(style);
root.setBackground(Background.EMPTY);
Scene scene = new Scene(root);
scene.setFill(Color.TRANSPARENT);
stage.setScene(scene);
ImageView splashView = new ImageView(splashImage);
box.getChildren().addAll(splashView, new Label("ST Verification Studio is loading.."));
stage.show();
Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds();
stage.setX((primScreenBounds.getWidth() - stage.getWidth()) / 2);
stage.setY((primScreenBounds.getHeight() - stage.getHeight()) / 2);
}
示例2: start
import javafx.stage.Screen; //導入依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("menuSample.fxml"));
primaryStage.setTitle("Hello World");
Screen screen = Screen.getPrimary();
Rectangle2D bounds = screen.getVisualBounds();
primaryStage.setX(bounds.getMinX());
primaryStage.setY(bounds.getMinY());
primaryStage.setWidth(bounds.getWidth());
primaryStage.setHeight(bounds.getHeight());
primaryStage.setMaximized(true);
Scene menuScene = new Scene(root, 1080, 720);
//primaryStage.setFullScreen(true);
primaryStage.setScene(menuScene);
//primaryStage.setFullScreen(true);
primaryStage.show();
}
示例3: Exe
import javafx.stage.Screen; //導入依賴的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: start
import javafx.stage.Screen; //導入依賴的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();
}
示例5: showSplash
import javafx.stage.Screen; //導入依賴的package包/類
private void showSplash(final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler) {
progressText.textProperty().bind(task.messageProperty());
loadProgress.progressProperty().bind(task.progressProperty());
task.stateProperty().addListener((observableValue, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
loadProgress.progressProperty().unbind();
loadProgress.setProgress(1);
initStage.toFront();
FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout);
fadeSplash.setFromValue(1.0);
fadeSplash.setToValue(0.0);
fadeSplash.setOnFinished(actionEvent -> initStage.hide());
fadeSplash.play();
initCompletionHandler.complete();
}
});
Scene splashScene = new Scene(splashLayout);
initStage.initStyle(StageStyle.UNDECORATED);
final Rectangle2D bounds = Screen.getPrimary().getBounds();
initStage.setScene(splashScene);
initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2);
initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2);
initStage.show();
}
示例6: showAppointments
import javafx.stage.Screen; //導入依賴的package包/類
@FXML private void showAppointments()
{
Stage stage= new Stage();
AllAppointmentsController app = new AllAppointmentsController(receptionist);
app.load();
Scene scene = new Scene(app);
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();
}
示例7: showAppointmentSuccessIndicator
import javafx.stage.Screen; //導入依賴的package包/類
@FXML
public void showAppointmentSuccessIndicator(String patientId, String consult, String appDate, String appId)
{
Stage stage= new Stage();
AppointmentSuccessController success = new AppointmentSuccessController();
success.fillAppointmentData(patientId,consult,appDate,appId);
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();
}
示例8: showPatientAccountSuccessIndicator
import javafx.stage.Screen; //導入依賴的package包/類
@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();
}
示例9: showSuccessIndicator
import javafx.stage.Screen; //導入依賴的package包/類
@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();
}
示例10: loadDoctor
import javafx.stage.Screen; //導入依賴的package包/類
public void loadDoctor(String username)
{
Stage stage = new Stage();
DoctorController doctor = new DoctorController(username);
doctor.fillAreaChart();
doctor.setAppointments();
doctor.loadProfileData();
doctor.MakeAvailabilityTable();
doctor.loadDrugList();
doctor.loadTestList();
doctor.setPaceholders();
doctor.addFocusListener();
doctor.loadNameList();
stage.setScene(new Scene(doctor));
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();
}
示例11: loadCashier
import javafx.stage.Screen; //導入依賴的package包/類
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();
}
示例12: loadLabAssistant
import javafx.stage.Screen; //導入依賴的package包/類
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();
}
示例13: InferenceRuleView
import javafx.stage.Screen; //導入依賴的package包/類
/**
* Adds the content for showing the inference rules to the TabPane in the proof
* @param tabPane
*
*/
public InferenceRuleView(TabPane tabPane) {
//load the image
Image image = new Image("inferenceRules.png");
ImageView iv1 = new ImageView();
iv1.setImage(image);
iv1.setSmooth(true);
iv1.setPreserveRatio(true);
//putting the image on a scrollpane
ScrollPane sp=new ScrollPane();
sp.getStyleClass().add("rulesView");
tab = new ViewTab("Inference Rules",this);
sp.setContent(iv1);
tabPane.getTabs().add(tab);
tab.setContent(sp);
tabPane.getSelectionModel().select(tab);
//used for getting screensize
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//Avoids scaling too much
double w=primaryScreenBounds.getWidth()/2;
iv1.setFitWidth(w);
}
示例14: ShortcutsView
import javafx.stage.Screen; //導入依賴的package包/類
/**
* Adds the content for showing the shortcuts to the TabPane in the proof
* @param tabPane
*
*/
public ShortcutsView(TabPane tabPane) {
Label label = new Label(loadInstructions());
label.getStyleClass().add("infoText");
//putting the image on a scrollpane
ScrollPane sp = new ScrollPane();
sp.getStyleClass().add("shortcutsView");
tab = new ViewTab("Shortcuts",this);
sp.setContent(label);
tabPane.getTabs().add(tab);
tab.setContent(sp);
tabPane.getSelectionModel().select(tab);
//used for getting screensize
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//Avoids scaling too much
double w=primaryScreenBounds.getWidth();
label.setPrefWidth(w);
}
示例15: ParseInfoView
import javafx.stage.Screen; //導入依賴的package包/類
/**
* Adds the content for showing the parser info to the TabPane
* @param tabPane
*
*/
public ParseInfoView(TabPane tabPane) {
Label label = new Label(loadInstructions());
label.getStyleClass().add("infoText");
//putting the image on a scrollpane
ScrollPane sp = new ScrollPane();
sp.getStyleClass().add("rulesView");
tab = new ViewTab("Input format",this);
sp.setContent(label);
tabPane.getTabs().add(tab);
tab.setContent(sp);
tabPane.getSelectionModel().select(tab);
//used for getting screensize
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
//Avoids scaling too much
double w=primaryScreenBounds.getWidth();
label.setPrefWidth(w);
}