本文整理汇总了Java中javafx.scene.layout.AnchorPane.getPrefWidth方法的典型用法代码示例。如果您正苦于以下问题:Java AnchorPane.getPrefWidth方法的具体用法?Java AnchorPane.getPrefWidth怎么用?Java AnchorPane.getPrefWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.layout.AnchorPane
的用法示例。
在下文中一共展示了AnchorPane.getPrefWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.scene.layout.AnchorPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
try {
final SplashScreen splash = SplashScreen.getSplashScreen();
// Determine if we passed anything on the cmd line
parseCmdLine();
// Define our controllers
SpeedGuideViewController viewController = loadFXMLController("view/SpeedGuideView.fxml");
SpeedGuideConnection connectionController = loadFXMLController("view/ConnectionDialog.fxml");
// Wire up our Model/View/Controllers
viewController.setConnectionViewController(connectionController);
viewController.setDebug(m_debug);
viewController.defineControlBindings(m_consumer);
// Notify our consumer some setup information
m_consumer.setDebug(m_debug);
m_consumer.setViewController(viewController);
// Define the main viewing scene,
AnchorPane layout = viewController.getLayout();
Scene scene = new Scene(layout, layout.getPrefWidth(), layout.getPrefHeight());
// Prevent the user from resizing the window too small
primaryStage.setMinHeight(layout.getMinHeight());
primaryStage.setMinWidth(layout.getMinWidth());
// Assign to our main stage and show the application to the end user
primaryStage.setTitle("Speed Guide");
primaryStage.setScene(scene);
primaryStage.show();
// Set up our EMA Consumer and launch a thread to run...
Thread t = new Thread(m_consumer);
t.start();
Application.Parameters params = getParameters();
connectionController.initialize(params.getNamed().get(HOST_PARAM),
params.getNamed().get(SERVICE_PARAM),
params.getNamed().get(USER_PARAM),
m_consumer);
// Attempt to Connect into Elektron
if ( splash != null )
splash.close();
connectionController.connect();
} catch (Exception e) {
System.out.print("Exception in Application Start: ");
e.printStackTrace();
stop();
}
}
示例2: CustomStage
import javafx.scene.layout.AnchorPane; //导入方法依赖的package包/类
public CustomStage(AnchorPane ap, StageStyle style) {
initStyle(style);
setSize(ap.getPrefWidth(), ap.getPrefHeight());
Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds();
double x = screenBounds.getMinX() + screenBounds.getWidth() - ap.getPrefWidth() - 2;
double y = screenBounds.getMinY() + screenBounds.getHeight() - ap.getPrefHeight() - 2;
bottomRight = Location.at(x, y);
}