本文整理匯總了Java中javafx.scene.layout.BorderPane.setCenter方法的典型用法代碼示例。如果您正苦於以下問題:Java BorderPane.setCenter方法的具體用法?Java BorderPane.setCenter怎麽用?Java BorderPane.setCenter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.BorderPane
的用法示例。
在下文中一共展示了BorderPane.setCenter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Exe
import javafx.scene.layout.BorderPane; //導入方法依賴的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();
}
示例2: initUI
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
@PostConstruct
void initUI(BorderPane pane) {
try {
Button EnterButton = new Button();
TextArea textbox = new TextArea();
EnterButton.setText("Send Data");
EnterButton.setOnAction((event) -> {
String tmp = textbox.getText();
Helper.handleButton(tmp);
});
textbox.setMaxWidth(500);
textbox.setMaxHeight(100);
textbox.setWrapText(true);
textbox.setText("Type your sentence here");
pane.setLeft(EnterButton);
pane.setCenter(textbox);
}
catch (Exception e)
{
e.printStackTrace();
}
}
示例3: addTab
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public void addTab(final String name, final String id, final Node content)
{
final Tab tab = TabHelper.createTabWithContextMenu(name, id, "/mineide/img/addIcon.png");
final TabPane tabs = this.tabPanes.get(0);
int index = tabs.getTabs().indexOf(tab);
if (index == -1)
{
final BorderPane borderPane = new BorderPane();
tab.setContent(borderPane);
if (content != null)
borderPane.setCenter(content);
tabs.getTabs().add(tab);
tabs.getSelectionModel().select(tab);
}
else
tabs.getSelectionModel().select(index);
}
示例4: makeErrorGUI
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
/**
* Make a Error Dialog
* @return BorderPane
*/
public void makeErrorGUI() {
root = new Group();
Scene scene = new Scene(root, 360, 185, Color.WHITE);
ImagePattern pattern = new ImagePattern(new Image("icon/bk2.jpg"));
scene.setFill(pattern);
setTitle("Error");
setScene(scene);
Image appIcon = new Image("icon/ERROR.png");
getIcons().add(appIcon);
BorderPane bp = new BorderPane();
textArea = new TextArea(message);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(320);
textArea.setMaxHeight(130);
HBox hBox = new HBox();
hBox.setSpacing(5);
hBox.setPadding(new Insets(5,0,0,0));
hBox.setAlignment(Pos.BOTTOM_RIGHT);
hBox.getChildren().addAll(openLogButton,okButton);
bp.setCenter(textArea);
bp.setBottom(hBox);
root.getChildren().add(bp);
sizeToScene();
setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
}
示例5: TaskSkin
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public TaskSkin(TaskProgressView<T> monitor) {
super(monitor);
BorderPane borderPane = new BorderPane();
borderPane.getStyleClass().add("box");
// list view
ListView<T> listView = new ListView<>();
listView.setPrefSize(500, 400);
listView.setPlaceholder(new Label("No Downloads Currently"));
listView.setCellFactory(param -> new TaskCell());
listView.setFocusTraversable(false);
Bindings.bindContent(listView.getItems(), monitor.getTasks());
borderPane.setCenter(listView);
getChildren().add(listView);
}
示例6: MainMenu
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public MainMenu(Stage primaryStage, UsersModel usersModel){
this.primaryStage = primaryStage;
this.usersModel = usersModel;
BorderPane root = new BorderPane();
VBox buttons = new VBox();
buttons.setId("vbox");
buttons.setAlignment(Pos.CENTER);
buttons.getChildren().addAll(
backgroundImage(),
playGame,
authorGame,
socialCenter);
playGame.setId("main-button");
authorGame.setId("main-button");
socialCenter.setId("main-button");
root.setCenter(buttons);
initHandlers();
scene = new Scene(root, App.WIDTH, App.HEIGHT);
scene.getStylesheets().setAll(CSS_LOCATION);
primaryStage.setScene(scene);
}
示例7: getScene
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
private Scene getScene() {
buildDockPane();
buildMenuBar();
BorderPane layout = new BorderPane();
layout.setTop(menuBar);
layout.setCenter(dockPane);
return new Scene(layout, 800, 450);
}
示例8: createIconContent
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public static Node createIconContent() {
StackPane sp = new StackPane();
BorderPane borderPane = new BorderPane();
Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
rectangle.setStroke(Color.BLACK);
borderPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
Rectangle recTop = new Rectangle(62, 5, Color.web("#349b00"));
recTop.setStroke(Color.BLACK);
Rectangle recBottom = new Rectangle(62, 14, Color.web("#349b00"));
recBottom.setStroke(Color.BLACK);
Rectangle recLeft = new Rectangle(20, 41, Color.TRANSPARENT);
recLeft.setStroke(Color.BLACK);
Rectangle recRight = new Rectangle(20, 41, Color.TRANSPARENT);
recRight.setStroke(Color.BLACK);
Rectangle centerRight = new Rectangle(20, 41, Color.TRANSPARENT);
centerRight.setStroke(Color.BLACK);
borderPane.setRight(recRight);
borderPane.setTop(recTop);
borderPane.setLeft(recLeft);
borderPane.setBottom(recBottom);
borderPane.setCenter(centerRight);
sp.getChildren().addAll(rectangle, borderPane);
return new Group(sp);
}
示例9: getContentPane
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
@Override protected Parent getContentPane() {
BorderPane borderPane = new BorderPane();
FormPane formPane = new FormPane("new-checkList-input-stage", 2);
//@formatter:off
formPane.addFormField("Name", nameField)
.addFormField("Description", descriptionField);
//formatter:on
borderPane.setCenter(formPane);
borderPane.setBottom(buttonBar);
return borderPane;
}
示例10: show
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
private void show() {
BorderPane bp = new BorderPane();
bp.setPadding(new Insets(10,50,50,50));
HBox hb = new HBox();
hb.setPadding(new Insets(20,20,20,30));
//Implementing Nodes for GridPane
Label lblUserName = new Label("Username");
Label lblPassword = new Label("Password");
Label lblLanguage = new Label("Language");
Button btnReset = createButton("Reset", "btnLogin");
Button btnRegister = createButton("Register", "btnReset");
Button btnLogin = createButton("Login", "btnReset");
//Adding GridPane
GridPane gridPane = createGridPane(lblUserName, lblPassword, lblLanguage, btnLogin, btnReset, btnRegister);
gridPane.setId("root");
Text text = createText("Game Login");
text.setId("text");
//Adding text to HBox
hb.getChildren().add(text);
//Add ID's to Nodes
bp.setId("bp");
//Add HBox and GridPane layout to BorderPane Layout
bp.setTop(hb);
bp.setCenter(gridPane);
//Adding BorderPane to the scene and loading CSS
scene = new Scene(bp);
scene.getStylesheets().setAll(CSS_LOCATION);
//Action for btnLogin
btnLogin.setOnAction(e -> buttonLoginAction());
//Action for btnReset
btnReset.setOnAction(e -> buttonResetAction());
//Action for btnRegister
btnRegister.setOnAction(p -> {
tempCheckUser = txtUserName.getText().toString();
tempCheckPw = pf.getText().toString();
if(tempCheckUser.length() < LENGTH_OF_USER || tempCheckPw.length() < LENGTH_OF_PASSWORD ){
MessageShowing unsuccess = new MessageShowing();
unsuccess.show("failure");
tempCheckUser="";
tempCheckPw = "";
buttonResetAction();
return;
}
usersModel.addUser(tempCheckUser, tempCheckPw);
writer.write(tempCheckUser, tempCheckPw);
((PopUpMessage) p).show("success");
buttonResetAction();});
scene.setOnKeyPressed(e -> handleKeyInput(e.getCode()));
}
示例11: openStage
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
/**
* Opens browser up in new stage
*
* @param myPage
*/
private void openStage (WebView myPage) {
Stage stage = new Stage();
BorderPane pane = new BorderPane();
pane.setCenter(myPage);
stage.setScene(new Scene(pane, BROWSER_SIZE, BROWSER_SIZE));
stage.show();
}
示例12: TaskCell
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public TaskCell() {
titleText = new Label();
titleText.getStyleClass().add("task-title");
messageText = new Label();
messageText.getStyleClass().add("task-message");
progressBar = new ProgressBar();
progressBar.setMaxWidth(Double.MAX_VALUE);
progressBar.setMaxHeight(8);
progressBar.getStyleClass().add("task-progress-bar");
cancelButton = new Button("Cancel");
cancelButton.getStyleClass().add("task-cancel-button");
cancelButton.setTooltip(new Tooltip("Cancel Task"));
cancelButton.setOnAction(evt -> {
if (task != null) {
task.cancel(true);
}
});
VBox vbox = new VBox();
vbox.setSpacing(4);
vbox.getChildren().add(titleText);
vbox.getChildren().add(progressBar);
vbox.getChildren().add(messageText);
BorderPane.setAlignment(cancelButton, Pos.CENTER);
BorderPane.setMargin(cancelButton, new Insets(0, 0, 0, 4));
borderPane = new BorderPane();
borderPane.setCenter(vbox);
borderPane.setRight(cancelButton);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}
示例13: init
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
@Override
public void init (Stage s) {
myStage = s;
myLayout = new BorderPane();
myLayout.setCenter(createContents());
myLayout.setTop(createMenuBar());
Scene scene = new Scene(myLayout, WIDTH, HEIGHT);
scene.getStylesheets().add(DEFAULT_RESOURCE_PACKAGE + STYLESHEET);
s.setScene(scene);
initListeners(s);
rescale(s.getWidth(), s.getHeight());
}
示例14: AgendaEntryCell
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
/**
* Constructs a new cell that will work with the given agenda view.
*
* @param view the parent list view
* @param headerPaneVisible flag to control the visibility of the cell's header.
*/
public AgendaEntryCell(AgendaView view, boolean headerPaneVisible) {
this.agendaView = Objects.requireNonNull(view);
this.headerPaneVisible = headerPaneVisible;
BorderPane borderPane = new BorderPane();
borderPane.getStyleClass().add("container");
borderPane.setTop(createHeader());
borderPane.setCenter(createBody());
setGraphic(borderPane);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
getStyleClass().add(AGENDA_VIEW_LIST_CELL);
}
示例15: TabSample
import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
public TabSample() {
BorderPane borderPane = new BorderPane();
final TabPane tabPane = new TabPane();
tabPane.setPrefSize(400, 400);
tabPane.setSide(Side.TOP);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
final Tab tab1 = new Tab();
tab1.setText("Tab 1");
final Tab tab2 = new Tab();
tab2.setText("Tab 2");
final Tab tab3 = new Tab();
tab3.setText("Tab 3");
final Tab tab4 = new Tab();
tab4.setText("Tab 4");
tabPane.getTabs().addAll(tab1, tab2, tab3, tab4);
borderPane.setCenter(tabPane);
getChildren().add(borderPane);
}