Java Code Examples for javafx.scene.layout.HBox

The following are top voted examples for showing how to use javafx.scene.layout.HBox. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: legendary-guide   File: NotificationBarPane.java   Source Code and License 7 votes vote down vote up
public NotificationBarPane(Node content) {
    super(content);
    progressBar = new ProgressBar();
    label = new Label("infobar!");
    bar = new HBox(label);
    bar.setMinHeight(0.0);
    bar.getStyleClass().add("info-bar");
    bar.setFillHeight(true);
    setBottom(bar);
    // Figure out the height of the bar based on the CSS. Must wait until after we've been added to the parent node.
    sceneProperty().addListener(o -> {
        if (getParent() == null) return;
        getParent().applyCss();
        getParent().layout();
        barHeight = bar.getHeight();
        bar.setPrefHeight(0.0);
    });
    items = FXCollections.observableArrayList();
    items.addListener((ListChangeListener<? super Item>) change -> {
        config();
        showOrHide();
    });
}
 
Example 2
Project: GameAuthoringEnvironment   File: TestFacebook.java   Source Code and License 7 votes vote down vote up
private Node makeMyHighScorePost () {
    HBox box = new HBox(5);
    TextField field = new TextField("Game name");
    ComboBox<ScoreOrder> combo = new ComboBox<>();
    for (ScoreOrder s : ScoreOrder.values()) {
        combo.getItems().add(s);
    }
    box.getChildren().addAll(field, combo);
    Button button = new Button("Post about my scores");
    button.setOnMouseClicked(e -> {
        myUser = mySocial.getActiveUser();
        myUser.getProfiles().getActiveProfile().highScorePost(mySocial.getHighScoreBoard(),
                                                              field.getText(),
                                                              myUser,
                                                              combo.getValue());
    });
    box.getChildren().add(button);
    return box;
}
 
Example 3
Project: marathonv5   File: PasswordFiledSample.java   Source Code and License 7 votes vote down vote up
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);
    stage.setTitle("Password Field Sample");

    VBox vb = new VBox();
    vb.setPadding(new Insets(10, 0, 0, 10));
    vb.setSpacing(10);
    HBox hb = new HBox();
    hb.setSpacing(10);
    hb.setAlignment(Pos.CENTER_LEFT);

    Label label = new Label("Password");
    final PasswordField pb = new PasswordField();  
    pb.setText("Your password");

    pb.setOnAction((ActionEvent e) -> {
        if (!pb.getText().equals("T2f$Ay!")) {
            message.setText("Your password is incorrect!");
            message.setTextFill(Color.rgb(210, 39, 30));
        } else {
            message.setText("Your password has been confirmed");
            message.setTextFill(Color.rgb(21, 117, 84));
        }
        pb.clear();
    });

    hb.getChildren().addAll(label, pb);
    vb.getChildren().addAll(hb, message);

    scene.setRoot(vb);
    stage.show();
}
 
Example 4
Project: WebPLP   File: EditorSettingsPanel.java   Source Code and License 6 votes vote down vote up
private Node editorModeSelection( EditorSettingDetails settingDetails, ObservableList<String> editorModes )
{
	HBox hBox = new HBox();

	Text editorModeLabel = new Text("Editor Mode: ");
	editorModeLabel.setId(UIConstants.TEXT_COLOR);

	ComboBox<String> editorModeComboBox = new ComboBox<>(editorModes);
	editorModeComboBox.getSelectionModel().select(settingDetails.getEditorMode());

	editorModeSelectionModel = editorModeComboBox.getSelectionModel();

	hBox.getChildren().addAll(editorModeLabel, editorModeComboBox);
	hBox.setAlignment(Pos.CENTER_LEFT);

	return hBox;
}
 
Example 5
Project: Validation-Emails-List   File: TalkWithSMTP.java   Source Code and License 6 votes vote down vote up
public TalkWithSMTP(Domain domain) {

        this.domain = domain;
        hbox = new HBox();

        midProgress = new ProgressBar();
        midProgress.setProgress(0.0d);

        progresLabel = new Label(domain.getName());

        List<String> inside = new ArrayList<>();
        int count = 0;
        for (String email : domain.getEmails()) {
            if (count == 10) {
                count = 0;
                this.emails.add(new ArrayList<>(inside));
                inside.clear();
            }

            inside.add(email);
            count++;
        }
    }
 
Example 6
Project: jmonkeybuilder   File: MaterialFileEditor.java   Source Code and License 6 votes vote down vote up
@Override
@FXThread
protected void createToolbar(@NotNull final HBox container) {
    super.createToolbar(container);

    final Label materialDefinitionLabel = new Label(Messages.MATERIAL_EDITOR_MATERIAL_TYPE_LABEL + ":");

    materialDefinitionBox = new ComboBox<>();
    materialDefinitionBox.getSelectionModel()
            .selectedItemProperty()
            .addListener((observable, oldValue, newValue) -> changeType(newValue));

    FXUtils.addToPane(materialDefinitionLabel, container);
    FXUtils.addToPane(materialDefinitionBox, container);

    FXUtils.addClassTo(materialDefinitionLabel, CSSClasses.FILE_EDITOR_TOOLBAR_LABEL);
    FXUtils.addClassTo(materialDefinitionBox, CSSClasses.FILE_EDITOR_TOOLBAR_FIELD);
}
 
Example 7
Project: util4j   File: Board.java   Source Code and License 6 votes vote down vote up
private void createGrid() {
    
    gridOperator.traverseGrid((i,j)->{
        gridGroup.getChildren().add(createCell(i, j));
        return 0;
    });

    gridGroup.getStyleClass().add("game-grid");
    gridGroup.setManaged(false);
    gridGroup.setLayoutX(BORDER_WIDTH);
    gridGroup.setLayoutY(BORDER_WIDTH);

    HBox hBottom = new HBox();
    hBottom.getStyleClass().add("game-backGrid");
    hBottom.setMinSize(gridWidth, gridWidth);
    hBottom.setPrefSize(gridWidth, gridWidth);
    hBottom.setMaxSize(gridWidth, gridWidth);
    
    // Clip hBottom to keep the dropshadow effects within the hBottom
    Rectangle rect = new Rectangle(gridWidth, gridWidth);
    hBottom.setClip(rect);
    hBottom.getChildren().add(gridGroup);
    
    vGame.getChildren().add(hBottom);
}
 
Example 8
Project: jmonkeybuilder   File: SettingsDialog.java   Source Code and License 6 votes vote down vote up
/**
 * Create the checkbox for configuring auto tangent generating.
 */
@FXThread
private void createAutoTangentGeneratingControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label label = new Label(Messages.SETTINGS_DIALOG_AUTO_TANGENT_GENERATING + ":");

    autoTangentGeneratingCheckBox = new CheckBox();
    autoTangentGeneratingCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());

    FXUtils.addToPane(label, container);
    FXUtils.addToPane(autoTangentGeneratingCheckBox, container);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(autoTangentGeneratingCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
 
Example 9
Project: gemoc-studio-modeldebugging   File: TimelineDiffViewerRenderer.java   Source Code and License 6 votes vote down vote up
private void addDelayedValue(HBox line, String description) {
	final List<List<DiffKind>> segments = lineToSegments.get(line);
	final List<DiffKind> segment;
	boolean addDescription = false;
	if (segments.isEmpty()) {
		segment = new ArrayList<>();
		addDescription = true;
		segments.add(segment);
	} else {
		segment = segments.get(segments.size() - 1);
	}
	if (addDescription) {
		List<String> descriptions = segmentToDescription.get(line);
		if (descriptions == null) {
			descriptions = new ArrayList<>();
			segmentToDescription.put(line, descriptions);
		}
		descriptions.add(description);
	}
	segment.add(DiffKind.DEL);
}
 
Example 10
Project: jmonkeybuilder   File: SettingsDialog.java   Source Code and License 6 votes vote down vote up
/**
 * Create tonemap filter control.
 */
@FXThread
private void createToneMapFilterControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label toneMapFilterLabel = new Label(Messages.SETTINGS_DIALOG_TONEMAP_FILTER + ":");

    toneMapFilterCheckBox = new CheckBox();
    toneMapFilterCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());

    FXUtils.addToPane(toneMapFilterLabel, container);
    FXUtils.addToPane(toneMapFilterCheckBox, container);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(toneMapFilterLabel, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(toneMapFilterCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
 
Example 11
Project: WebPLP   File: UARTPanel.java   Source Code and License 6 votes vote down vote up
public UARTPanel()
{
	WebView view = new WebView();
	view.setContextMenuEnabled(false);
	webEngine = view.getEngine();
	
	messageQueue = new LinkedList<>();
	
	valueDisplayOptions = new LinkedHashMap<>();
	populateDisplayOptions();
	
	ObservableValue<State> property = webEngine.getLoadWorker().stateProperty();
	OnLoadListener.register(this::onLoad, property);
	
	String content = "<html><head></head><body " + styleString() + "></body></html>";
	webEngine.loadContent(content);
	
	HBox controlPane = createControlPane();
	
	this.setCenter(view);
	this.setBottom(controlPane);
}
 
Example 12
Project: ChatRoom-JavaFX   File: ChatController.java   Source Code and License 6 votes vote down vote up
/**
 * 处理通知信息的显示
 * @param notice
 */
public void addNotification(String notice){
	Platform.runLater(() ->{
		SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");//设置日期格式
		String timer = df.format(new Date());// new Date()为获取当前系统时间
		String content = timer +  ": " + notice;
		BubbledTextFlow noticeBubbled = new BubbledTextFlow(EmojiDisplayer.createEmojiAndTextNode(content));
		//noticeBubbled.setTextFill(Color.web("#031c30"));
		noticeBubbled.setBackground(new Background(new BackgroundFill(Color.WHITE,
                   null, null)));
           HBox x = new HBox();
           //x.setMaxWidth(chatPaneListView.getWidth() - 20);
           x.setAlignment(Pos.TOP_CENTER);
           noticeBubbled.setBubbleSpec(BubbleSpec.FACE_TOP);
           x.getChildren().addAll(noticeBubbled);
           chatPaneListView.getItems().add(x);
	});
}
 
Example 13
Project: CalendarFX   File: GoogleEntryAttendeesView.java   Source Code and License 6 votes vote down vote up
public GoogleEntryAttendeeItem(EventAttendee attendee) {
    this.attendee = Objects.requireNonNull(attendee);

    optionalIcon = new Label();
    optionalIcon.setOnMouseClicked(evt -> setOptional(!isOptional()));
    optionalIcon.getStyleClass().add("button-icon");
    optionalIcon.setTooltip(new Tooltip());

    statusIcon = new Label();

    name = new Label();
    name.setMaxWidth(Double.MAX_VALUE);

    setOptional(Boolean.TRUE.equals(attendee.getOptional()));
    optionalProperty().addListener(obs -> updateIcon());
    updateIcon();

    removeButton = new Label();
    removeButton.setGraphic(new FontAwesome().create(FontAwesome.Glyph.TRASH_ALT));
    removeButton.getStyleClass().add("button-icon");
    removeButton.setOnMouseClicked(evt -> removeAttendee(attendee));

    HBox.setHgrow(optionalIcon, Priority.NEVER);
    HBox.setHgrow(name, Priority.ALWAYS);
    HBox.setHgrow(removeButton, Priority.NEVER);

    getStyleClass().add("attendee-item");
    getChildren().addAll(optionalIcon, statusIcon, name, removeButton);

    ContextMenu menu = new ContextMenu();
    MenuItem optionalItem = new MenuItem("Mark as optional");
    optionalItem.setOnAction(evt -> setOptional(true));
    MenuItem requiredItem = new MenuItem("Mark as required");
    requiredItem.setOnAction(evt -> setOptional(false));
    MenuItem removeItem = new MenuItem("Remove attendee");
    removeItem.setOnAction(evt -> removeAttendee(attendee));
    menu.getItems().addAll(optionalItem, requiredItem, new SeparatorMenuItem(), removeItem);

    addEventHandler(CONTEXT_MENU_REQUESTED, evt -> menu.show(this, evt.getScreenX(), evt.getScreenY()));
}
 
Example 14
Project: marathonv5   File: DatePickerSample.java   Source Code and License 6 votes vote down vote up
public DatePickerSample() {
    HBox hBox = new HBox();
    hBox.setSpacing(15);

    DatePicker uneditableDatePicker = new DatePicker();
    uneditableDatePicker.setEditable(false);

    DatePicker editablDatePicker = new DatePicker();
    editablDatePicker.setPromptText("Edit or Pick...");
    hBox.getChildren().addAll(uneditableDatePicker, editablDatePicker);
    getChildren().add(hBox);
}
 
Example 15
Project: jmonkeybuilder   File: SettingsDialog.java   Source Code and License 6 votes vote down vote up
/**
 * Create FXAA control.
 */
@FXThread
private void createFXAAControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label label = new Label(Messages.SETTINGS_DIALOG_FXAA + ":");

    fxaaFilterCheckBox = new CheckBox();
    fxaaFilterCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());

    FXUtils.addToPane(label, container);
    FXUtils.addToPane(fxaaFilterCheckBox, container);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(fxaaFilterCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
 
Example 16
Project: Goliath-Overclocking-Utility-FX   File: PasswordPane.java   Source Code and License 6 votes vote down vote up
public PasswordPane()
{
    super();
    super.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
    super.setPrefWidth(AppTabPane.CONTENT_WIDTH);
    super.getStyleClass().add("pane");
    super.setPadding(new Insets(15,15,15,15));
    super.setVgap(10);
    
    buttons = new HBox();
    buttons.setSpacing(10);
    
    Label promptText = new Label("Sudo required.");
    
    okButton = new Button("OK");
    cancelButton = new Button("Cancel");
    
    buttons.getChildren().addAll(okButton, cancelButton);
    
    password = new PasswordField();
    
    okButton.setPrefWidth(60);
    okButton.setOnMouseClicked(new OkButtonHandler());
    
    cancelButton.setOnMouseClicked(new CancelButtonHandler());
    
    password.setPromptText("Password");
    
    super.add(promptText, 0, 0);
    super.add(password, 0, 1);
    super.add(buttons, 0, 2);

}
 
Example 17
Project: ChatRoom-JavaFX   File: ChatController.java   Source Code and License 6 votes vote down vote up
/**
 * 将自己的对话添加到对话列表中
 * @param content
 */
public void addYourMessges(String content){

	Platform.runLater(() ->{
		//寻找用户的头像名
		Image image = new Image("images/" + userPic);
           ImageView profileImage = new ImageView(image);
           profileImage.setFitHeight(32);
           profileImage.setFitWidth(32);
           BubbledTextFlow yourBubbled = new BubbledTextFlow(EmojiDisplayer.createEmojiAndTextNode(content));
           yourBubbled.setBackground(new Background(new BackgroundFill(Color.LIGHTGREEN,
                   null, null)));
           HBox x = new HBox();
           x.setMaxWidth(chatPaneListView.getWidth() - 20);
           x.setAlignment(Pos.TOP_RIGHT);
           yourBubbled.setBubbleSpec(BubbleSpec.FACE_RIGHT_CENTER);
           x.getChildren().addAll(yourBubbled, profileImage);
           chatPaneListView.getItems().add(x);
	});
}
 
Example 18
Project: marathonv5   File: HBoxSample.java   Source Code and License 6 votes vote down vote up
public static Node createIconContent() {
    StackPane sp = new StackPane();
    HBox hbox = new HBox(3);
    hbox.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(70, 25, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    hbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(14, 14, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(18, 14, Color.web("#349b00"));

    hbox.getChildren().addAll(r1, r2, r3);
    sp.getChildren().addAll(rectangle, hbox);

    return new Group(sp);
}
 
Example 19
Project: marathonv5   File: DisplayWindow.java   Source Code and License 6 votes vote down vote up
private Node getMessageBar(VBox vbox) {
    HBox hb = new HBox(10);
    hb.setPrefHeight(32);
    hb.setStyle("-fx-padding: 0 5px 0 5px; -fx-background-color: " + _message_bg + ";");
    CheckBox cb = new CheckBox("Do Not Show Again");
    cb.setStyle("-fx-text-fill: " + _message_fg + ";-fx-fill: " + _message_fg + ";");
    Text b = FXUIUtils.getIconAsText("close");
    b.setOnMouseClicked((e) -> {
        JSONObject preferences = Preferences.instance().getSection("display");
        preferences.put("_doNotShowMessage", cb.isSelected());
        Preferences.instance().save("display");
        vbox.getChildren().remove(0);
    });
    Text t = new Text(_message);
    hb.setAlignment(Pos.CENTER_LEFT);
    HBox.setHgrow(t, Priority.ALWAYS);
    t.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;");
    b.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold;");
    Region spacer = new Region();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    hb.getChildren().addAll(t, spacer, b);
    return hb;
}
 
Example 20
Project: marathonv5   File: CheckListView.java   Source Code and License 6 votes vote down vote up
private void initComponents(boolean selectable) {
    initVerticalButtonBar();
    pane = new ScrollPane();
    HBox.setHgrow(pane, Priority.ALWAYS);
    setCenter(pane);
    if (selectable) {
        setRight(verticalButtonBar);
        verticalButtonBar.setStyle("-fx-padding: 5px");
        verticalButtonBar.setDisable(true);
    }
    VBox titleBox = new VBox();
    Label titleLabel = new Label("Editing CheckList", FXUIUtils.getIcon("newCheckList"));
    titleLabel.getStyleClass().add("modaldialog-title");
    titleBox.getChildren().add(titleLabel);
    titleBox.getChildren().add(new Separator());
    setTop(titleBox);
}
 
Example 21
Project: ABC-List   File: CellUtils.java   Source Code and License 6 votes vote down vote up
static <T> void updateItem(final Cell<T> cell,
        final StringConverter<T> converter,
        final HBox hbox,
        final Node graphic,
        final ComboBox<T> comboBox
) {
    if (cell.isEmpty()) {
        cell.setText(null);
        cell.setGraphic(null);
    } else if (cell.isEditing()) {
        if (comboBox != null) {
            comboBox.getSelectionModel().select(cell.getItem());
        }
        cell.setText(null);

        if (graphic != null) {
            hbox.getChildren().setAll(graphic, comboBox);
            cell.setGraphic(hbox);
        } else {
            cell.setGraphic(comboBox);
        }
    } else {
        cell.setText(getItemText(cell, converter));
        cell.setGraphic(graphic);
    }
}
 
Example 22
Project: ReqMan   File: SaveCancelPane.java   Source Code and License 6 votes vote down vote up
/**
 * Initializes the components.
 */
protected void initComponents() {
    // Declare roles
    saveButton.setDefaultButton(true);
    cancelButton.setCancelButton(true);

    // Init behavior
    saveButton.setOnAction(event -> {
        handleSave(event);
        event.consume();
    });
    cancelButton.setOnAction(event -> {
        handleCancel(event);
        event.consume();
    });

    // Init layout of components
    HBox btnBox = new HBox();
    btnBox.getChildren().addAll(saveButton, cancelButton);
    getChildren().add(btnBox);
    setRightAnchor(btnBox, 0d);

    btnBox.setStyle("-fx-spacing: inherit;-fx-padding: inherit");
}
 
Example 23
Project: matriximage   File: Main.java   Source Code and License 6 votes vote down vote up
@Override public void start(Stage stage) {
    HBox pane = new HBox(imageView, matrix);
    pane.setSpacing(10);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(10, 10, 20), CornerRadii.EMPTY, Insets.EMPTY)));
    Scene scene = new Scene(pane);

    stage.setTitle("Matrix Image");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 24
Project: jmonkeybuilder   File: SettingsDialog.java   Source Code and License 6 votes vote down vote up
/**
 * Create the checkbox for configuring enabling google analytics.
 */
@FXThread
private void createGoogleAnalyticsControl(@NotNull final VBox root) {

    final HBox container = new HBox();
    container.setAlignment(Pos.CENTER_LEFT);

    final Label label = new Label(Messages.SETTINGS_DIALOG_GOOGLE_ANALYTICS + ":");

    googleAnalyticsCheckBox = new CheckBox();
    googleAnalyticsCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> validate());

    FXUtils.addToPane(label, container);
    FXUtils.addToPane(googleAnalyticsCheckBox, container);
    FXUtils.addToPane(container, root);

    FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
    FXUtils.addClassTo(googleAnalyticsCheckBox, CSSClasses.SETTINGS_DIALOG_FIELD);
}
 
Example 25
Project: jmonkeybuilder   File: ModelFileEditor.java   Source Code and License 5 votes vote down vote up
@Override
@FXThread
protected void createActions(@NotNull final HBox container) {
    super.createActions(container);

    lightButton = new ToggleButton();
    lightButton.setTooltip(new Tooltip(Messages.SCENE_FILE_EDITOR_ACTION_CAMERA_LIGHT));
    lightButton.setGraphic(new ImageView(Icons.LIGHT_16));
    lightButton.setSelected(true);
    lightButton.selectedProperty()
            .addListener((observable, oldValue, newValue) -> changeLight(newValue));

    physicsButton = new ToggleButton();
    physicsButton.setTooltip(new Tooltip(Messages.SCENE_FILE_EDITOR_ACTION_PHYSICS));
    physicsButton.setGraphic(new ImageView(Icons.PHYSICS_16));
    physicsButton.setSelected(false);
    physicsButton.selectedProperty()
            .addListener((observable, oldValue, newValue) -> changePhysics(newValue));

    debugPhysicsButton = new ToggleButton();
    debugPhysicsButton.setTooltip(new Tooltip(Messages.SCENE_FILE_EDITOR_ACTION_DEBUG_PHYSICS));
    debugPhysicsButton.setGraphic(new ImageView(Icons.DEBUG_16));
    debugPhysicsButton.setSelected(false);
    debugPhysicsButton.selectedProperty()
            .addListener((observable, oldValue, newValue) -> changeDebugPhysics(newValue));

    DynamicIconSupport.addSupport(lightButton, physicsButton, debugPhysicsButton);

    FXUtils.addClassTo(lightButton, physicsButton, debugPhysicsButton, CSSClasses.FILE_EDITOR_TOOLBAR_BUTTON);
    FXUtils.addToPane(lightButton, physicsButton, debugPhysicsButton, container);
}
 
Example 26
Project: voogasalad-ltub   File: SpriteDescriptorPane.java   Source Code and License 5 votes vote down vote up
public SpriteDescriptorPane(SpriteMakerModel sprite){
	try{
		nameSetter=new SimpleVariableSetter<String>(String.class, "Sprite name:");
		descriptionSetter= new SimpleVariableSetter<String>(String.class, "Description:");
		nameSetter.setField(sprite.getName());
		descriptionSetter.setField(sprite.getDescription());
		HBox box=new HBox();
		box.getChildren().addAll(nameSetter, descriptionSetter);
		this.getChildren().add(box);
		box.setAlignment(Pos.CENTER);
	}
	catch(Exception e){
		AlertHandler.showError(e.getMessage());
	}
}
 
Example 27
Project: CalendarFX   File: DayPageSkin.java   Source Code and License 5 votes vote down vote up
protected Node createLeftHandSide() {
    DayPage dayPage = getSkinnable();

    // today label
    todayLabel = new Label();
    todayLabel.getStyleClass().add("today-label"); //$NON-NLS-1$
    todayLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    todayLabel.setAlignment(Pos.TOP_LEFT);
    todayLabel.setTextOverrun(OverrunStyle.CLIP);
    todayLabel.setMinWidth(Region.USE_PREF_SIZE);
    HBox.setHgrow(todayLabel, Priority.ALWAYS);

    // year month view
    yearMonthView = dayPage.getYearMonthView();
    yearMonthView.setSelectionMode(SelectionMode.SINGLE);
    yearMonthView.setShowMonth(false);
    yearMonthView.setShowYear(false);
    yearMonthView.setShowTodayButton(false);
    HBox.setHgrow(yearMonthView, Priority.NEVER);
    getSkinnable().bind(yearMonthView, true);

    HBox header = new HBox(10);
    header.setFillHeight(true);
    header.getChildren().addAll(todayLabel, yearMonthView);
    header.getStyleClass().add("header");

    AgendaView agendaView = dayPage.getAgendaView();
    getSkinnable().bind(agendaView, true);
    HBox.setMargin(agendaView, new Insets(10, 0, 0, 0));

    BorderPane leftHandSide = new BorderPane();
    leftHandSide.getStyleClass().add("left-side");
    leftHandSide.setTop(header);
    leftHandSide.setCenter(agendaView);
    HBox.setHgrow(leftHandSide, Priority.ALWAYS);
    return leftHandSide;
}
 
Example 28
Project: marathonv5   File: TooltipSample.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Tooltip Sample");
    stage.setWidth(330);
    stage.setHeight(150);

    total.setFont(new Font("Arial", 20));
    
    for (int i = 0; i < rooms.length; i++) {
        final CheckBox cb = cbs[i] = new CheckBox(rooms[i]);
        final Integer rate = rates[i];
        final Tooltip tooltip = new Tooltip("$" + rates[i].toString());
        tooltip.setFont(new Font("Arial", 16));
        cb.setTooltip(tooltip);
 cb.selectedProperty().addListener(
            (ObservableValue<? extends Boolean> ov, Boolean old_val, 
            Boolean new_val) -> {
                if (cb.isSelected()) {
                    sum = sum + rate;
                } else {
                    sum = sum - rate;
                }
                total.setText("Total: $" + sum.toString());
            }
        );
    }

    VBox vbox = new VBox();
    vbox.getChildren().addAll(cbs);
    vbox.setSpacing(5);
    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.getChildren().add(total);
    root.setSpacing(40);
    root.setPadding(new Insets(20, 10, 10, 20));

    ((Group) scene.getRoot()).getChildren().add(root);

    stage.setScene(scene);
    stage.show();
}
 
Example 29
Project: fx-animation-editor   File: PlayerComponent.java   Source Code and License 5 votes vote down vote up
private void initUi() {
    root.getStylesheets().add(getClass().getResource(STYLESHEET).toExternalForm());
    root.getStyleClass().add(STYLE_CLASS);

    playButton.setGraphic(Svg.PLAY.node());
    pauseButton.setGraphic(Svg.PAUSE.node());
    stopButton.setGraphic(Svg.STOP.node());

    HBox labelBox = new HBox(currentTimeLabel, finalTimeLabel);
    labelBox.setMaxWidth(Region.USE_PREF_SIZE);
    labelBox.setAlignment(Pos.CENTER_LEFT);
    StackPane.setAlignment(labelBox, Pos.CENTER_RIGHT);

    currentTimeLabel.getStyleClass().add(CURRENT_TIME_LABEL_STYLE_CLASS);

    HBox buttonBox = new HBox(playButton, pauseButton, stopButton);
    buttonBox.getStyleClass().add(BUTTON_BOX_STYLE_CLASS);
    buttonBox.setMaxWidth(Region.USE_PREF_SIZE);

    root.getChildren().addAll(buttonBox, labelBox);
}
 
Example 30
Project: stvs   File: WizardView.java   Source Code and License 5 votes vote down vote up
private AnchorPane createFooter() {
  AnchorPane footer = new AnchorPane();
  footer.getStyleClass().add("footer");
  HBox bottonBox = new HBox(20);
  bottonBox.getChildren().addAll(previous, next);
  footer.getChildren().add(bottonBox);
  AnchorPane.setRightAnchor(bottonBox, 20.0);
  AnchorPane.setTopAnchor(bottonBox, 10.0);
  AnchorPane.setBottomAnchor(bottonBox, 10.0);
  return footer;
}
 
Example 31
Project: Lernkartei_2017   File: SaveDownloaddoorOnServerDialogView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");

	bottom = new HBox(50);
	bottom.setAlignment(Pos.CENTER);
	bottom.setMaxWidth(300);
	bottom.setPadding(new Insets(20,50,150,280));

	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(100,20,20,20));


	btnOwnDMO = new AppButton("Eigenes DMO");
	btnForeignDMO = new AppButton("Fremdes DMO");
	back = new BackButton(getFXController(), "Zur�ck");

	home = new HomeButton(getFXController());

	AllFields.getChildren().addAll(btnOwnDMO, btnForeignDMO, back, home);
	bottom.getChildren().addAll(back, home);

	bp.setCenter(AllFields);
	bp.setBottom(bottom);

	btnOwnDMO.setOnAction(e -> getFXController().showView("savedownloaddoorowndmoview"));
	btnForeignDMO.setOnAction(e -> getFXController().showView("savedownloadstackforeigndmoview"));
	back.setOnAction(e -> getFXController().showView("serverdoorview"));

	return bp;
}
 
Example 32
Project: Lernkartei_2017   File: DoorSavepathSelectionView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer()
{
	bp.setId("loginviewbg");
	
	bottom = new HBox(50);
	bottom.setAlignment(Pos.CENTER);
	bottom.setMaxWidth(300);
	bottom.setPadding(new Insets(20,50,150,280));
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(100,20,20,20));

	
	btnLocal = new AppButton("lokal speichern");
	btnServer = new AppButton("auf dem Server speichern");
	back = new BackButton(getFXController(), "Zur�ck");
	
	home = new HomeButton(getFXController());
	
	
	
	AllFields.getChildren().addAll(btnLocal, btnServer);
	bottom.getChildren().addAll(back, home);
	
	bp.setCenter(AllFields);
	bp.setBottom(bottom);
	
	btnLocal.setOnAction(e -> getFXController().showView("savedownloadstacklocalview"));
	btnServer.setOnAction(e -> getFXController().showView("savedownloaddooronserverdialogview"));
	back.setOnAction(e -> getFXController().showView("serverdoorview"));
	
	return bp;
}
 
Example 33
Project: jmonkeybuilder   File: AbstractListCell.java   Source Code and License 5 votes vote down vote up
public AbstractListCell() {
    this.content = new HBox();
    this.text = new Label();
    this.visibleIcon = new ImageView();
    this.visibleIcon.addEventFilter(MouseEvent.MOUSE_RELEASED, this::processHide);
    this.visibleIcon.setOnMouseReleased(this::processHide);
    this.visibleIcon.setPickOnBounds(true);

    FXUtils.addToPane(visibleIcon, content);
    FXUtils.addToPane(text, content);

    setEditable(false);

    FXUtils.addClassTo(content, CSSClasses.DEF_HBOX);
}
 
Example 34
Project: CalendarFX   File: SourceGridViewSkin.java   Source Code and License 5 votes vote down vote up
public SourceGridViewSkin(SourceGridView control) {
    super(control);

    container = new HBox();
    container.getStyleClass().add(DEFAULT_STYLE);
    build();

    control.getCalendarSources().addListener(sourcesWeakChangeListener);
    control.maximumRowsPerColumnProperty().addListener(buildWeakListener);
    getChildren().add(container);
}
 
Example 35
Project: jmonkeybuilder   File: Vector2FPropertyControl.java   Source Code and License 5 votes vote down vote up
@Override
@FXThread
protected void createComponents(@NotNull final HBox container) {
    super.createComponents(container);

    fieldContainer = new HBox();
    fieldContainer.prefWidthProperty()
            .bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT));

    xField = new FloatTextField();
    xField.setOnKeyReleased(this::updateVector);
    xField.addChangeListener((observable, oldValue, newValue) -> updateVector(null));
    xField.prefWidthProperty().bind(fieldContainer.widthProperty().multiply(0.5));
    xField.setScrollPower(10F);

    yField = new FloatTextField();
    yField.setOnKeyReleased(this::updateVector);
    yField.addChangeListener((observable, oldValue, newValue) -> updateVector(null));
    yField.prefWidthProperty().bind(fieldContainer.widthProperty().multiply(0.5));
    yField.setScrollPower(10F);

    FXUtils.addToPane(xField, fieldContainer);
    FXUtils.addToPane(yField, fieldContainer);
    FXUtils.addToPane(fieldContainer, container);

    FXUtils.addClassesTo(fieldContainer, CSSClasses.DEF_HBOX, CSSClasses.TEXT_INPUT_CONTAINER,
            CSSClasses.ABSTRACT_PARAM_CONTROL_SHORT_INPUT_CONTAINER);

    FXUtils.addClassesTo(xField, yField, CSSClasses.TRANSPARENT_TEXT_FIELD);

    UIUtils.addFocusBinding(fieldContainer, xField, yField);
}
 
Example 36
Project: Lernkartei_2017   File: UserListView.java   Source Code and License 5 votes vote down vote up
@Override
public Parent constructContainer()
{
	
	bp.setId("loginviewbg");
	
	list = new ListView<String>();
	items = FXCollections.observableArrayList("Philippe Kr�ttli","Irina Deck","Javier Martinez Alvarez","Frithjof Hoppe");
	list.setItems(items);		
	
	AllFields = new VBox(50);
	AllFields.setAlignment(Pos.CENTER);
	AllFields.setMaxWidth(300);
	AllFields.setPadding(new Insets(20));
	
	SearchUser = new HBox();
	Bottom = new HBox();
	
	txtUserName = new TextField();
	txtUserName.setMinHeight(50);
	txtUserName.setMinWidth(700);
	txtUserName.setPromptText("Email-Adresse des Benutzers");
	
	btnSearch = new AppButton("Suchen");
	btnAdd = new AppButton("Hinzuf�gen");
	back = new BackButton(getFXController(),"Zur�ck");
	
	SearchUser.getChildren().addAll(txtUserName,btnSearch);
	Bottom.getChildren().addAll(back,btnAdd);
	AllFields.getChildren().addAll(SearchUser,list,Bottom);
	
	bp.setLeft(AllFields);
	
	//btnSearch.setOnAction(e -> getFXController().showView("userlist"));
	
	
	return bp;
}
 
Example 37
Project: Java-9-Programming-Blueprints   File: TwitterPreferencesController.java   Source Code and License 5 votes vote down vote up
private Node buildConnectUI() {
    HBox box = new HBox();
    box.setPadding(new Insets(10));
    Button button = new Button(MessageBundle.getInstance().getString("connect"));
    button.setOnAction(event -> connectToTwitter());
    box.getChildren().add(button);
    return box;
}
 
Example 38
Project: Automekanik   File: Mesazhi.java   Source Code and License 5 votes vote down vote up
public Mesazhi(String titulli, String titulli_msg, String mesazhi){
    stage.setTitle(titulli);
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setResizable(false);
    HBox root = new HBox(15);
    VBox sub_root = new VBox(10);
    HBox btn = new HBox();
    Text ttl = new Text(titulli_msg);
    ttl.setFont(Font.font(16));
    Button btnOk = new Button("Ne rregull");
    btn.getChildren().add(btnOk);
    btn.setAlignment(Pos.CENTER_RIGHT);

    btnOk.setOnAction(e -> stage.close());
    btnOk.setOnKeyPressed(e -> {
        if (e.getCode().equals(KeyCode.ENTER)) stage.close();
        else if (e.getCode().equals(KeyCode.ESCAPE)) stage.close();
    });

    root.setPadding(new Insets(20));
    sub_root.getChildren().addAll(ttl, new Label(mesazhi), btn);
    if (titulli == "Gabim")
        root.getChildren().add(new ImageView(new Image("/sample/foto/error.png")));
    else if (titulli == "Sukses")
        root.getChildren().add(new ImageView(new Image("/sample/foto/success.png")));
    else if (titulli == "Informacion")
        root.getChildren().add(new ImageView(new Image("/sample/foto/question.png")));
    else if (titulli == "Info")
        root.getChildren().add(new ImageView(new Image("/sample/foto/info.png")));
    root.getChildren().add(sub_root);
    root.setAlignment(Pos.TOP_CENTER);
    Scene scene = new Scene(root, 450, 150);
    scene.getStylesheets().add(getClass().getResource("/sample/style.css").toExternalForm());
    stage.setScene(scene);
    stage.show();
}
 
Example 39
Project: stvs   File: EditorPane.java   Source Code and License 5 votes vote down vote up
/**
 * prefix the line with the line number and possibly an error icon
 * @param i line number
 * @return Node intended as the prefix
 */
private Node createLinePrefixForLine(int i) {

  Label icon = GlyphsDude.createIconLabel(FontAwesomeIcon.EXCLAMATION_CIRCLE, "", null, null, null);
  FilteredList<SyntaxError> lineSyntaxErrors = syntaxErrors.filtered(syntaxError -> syntaxError.getLine() == i + 1);
  setLineIcon(i, lineSyntaxErrors, icon);
  syntaxErrors.addListener((ListChangeListener.Change<?> change) -> {
    setLineIcon(i, lineSyntaxErrors, icon);
  });
  return new HBox(lineNumberFactory.apply(i), icon);
}
 
Example 40
Project: fwm   File: HotkeyController.java   Source Code and License 5 votes vote down vote up
private void setAlignment() {
	label.setPrefWidth(200);
	hbox = new HBox(label, textField);
	hbox.setAlignment(Pos.CENTER_LEFT);
	hbox.setPrefHeight(31);
	label.setText(getPrettyName());
	label.setAlignment(Pos.CENTER_LEFT);
	Insets labelInset = new Insets(0, 0, 0, 10);
	hbox.setMargin(label, labelInset);
	textField.setEditable(false);
	hbox.setHgrow(textField, Priority.ALWAYS);
}