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


Java HPos類代碼示例

本文整理匯總了Java中javafx.geometry.HPos的典型用法代碼示例。如果您正苦於以下問題:Java HPos類的具體用法?Java HPos怎麽用?Java HPos使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: WebViewPane

import javafx.geometry.HPos; //導入依賴的package包/類
public WebViewPane() {
    VBox.setVgrow(this, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);

    WebView view = new WebView();
    view.setMinSize(500, 400);
    view.setPrefSize(500, 400);
    final WebEngine eng = view.getEngine();
    eng.load("http://www.oracle.com/us/index.html");
    final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
    locationField.setMaxHeight(Double.MAX_VALUE);
    Button goButton = new Button("Go");
    goButton.setDefaultButton(true);
    EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent event) {
            eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
                    "http://" + locationField.getText());
        }
    };
    goButton.setOnAction(goAction);
    locationField.setOnAction(goAction);
    eng.locationProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            locationField.setText(newValue);
        }
    });
    GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(5);
    GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
    GridPane.setConstraints(goButton,1,0);
    GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
    grid.getColumnConstraints().addAll(
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
            new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
    );
    grid.getChildren().addAll(locationField, goButton, view);
    getChildren().add(grid);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:41,代碼來源:WebViewBrowser.java

示例2: layoutChildren

import javafx.geometry.HPos; //導入依賴的package包/類
@Override protected void layoutChildren() {
    if (isFixedSize) {
        super.layoutChildren();
    } else {
        List<Node> managed = getManagedChildren();
        double width = getWidth();
        ///System.out.println("width = " + width);
        double height = getHeight();
        ///System.out.println("height = " + height);
        double top = getInsets().getTop();
        double right = getInsets().getRight();
        double left = getInsets().getLeft();
        double bottom = getInsets().getBottom();
        for (int i = 0; i < managed.size(); i++) {
            Node child = managed.get(i);
            layoutInArea(child, left, top,
                           width - left - right, height - top - bottom,
                           0, Insets.EMPTY, true, true, HPos.CENTER, VPos.CENTER);
        }
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:22,代碼來源:Sample.java

示例3: addBoolean

import javafx.geometry.HPos; //導入依賴的package包/類
/**
 * Add a yes/no choice to a wizard step.
 *
 * @param fieldName
 * @param defaultValue
 *            of the choice.
 * @param prompt
 *            the tooltip to show
 * @return
 */
@SuppressWarnings("unchecked")
public WizardStepBuilder addBoolean(final String fieldName, final boolean defaultValue, final String prompt)
{
    final JFXCheckBox box = new JFXCheckBox();
    box.setTooltip(new Tooltip(prompt));
    box.setSelected(defaultValue);

    this.current.getData().put(fieldName, new SimpleBooleanProperty());
    this.current.getData().get(fieldName).bind(box.selectedProperty());

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(box, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);
    this.current.add(box, 1, this.current.getData().size() - 1);
    return this;
}
 
開發者ID:Leviathan-Studio,項目名稱:MineIDE,代碼行數:28,代碼來源:WizardStepBuilder.java

示例4: addEnum

import javafx.geometry.HPos; //導入依賴的package包/類
/**
 * Add an enumeration of options to a wizard step.
 *
 * @param fieldName
 * @param defaultValue
 *            is the index of the value in your options array. Can be set <
 *            0 to empty the combobox as default.
 * @param prompt
 *            the tooltip to show
 * @param options
 *            your array of options, use a {@link IconLabel} object to add
 *            icons to your options. Only the text will be selected.
 * @return
 */
@SuppressWarnings("unchecked")
public WizardStepBuilder addEnum(final String fieldName, final int defaultValue, final String prompt,
        final IconLabel... options)
{
    final JFXComboBox<IconLabel> jfxCombo = new JFXComboBox<>();

    jfxCombo.getItems().addAll(options);
    jfxCombo.setPromptText(prompt);

    if (defaultValue < 0)
        jfxCombo.setValue(new IconLabel(null, ""));
    else
        jfxCombo.setValue(options[defaultValue]);

    this.current.getData().put(fieldName, new SimpleObjectProperty<IconLabel>());
    this.current.getData().get(fieldName).bind(jfxCombo.valueProperty());

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(jfxCombo, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);
    this.current.add(jfxCombo, 1, this.current.getData().size() - 1);
    return this;
}
 
開發者ID:Leviathan-Studio,項目名稱:MineIDE,代碼行數:39,代碼來源:WizardStepBuilder.java

示例5: addBigString

import javafx.geometry.HPos; //導入依賴的package包/類
/**
 * Add a large String to a wizard step. A TextArea will be used to represent
 * it.
 *
 * @param fieldName
 * @param defaultValue
 *            the default String the textfield will contains.
 * @param prompt
 *            the text to show on the textfield prompt String.
 * @return
 */
@SuppressWarnings("unchecked")
public WizardStepBuilder addBigString(final String fieldName, final String defaultValue, final String prompt)
{
    final JFXTextArea text = new JFXTextArea();
    text.setPromptText(prompt);
    text.setText(defaultValue);
    this.current.getData().put(fieldName, new SimpleStringProperty());
    this.current.getData().get(fieldName).bind(text.textProperty());
    text.setMaxWidth(400);

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(text, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);
    this.current.add(text, 1, this.current.getData().size() - 1);
    return this;
}
 
開發者ID:Leviathan-Studio,項目名稱:MineIDE,代碼行數:29,代碼來源:WizardStepBuilder.java

示例6: addFileChoosers

import javafx.geometry.HPos; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public WizardStepBuilder addFileChoosers(final String fieldName, final String fileChooseLabel,
        final String startDir, final FileChooser.ExtensionFilter... filters)
{
    final WizardStep current = this.current;
    final HBox box = new HBox();
    final JFXButton button = new JFXButton(fileChooseLabel);
    button.setStyle("-fx-text-fill: BLACK;-fx-font-size: 18px;-fx-opacity: 0.7;");
    final FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle(fileChooseLabel);
    fileChooser.setInitialDirectory(new File(startDir));
    fileChooser.getExtensionFilters().addAll(filters);
    this.current.getData().put(fieldName, new SimpleSetProperty<File>());

    button.setOnAction(e -> current.getData().get(fieldName)
            .setValue(fileChooser.showOpenMultipleDialog(MineIDE.primaryStage)));

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(button, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);

    final JFXTextField text = new JFXTextField();
    text.setEditable(false);
    ((SimpleSetProperty<File>) this.current.getData().get(fieldName))
            .addListener((SetChangeListener<File>) change ->
            {
                text.setText("");
                change.getSet().forEach(file -> text.appendText(file.getAbsolutePath() + ", "));
                text.setText(text.getText().substring(0, text.getText().length() - 2));
            });

    box.getChildren().addAll(text, button);
    this.current.add(box, 1, this.current.getData().size() - 1);
    return this;
}
 
開發者ID:Leviathan-Studio,項目名稱:MineIDE,代碼行數:37,代碼來源:WizardStepBuilder.java

示例7: serverConfigurationPane

import javafx.geometry.HPos; //導入依賴的package包/類
private GridPane serverConfigurationPane( ) {
    final GridPane grid = new GridPane( );
    grid.setAlignment( Pos.CENTER );
    grid.setPadding( new Insets( 10 ) );
    grid.setHgap( 10 );
    grid.setVgap( 20 );

    serverUrlLine( grid );
    credentialsLine( grid );
    apiVersionLine( grid );
    proxyConfigurationLine( grid );

    final ColumnConstraints noConstraint = new ColumnConstraints( );
    final ColumnConstraints rightAlignementConstraint = new ColumnConstraints( );
    rightAlignementConstraint.setHalignment( HPos.RIGHT );
    grid.getColumnConstraints( ).add( rightAlignementConstraint );
    grid.getColumnConstraints( ).add( noConstraint );
    grid.getColumnConstraints( ).add( rightAlignementConstraint );
    grid.getColumnConstraints( ).add( noConstraint );

    grid.setStyle( "-fx-border-color:white; -fx-border-radius:5;" );

    return grid;
}
 
開發者ID:u2032,項目名稱:wall-t,代碼行數:25,代碼來源:ConfigurationView.java

示例8: preferenceConfigurationPane

import javafx.geometry.HPos; //導入依賴的package包/類
private GridPane preferenceConfigurationPane( ) {
    final GridPane grid = new GridPane( );
    grid.setAlignment( Pos.CENTER );
    grid.setPadding( new Insets( 10 ) );
    grid.setHgap( 10 );
    grid.setVgap( 20 );

    lightModeCheckBox( grid );
    nbTilesByColumnComboBox( grid );
    nbTilesByRowComboBox( grid );

    final ColumnConstraints noConstraint = new ColumnConstraints( );
    final ColumnConstraints rightAlignementConstraint = new ColumnConstraints( );
    rightAlignementConstraint.setHalignment( HPos.RIGHT );
    grid.getColumnConstraints( ).add( rightAlignementConstraint );
    grid.getColumnConstraints( ).add( noConstraint );
    grid.getColumnConstraints( ).add( rightAlignementConstraint );
    grid.getColumnConstraints( ).add( noConstraint );

    grid.setStyle( "-fx-border-color:white; -fx-border-radius:5;" );

    return grid;
}
 
開發者ID:u2032,項目名稱:wall-t,代碼行數:24,代碼來源:ConfigurationView.java

示例9: add_row

import javafx.geometry.HPos; //導入依賴的package包/類
/**
 * Create a row with text and radio buttons
 * @param name of the row
 * @param i iterator
 */
private void add_row(String name, int i){
    Text text = new Text(name);
    text.setStyle("-fx-font-weight: bold;" +
            "-fx-font-size: 17px");
    text.setFill(Color.WHITESMOKE);
    gridPane.add(text, 0, i+1);

    RadioButton readButton = new RadioButton();
    GridPane.setHalignment(readButton, HPos.CENTER);
    gridPane.add(readButton, 1,i+1);

    RadioButton editButton = new RadioButton();
    GridPane.setHalignment(editButton, HPos.CENTER);
    gridPane.add(editButton, 2, i+1);

    editButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            readButton.setSelected(true);
        }
    });

    radioButtonArrayList.add(readButton);
    radioButtonArrayList.add(editButton);
}
 
開發者ID:Moccko,項目名稱:campingsimulator2017,代碼行數:31,代碼來源:PermissionsDialog.java

示例10: createHeaderPane

import javafx.geometry.HPos; //導入依賴的package包/類
public Node createHeaderPane(WeekView calView) {
    final GridPane container = new GridPane();
    container.setAlignment(Pos.BOTTOM_LEFT);
    container.getStyleClass().add("headerpane");

    final Label lblWeekday = new Label(calView.getDate().get().format(DateTimeFormatter.ofPattern("EEE")));
    lblWeekday.getStyleClass().add("label-weekday");

    final Label lblDate = new Label(calView.getDate().get().toString());
    lblDate.getStyleClass().add("label-date");
    final ContextMenu dayChooserMenu = new ContextMenu();
    final CustomMenuItem item = new CustomMenuItem(new DayChooser(calView.getDate()));
    dayChooserMenu.getStyleClass().add("day-chooser");
    item.setHideOnClick(false);
    dayChooserMenu.getItems().add(item);
    lblDate.setOnMouseClicked(event ->
            dayChooserMenu.show(lblDate,
                    lblDate.localToScreen(0, 0).getX(),
                    lblDate.localToScreen(0, 0).getY())
    );

    final Button left = new Button("<");
    left.getStyleClass().add("header-button");
    left.setOnAction(event -> calView.getDate().set(calView.getDate().get().minusDays(1)));
    final Button right = new Button(">");
    right.getStyleClass().add("header-button");
    right.setOnAction(event -> calView.getDate().set(calView.getDate().get().plusDays(1)));

    final ColumnConstraints columnWeekday = new ColumnConstraints(70);
    final ColumnConstraints columnCenter = new ColumnConstraints(20,50,Double.POSITIVE_INFINITY, Priority.ALWAYS, HPos.LEFT,true);
    final ColumnConstraints columnSwitcher = new ColumnConstraints(60);
    container.getColumnConstraints().addAll(columnWeekday, columnCenter, columnSwitcher);
    container.add(lblWeekday,0,0);
    container.add(lblDate, 1,0);
    container.add(new HBox(left, right), 2,0);
    return container;
}
 
開發者ID:Jibbow,項目名稱:FastisFX,代碼行數:38,代碼來源:WeekViewRenderer.java

示例11: content

import javafx.geometry.HPos; //導入依賴的package包/類
protected GridPane content() {
	gridP.setHgap(8);
	gridP.setVgap(6);
	gridP.setPadding(new Insets(10, 20, 12, 20));
	gridP.add(header, 0, 0, 2, 1);
	gridP.add(useProxyL, 0, 1);
	gridP.add(useProxy, 1, 1);
	gridP.add(hostL, 0, 2);
	gridP.add(host, 1, 2, 2, 1);
	gridP.add(portL, 0, 3);
	gridP.add(port, 1, 3, 2, 1);
	GridPane.setHalignment(okBtn, HPos.RIGHT);
	GridPane.setHalignment(cancelBtn, HPos.RIGHT);
	okBtn.setPrefWidth(80);
	cancelBtn.setPrefWidth(80);
	gridP.add(okBtn, 1, 4);
	gridP.add(cancelBtn, 2, 4);

	return gridP;
}
 
開發者ID:teamOtee,項目名稱:x-facteur,代碼行數:21,代碼來源:ProxyModal.java

示例12: content

import javafx.geometry.HPos; //導入依賴的package包/類
protected GridPane content() {
	gridP.setHgap(8);
	gridP.setVgap(6);
	gridP.setPadding(new Insets(10, 20, 12, 20));
	gridP.add(header, 0, 0, 2, 1);
	gridP.add(mailmanNameL, 0, 2);
	gridP.add(mailmanName, 1, 2, 2, 1);
	gridP.add(mailmanLastNameL, 0, 1);
	gridP.add(mailmanLastName, 1, 1, 2, 1);
	gridP.add(driverL, 0, 3);
	gridP.add(driver, 1, 3);
	GridPane.setHalignment(okBtn, HPos.RIGHT);
	GridPane.setHalignment(cancelBtn, HPos.RIGHT);
	okBtn.setPrefWidth(80);
	cancelBtn.setPrefWidth(80);
	gridP.add(okBtn, 1, 4);
	gridP.add(cancelBtn, 2, 4);

	return gridP;
}
 
開發者ID:teamOtee,項目名稱:x-facteur,代碼行數:21,代碼來源:MailmanEditModal.java

示例13: content

import javafx.geometry.HPos; //導入依賴的package包/類
protected GridPane content() {
	gridP.setHgap(8);
	gridP.setVgap(6);
	gridP.setPadding(new Insets(10, 20, 12, 20));
	gridP.add(header, 0, 0, 2, 1);
	gridP.add(addressStreetL, 0, 1);
	gridP.add(addressStreet, 1, 1, 2, 1);
	gridP.add(addressCityL, 0, 2);
	gridP.add(addressCity, 1, 2, 2, 1);
	gridP.add(drivenL, 0, 3);
	gridP.add(driven, 1, 3);
	GridPane.setHalignment(okBtn, HPos.RIGHT);
	GridPane.setHalignment(cancelBtn, HPos.RIGHT);
	okBtn.setPrefWidth(80);
	cancelBtn.setPrefWidth(80);
	gridP.add(okBtn, 1, 4);
	gridP.add(cancelBtn, 2, 4);

	return gridP;
}
 
開發者ID:teamOtee,項目名稱:x-facteur,代碼行數:21,代碼來源:ShipmentEditModal.java

示例14: createBody

import javafx.geometry.HPos; //導入依賴的package包/類
/**
 * Creates the node used for the body part of each cell.
 *
 * In this default implementation the body consists of a grid pane with
 * three columns. The middle column is used for showing the title of
 * calendar entries. This column will get whatever space is left after
 * the icon and the time column have used what they need. This means
 * that a very long title will automatically be truncated.
 *
 * @return the body node
 */
protected Node createBody() {
    // icon column
    ColumnConstraints iconColumn = new ColumnConstraints();

    // title column
    ColumnConstraints descriptionColumn = new ColumnConstraints();
    descriptionColumn.setFillWidth(true);
    descriptionColumn.setHgrow(Priority.SOMETIMES);
    descriptionColumn.setMinWidth(0);
    descriptionColumn.setPrefWidth(0);

    // time column
    ColumnConstraints timeColumn = new ColumnConstraints();
    timeColumn.setHalignment(HPos.RIGHT);

    gridPane = new GridPane();
    gridPane.setGridLinesVisible(true);
    gridPane.setMinWidth(0);
    gridPane.setPrefWidth(0);
    gridPane.getStyleClass().add(AGENDA_VIEW_BODY);
    gridPane.getColumnConstraints().addAll(iconColumn, descriptionColumn, timeColumn);

    return gridPane;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:36,代碼來源:AgendaView.java

示例15: setupView

import javafx.geometry.HPos; //導入依賴的package包/類
private void setupView() {
    ImageView weatherIcon = new ImageView();
    weatherIcon.setImage(weatherEvent.getForecast().getWeather().getIcon());
    weatherIcon.fitWidthProperty().bind(stage.widthProperty().divide(3));
    weatherIcon.fitHeightProperty().bind(stage.heightProperty().multiply(1));
    GridPane.setHgrow(weatherIcon, Priority.ALWAYS);
    GridPane.setVgrow(weatherIcon, Priority.ALWAYS);
    GridPane.setHalignment(weatherIcon, HPos.CENTER);
    GridPane.setValignment(weatherIcon, VPos.CENTER);
    add(weatherIcon, 0, 0);

    Text txt_weather_event = new Text();
    txt_weather_event.setText(controller.getWeatherEventText());
    GridPane.setHgrow(txt_weather_event, Priority.ALWAYS);
    GridPane.setVgrow(txt_weather_event, Priority.ALWAYS);
    GridPane.setValignment(txt_weather_event, VPos.CENTER);
    add(txt_weather_event, 1, 0);
}
 
開發者ID:ykarim,項目名稱:WeatherWatch,代碼行數:19,代碼來源:NotificationPane.java


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