当前位置: 首页>>代码示例>>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;未经允许,请勿转载。