當前位置: 首頁>>代碼示例>>Java>>正文


Java Pane.setPrefWidth方法代碼示例

本文整理匯總了Java中javafx.scene.layout.Pane.setPrefWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java Pane.setPrefWidth方法的具體用法?Java Pane.setPrefWidth怎麽用?Java Pane.setPrefWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.layout.Pane的用法示例。


在下文中一共展示了Pane.setPrefWidth方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: NotifyTab

import javafx.scene.layout.Pane; //導入方法依賴的package包/類
public NotifyTab()
{
    super();
    super.setText("Notification");
    super.setClosable(false);
    
    pane = new Pane();
    box = new VBox();        
    header = new Label();
    desc = new Label();
    
    okButton = new Button("Ok");
    okButton.setPrefWidth(50);
    okButton.setOnMouseClicked(new OkButtonHandler());
    
    box.getChildren().addAll(header, desc, okButton);
    box.setPadding(new Insets(15, 15, 15, 15));
    box.setSpacing(15);
    
    pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    pane.getChildren().add(box);
    
    super.setContent(pane);
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:26,代碼來源:NotifyTab.java

示例2: start

import javafx.scene.layout.Pane; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
    if (primaryStage == null) {
        return;
    }

    /* Layers */
    Group backgroundLayer = new Group();
    Group statesLayer = new Group();
    Group selectionLayer = new Group();

    Pane paintingPane = new Pane(backgroundLayer, statesLayer, selectionLayer);
    paintingPane.setStyle(BACKGROUND_STYLE);

    /* Top-level */
    Pane contentPane = new Pane(paintingPane);
    contentPane.minWidthProperty().bind(contentPane.prefWidthProperty());
    contentPane.maxWidthProperty().bind(contentPane.prefWidthProperty());

    ScrollPane scrollPane = new ScrollPane(contentPane);
    scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    scrollPane.setHbarPolicy(ScrollBarPolicy.ALWAYS);
    scrollPane.setFitToHeight(true);
    scrollPane.setFitToWidth(true);
    scrollPane.setPannable(true);

    BorderPane borderPane = new BorderPane(scrollPane);

    primaryStage.setScene(new Scene(borderPane));
    primaryStage.show();
    primaryStage.setHeight(500);
    primaryStage.setWidth(500);

    contentPane.setPrefHeight(200);
    contentPane.setPrefWidth(PANE_WIDTH);

    /* Bind painting pane's height to the content pane */
    paintingPane.minHeightProperty().bind(contentPane.minHeightProperty());
    paintingPane.prefHeightProperty().bind(contentPane.prefHeightProperty());
    paintingPane.maxHeightProperty().bind(contentPane.maxHeightProperty());

    /* We set painting's pane width programmatically */
    paintingPane.minWidthProperty().bind(paintingPane.prefWidthProperty());
    paintingPane.maxWidthProperty().bind(paintingPane.prefWidthProperty());

    paintingPane.setPrefWidth(2000);
    double x = PANE_WIDTH - 2000;
    System.out.println(x);
    paintingPane.relocate(x, 0);

    drawBackground(backgroundLayer, paintingPane);
    drawRectangles(statesLayer);
    drawSelection(selectionLayer, paintingPane);
}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:55,代碼來源:UiModelApp2.java

示例3: start

import javafx.scene.layout.Pane; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
    if (primaryStage == null) {
        return;
    }

    /* Layers */
    Group backgroundLayer = new Group();
    Group statesLayer = new Group();
    Group selectionLayer = new Group();

    /* Top-level */
    Pane contentPane = new Pane(backgroundLayer, statesLayer, selectionLayer);
    contentPane.minWidthProperty().bind(contentPane.prefWidthProperty());
    contentPane.maxWidthProperty().bind(contentPane.prefWidthProperty());
    contentPane.setStyle(BACKGROUND_STYLE);

    ScrollPane scrollPane = new ScrollPane(contentPane);
    scrollPane.setVbarPolicy(ScrollBarPolicy.ALWAYS);
    scrollPane.setHbarPolicy(ScrollBarPolicy.ALWAYS);
    scrollPane.setFitToHeight(true);
    scrollPane.setFitToWidth(true);
    scrollPane.setPannable(true);

    BorderPane borderPane = new BorderPane(scrollPane);

    primaryStage.setScene(new Scene(borderPane));
    primaryStage.show();
    primaryStage.setHeight(500);
    primaryStage.setWidth(500);

    contentPane.setPrefHeight(200);
    contentPane.setPrefWidth(PANE_WIDTH);

    drawBackground(backgroundLayer, contentPane);
    drawRectangles(statesLayer);
    drawSelection(selectionLayer, contentPane);
}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:39,代碼來源:UiModelApp.java

示例4: PromptTab

import javafx.scene.layout.Pane; //導入方法依賴的package包/類
public PromptTab()
{
    super();
    super.setText("Confirmation Required");
    super.setClosable(false);
    
    pane = new Pane();
    contentBox = new VBox(); 
    buttonBox = new HBox();
    header = new Label();
    desc = new Label();
    
    yesButton = new Button("Yes");
    yesButton.setPrefWidth(50);
    
    noButton = new Button("No");
    noButton.setPrefWidth(50);
    
    buttonBox.getChildren().addAll(yesButton, noButton);
    buttonBox.setSpacing(10);
    
    contentBox.getChildren().addAll(header, desc, buttonBox);
    contentBox.setPadding(new Insets(15, 15, 15, 15));
    contentBox.setSpacing(15);
    
    pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    pane.getChildren().add(contentBox);
    
    super.setContent(pane);
}
 
開發者ID:BlueGoliath,項目名稱:Goliath-Overclocking-Utility-FX,代碼行數:32,代碼來源:PromptTab.java

示例5: trocarCena

import javafx.scene.layout.Pane; //導入方法依賴的package包/類
public static void trocarCena(Pane novaCena) throws IOException {
	novaCena.setPrefHeight(560);
	novaCena.setPrefWidth(600);
	pane.setCenter(novaCena);
	pane.setCenterShape(false);
	menu.setScene(new Scene(pane));
	menu.setResizable(false);		 
}
 
開發者ID:omniplatypus,項目名稱:Projeto-IP2,代碼行數:9,代碼來源:SubmenuProfessor.java

示例6: trocarCena

import javafx.scene.layout.Pane; //導入方法依賴的package包/類
public static void trocarCena(Pane novaCena) throws IOException {
	
	novaCena.setPrefHeight(560);
	novaCena.setPrefWidth(600);
	pane.setCenter(novaCena);
	pane.setCenterShape(false);
	menu.setScene(new Scene(pane));
	menu.setResizable(false);		 
}
 
開發者ID:omniplatypus,項目名稱:Projeto-IP2,代碼行數:10,代碼來源:Menu.java

示例7: setSize

import javafx.scene.layout.Pane; //導入方法依賴的package包/類
private void setSize (Pane pane, double size) {
    pane.setMinWidth(size);
    pane.setMaxWidth(size);
    pane.setPrefWidth(size);
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:6,代碼來源:SubConditionView.java


注:本文中的javafx.scene.layout.Pane.setPrefWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。