Java Code Examples for javafx.scene.layout.HBox#setStyle()

The following examples show how to use javafx.scene.layout.HBox#setStyle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PluginParametersPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
public Pane getParamPane(final PluginParametersNode node) {
    if (node.getChildren().isEmpty()) {
        return null;
    }
    if (currentChild == -1) {
        warningLabel = new Label(message);
        warningLabel.setFont(Font.font(Font.getDefault().getFamily(), FontPosture.ITALIC, fontSize));
        warningLabel.setWrapText(true);
        warningLabel.setAlignment(Pos.CENTER);
        final HBox warning = new HBox(warningIcon, warningLabel);
        warning.setStyle("-fx-border-color: red");
        return new VBox(warning);
    }
    final Pane paramPane = super.getParamPane(node);
    final SimpleDoubleProperty updated = new SimpleDoubleProperty();
    updated.bind(Bindings.max(maxParamWidth, paramPane.widthProperty()));
    maxParamWidth = updated;
    warningLabel.prefWidthProperty().bind(maxParamWidth);
    return paramPane;
}
 
Example 2
Source File: DisplayWindow.java    From marathonv5 with Apache License 2.0 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: " + Version._message_bg + ";");
    CheckBox cb = new CheckBox("Do Not Show Again");
    cb.setStyle("-fx-text-fill: " + Version._message_fg + ";-fx-fill: " + Version._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(Version._message);
    hb.setAlignment(Pos.CENTER_LEFT);
    HBox.setHgrow(t, Priority.ALWAYS);
    t.setStyle("-fx-fill: " + Version._message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;");
    b.setStyle("-fx-fill: " + Version._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 3
Source File: MultipleAxesLineChart.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
public Node getLegend() {
    final HBox hBox = new HBox();

    final CheckBox baseChartCheckBox = new CheckBox(baseChart.getYAxis().getLabel());
    baseChartCheckBox.setSelected(true);
    baseChartCheckBox
            .setStyle("-fx-text-fill: " + toRGBCode(chartColorMap.get(baseChart)) + "; -fx-font-weight: bold;");
    baseChartCheckBox.setDisable(true);
    baseChartCheckBox.getStyleClass().add("readonly-checkbox");
    baseChartCheckBox.setOnAction(event -> baseChartCheckBox.setSelected(true));
    hBox.getChildren().add(baseChartCheckBox);

    for (final LineChart<?, ?> lineChart : backgroundCharts) {
        final CheckBox checkBox = new CheckBox(lineChart.getYAxis().getLabel());
        checkBox.setStyle("-fx-text-fill: " + toRGBCode(chartColorMap.get(lineChart)) + "; -fx-font-weight: bold");
        checkBox.setSelected(true);
        checkBox.setOnAction(event -> {
            if (backgroundCharts.contains(lineChart)) {
                backgroundCharts.remove(lineChart);
            } else {
                backgroundCharts.add(lineChart);
            }
        });
        hBox.getChildren().add(checkBox);
    }

    hBox.setAlignment(Pos.CENTER);
    hBox.setSpacing(20);
    hBox.setStyle("-fx-padding: 0 10 20 10");

    return hBox;
}
 
Example 4
Source File: QueryListPaneFrame.java    From oim-fx with MIT License 5 votes vote down vote up
private void initComponent() {
	this.setTitle("设备列表");
	this.setResizable(false);
	this.setWidth(960);
	this.setHeight(600);
	this.setTitlePaneStyle(2);
	this.setRadius(5);
	BorderPane rootPane = new BorderPane();
	this.setCenter(rootPane);

	Label titleLabel = new Label();
	titleLabel.setText("设备列表");
	titleLabel.setFont(Font.font("微软雅黑", 30));
	titleLabel.setStyle("-fx-text-fill:rgba(255, 255, 255, 1)");

	HBox hBox = new HBox();
	hBox.setMinHeight(35);
	hBox.setStyle("-fx-background-color:rgba(18, 98, 217, 1)");
	
	hBox.getChildren().add(titleLabel);
	

	
	rootPane.setTop(hBox);
	rootPane.setCenter(queryListPane);
	this.showWaiting(false, WaitingPane.show_waiting);
	this.setPage(0, 1);
}
 
Example 5
Source File: PickerMilestone.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Node getDetailedMilestoneNode() {
    HBox matchingMilestone = new HBox();
    matchingMilestone.setSpacing(3);
    matchingMilestone.setPadding(new Insets(3, 3, 3, 3));
    matchingMilestone.setStyle("-fx-border-width: 0 0 1 0; -fx-border-style: solid;");

    HBox milestoneNodeBox = createMilestoneNodeBox();
    HBox milestoneDetailsBox = createMilestoneDetailsBox();

    matchingMilestone.getChildren().setAll(milestoneNodeBox, milestoneDetailsBox);
    return matchingMilestone;
}
 
Example 6
Source File: DragDrop.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public StackPane createDragDropBox() {

	    	StackPane pane = new StackPane();

	        HBox hBox1 = new HBox();
	        hBox1.setPrefWidth(100);
	        hBox1.setPrefHeight(100);
	        hBox1.setStyle("-fx-border-color: green;"
	              + "-fx-border-width: 2;"
	              + "-fx-border-style: solid;");

	        HBox hBox2 = new HBox();
	        hBox2.setPrefWidth(100);
	        hBox2.setPrefHeight(100);
	        hBox2.setStyle("-fx-border-color: orange;"
	              + "-fx-border-width: 2;"
	              + "-fx-border-style: solid;");

	        //insertImage(new Image(getClass().getResourceAsStream("/images/MaleIcon.png")), hBox1);
	        //insertImage(new Image(getClass().getResourceAsStream("/images/FemaleIcon.png")), hBox2);
	        //insertImage(new Image(getClass().getResourceAsStream("/images/RobotIcon.png")), hBox1);

	        insertImage("bee32.png", hBox1);
	        insertImage("branch32.png", hBox1);
	        insertImage("carrot32.png", hBox1);
	        insertImage("ladybug32.png", hBox1);
	        insertImage("leaf32.png", hBox1);	        

	        //setupGestureTarget(hBox1);
	        setupGestureTarget(hBox2);
	        
	        VBox vBox = new VBox();
	        vBox.getChildren().addAll(hBox1, hBox2);
	        pane.getChildren().addAll(vBox);

	        return pane;
	    }
 
Example 7
Source File: MilestonePickerDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private HBox createPreviouslyAssignedMilestoneBox() {
    HBox milestoneBox = new HBox();
    milestoneBox.setPrefWidth(120);
    milestoneBox.setPrefHeight(PREV_ASSIGNED_MILESTONE_HEIGHT);
    milestoneBox.setMaxHeight(PREV_ASSIGNED_MILESTONE_HEIGHT);
    milestoneBox.setStyle("-fx-border-radius: 3;-fx-border-style: dotted;-fx-alignment:center");
    return milestoneBox;
}
 
Example 8
Source File: TitleListNodePane.java    From oim-fx with MIT License 5 votes vote down vote up
private void initComponent() {

		textLabel.setStyle("-fx-text-fill:#787b87;-fx-font-size: 14px;");
		
		HBox textHBox = new HBox();
		textHBox.setStyle("-fx-background-color:rgba(240,240,240,0.8);");
		textHBox.setPadding(new Insets(4, 0, 4, 20));
		textHBox.getChildren().add(textLabel);
		
		this.setTop(textHBox);
		this.setCenter(centerVBox);
		this.setStyle("-fx-background-color:rgba(250,250,250,0.8);");
	}
 
Example 9
Source File: MilestonePickerDialog.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private HBox createNewlyAssignedMilestoneBox() {
    HBox milestoneBox = new HBox();
    milestoneBox.setPrefWidth(140);
    milestoneBox.setPrefHeight(40);
    milestoneBox.setStyle("-fx-border-radius: 3;-fx-border-style: dotted;-fx-alignment:center");
    return milestoneBox;
}
 
Example 10
Source File: PickerAssignee.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Node getMatchingNode() {
    HBox assigneeBox = getAssigneeHBox();
    ImageView avatar = getAvatarImageView();
    Label assigneeLoginName = getAssigneeLabel();

    if (isSelected) {
        assigneeLoginName.setText(assigneeLoginName.getText() + " ✓");
        assigneeBox.setStyle(assigneeBox.getStyle() + "-fx-background-color: skyblue");
    }

    assigneeBox.getChildren().setAll(avatar, assigneeLoginName);

    return assigneeBox;
}
 
Example 11
Source File: TweetsToTori.java    From TweetwallFX with MIT License 5 votes vote down vote up
private static Parent createTweetInfoBox(Tweet info) {
    HBox hbox = new HBox(20);
    hbox.setStyle("-fx-padding: 20px;");

    HBox hImage = new HBox();
    hImage.setPadding(new Insets(10));
    Image image = new Image(info.getUser().getProfileImageUrl(), 48, 48, true, false);
    ImageView imageView = new ImageView(image);
    Rectangle clip = new Rectangle(48, 48);
    clip.setArcWidth(10);
    clip.setArcHeight(10);
    imageView.setClip(clip);
    hImage.getChildren().add(imageView);

    HBox hName = new HBox(20);
    Label name = new Label(info.getUser().getName());
    name.setStyle("-fx-font: 32px \"Andalus\"; -fx-text-fill: #292F33; -fx-font-weight: bold;");
    DateFormat df = new SimpleDateFormat("HH:mm:ss");
    Label handle = new Label("@" + info.getUser().getScreenName() + " · " + df.format(info.getCreatedAt()));
    handle.setStyle("-fx-font: 28px \"Andalus\"; -fx-text-fill: #8899A6;");
    hName.getChildren().addAll(name, handle);

    Text text = new Text(info.getText());
    text.setWrappingWidth(550);
    text.setStyle("-fx-font: 24px \"Andalus\"; -fx-fill: #292F33;");
    VBox vbox = new VBox(20);
    vbox.getChildren().addAll(hName, text);
    hbox.getChildren().addAll(hImage, vbox);

    return hbox;
}
 
Example 12
Source File: ChatTopPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {
	this.getChildren().add(baseBorderPane);

	nameLabel.setStyle("-fx-font-size:18px;");

	nameHBox.getChildren().add(nameLabel);
	textHBox.getChildren().add(textLabel);

	VBox infoVBox = new VBox();
	infoVBox.setPadding(new Insets(10, 0, 5, 28));
	infoVBox.getChildren().add(nameHBox);
	infoVBox.getChildren().add(textHBox);

	// this.setPadding(new Insets(0, 0, 0, 8));

	// textBox.setStyle("-fx-background-color:rgba(255, 255, 255, 0.92)");

	toolBar.setBackground(Background.EMPTY);
	//toolBar.setPadding(new Insets(0, 0, 0, 0));
	toolBar.setPadding(new Insets(0, 0, 0, 28));
	
	rightToolBox.setAlignment(Pos.CENTER_RIGHT);

	
	HBox toolHBox = new HBox();
	
	toolHBox.setAlignment(Pos.CENTER_LEFT);
	toolHBox.getChildren().add(toolBar);
	
	BorderPane toolBorderPane = new BorderPane();
	toolBorderPane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.9)");
	toolBorderPane.setCenter(toolHBox);
	toolBorderPane.setRight(rightToolBox);
	
	HBox topLine = new HBox();
	topLine.setMinHeight(1);
	topLine.setStyle("-fx-background-color:#d6d6d6;");

	VBox topVBox = new VBox();
	topVBox.setPadding(new Insets(0, 0, 0, 0));
	topVBox.getChildren().add(infoVBox);
	topVBox.getChildren().add(topLine);
	
	baseBorderPane.setCenter(topVBox);
	baseBorderPane.setBottom(toolBorderPane);
}
 
Example 13
Source File: ChatPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {

		HBox line = new HBox();
		line.setMinHeight(1);
		line.setStyle("-fx-background-color:#d6d6d6;");

		middleToolBarBox.setPadding(new Insets(5, 0, 0, 15));
		middleToolBarBox.setMinHeight(25);
		middleToolBarBox.setSpacing(10);
		middleToolBarBox.setAlignment(Pos.CENTER_LEFT);

		VBox writeTempBox = new VBox();

		writeTempBox.getChildren().add(line);
		writeTempBox.getChildren().add(middleToolBarBox);

		// chatShowPane.setStyle("-fx-background-color:#f5f5f5;");
		// writeBorderPane.setStyle("-fx-background-color:#ffffff;");
		chatShowPane.setStyle("-fx-background-color:rgba(250, 250, 250, 0.9)");
		writeBorderPane.setStyle("-fx-background-color:rgba(250, 250, 250, 0.9)");

		writeBorderPane.setTop(writeTempBox);
		writeBorderPane.setCenter(chatWritePane);

		splitPane.setTop(chatShowPane);
		splitPane.setBottom(writeBorderPane);
		splitPane.setPrefWidth(780);

		sendButton.setText("发送");

		sendButton.setPrefSize(72, 24);
		sendButton.setFocusTraversable(false);

		bottomButtonBox.setStyle("-fx-background-color:rgba(250, 250, 250, 0.9)");
		bottomButtonBox.setPadding(new Insets(0, 15, 0, 0));
		bottomButtonBox.setSpacing(5);
		bottomButtonBox.setAlignment(Pos.CENTER_RIGHT);
		bottomButtonBox.setMinHeight(40);
		bottomButtonBox.getChildren().add(sendButton);

		BorderPane borderPane = new BorderPane();
		borderPane.setCenter(splitPane);
		borderPane.setBottom(bottomButtonBox);

		baseBorderPane.setTop(chatTopPane);
		baseBorderPane.setCenter(borderPane);

		this.getChildren().add(baseBorderPane);
	}
 
Example 14
Source File: FindGroupItem.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {

		headImageView.setFitHeight(60);
		headImageView.setFitWidth(60);

		headClip.setArcHeight(60);
		headClip.setArcWidth(60);

		headClip.setWidth(60);
		headClip.setHeight(60);

		headImagePane.setClip(headClip);
		headImagePane.getChildren().add(headImageView);
		headImagePane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.9)");

		pane.getStyleClass().add("head-common-image-pane");

		pane.getChildren().add(headImagePane);
		pane.setPrefWidth(60);
		pane.setPrefHeight(60);
		pane.setLayoutX(2);
		pane.setLayoutY(2);

		headImageShowPane.getChildren().add(pane);

		headRootPane.setTop(getGapNode(3));
		headRootPane.setRight(getGapNode(5));
		headRootPane.setLeft(getGapNode(5));
		headRootPane.setBottom(getGapNode(3));
		headRootPane.setCenter(headImageShowPane);

		headBaseRootPane.getChildren().add(headRootPane);

		headBaseRootPane.setPrefWidth(75);
		headBaseRootPane.setMinWidth(75);

		textBaseRootPane.getChildren().add(getGapNode(12));
		textBaseRootPane.getChildren().add(infoPane);
		textBaseRootPane.getChildren().add(textRootPane);
		// textBaseRootPane.getChildren().add(addButton);
		// textBaseRootPane.getChildren().add(getGapNode(5));

		infoPane.getChildren().add(nameLabel);
		textRootPane.getChildren().add(infoTextLabel);

		nameLabel.setStyle("-fx-text-fill:#000000;-fx-font-size:15px;");
		infoTextLabel.setStyle("-fx-text-fill:#888888;-fx-font-size:14px;");

		HBox hBox = new HBox();

		hBox.getChildren().add(headBaseRootPane);
		hBox.getChildren().add(textBaseRootPane);

		textArea.setEditable(false);
		textArea.setBorder(Border.EMPTY);
		textArea.getStyleClass().clear();

		VBox vBox = new VBox();
		vBox.setPadding(new Insets(5, 5, 5, 5));
		vBox.getChildren().add(hBox);
		vBox.getChildren().add(textArea);

		HBox iconBox = new HBox();
		iconBox.getStyleClass().add("find-add-icon");
		iconBox.setMinSize(14, 15);

		addButton.setGraphic(iconBox);
		addButton.getStyleClass().add("find-add-button");
		addButton.setText("加群");

		HBox bottomBox = new HBox();
		bottomBox.setAlignment(Pos.BASELINE_RIGHT);
		bottomBox.setStyle("-fx-background-color:#e6e6e6");
		bottomBox.setPadding(new Insets(5, 10, 5, 10));
		bottomBox.getChildren().add(addButton);

		this.setStyle("-fx-border-color:#e6e6e6;-fx-border-width: 1px;");
		this.setCenter(vBox);
		this.setBottom(bottomBox);
	}
 
Example 15
Source File: ChatPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {

		textLabel.setStyle("-fx-font-size: 16px;");

		HBox line = new HBox();
		line.setMinHeight(1);
		line.setStyle("-fx-background-color:#d6d6d6;");

		middleToolBarBox.setPadding(new Insets(10, 0, 0, 20));
		middleToolBarBox.setMinHeight(25);
		middleToolBarBox.setSpacing(10);
		middleToolBarBox.setAlignment(Pos.CENTER_LEFT);

		VBox writeTempBox = new VBox();

		writeTempBox.getChildren().add(line);
		writeTempBox.getChildren().add(middleToolBarBox);

		chatShowPane.setStyle("-fx-background-color:#f5f5f5;");
		writeBorderPane.setStyle("-fx-background-color:#ffffff;");

		writeBorderPane.setTop(writeTempBox);
		writeBorderPane.setCenter(chatWritePane);

		splitPane.setTop(chatShowPane);
		splitPane.setBottom(writeBorderPane);
		splitPane.setPrefWidth(780);

		HBox textHBox = new HBox();
		textHBox.setPadding(new Insets(28, 0, 15, 28));
		textHBox.setAlignment(Pos.CENTER_LEFT);
		textHBox.getChildren().add(textLabel);

		topRightButtonBox.setAlignment(Pos.CENTER_RIGHT);
		topRightButtonBox.setPadding(new Insets(25, 20, 0, 0));

		VBox topRightButtonVBox = new VBox();
		topRightButtonVBox.setAlignment(Pos.CENTER);
		topRightButtonVBox.getChildren().add(topRightButtonBox);

		BorderPane topBorderPane = new BorderPane();
		topBorderPane.setCenter(textHBox);
		topBorderPane.setRight(topRightButtonVBox);

		HBox topLine = new HBox();
		topLine.setMinHeight(1);
		topLine.setStyle("-fx-background-color:#d6d6d6;");

		VBox topVBox = new VBox();
		topVBox.setPadding(new Insets(0, 0, 0, 0));
		topVBox.getChildren().add(topBorderPane);
		topVBox.getChildren().add(topLine);

		sendButton.setText("发送");

		sendButton.setPrefSize(72, 24);
		sendButton.setFocusTraversable(false);

		bottomButtonBox.setStyle("-fx-background-color:#ffffff;");
		bottomButtonBox.setPadding(new Insets(0, 15, 0, 0));
		bottomButtonBox.setSpacing(5);
		bottomButtonBox.setAlignment(Pos.CENTER_RIGHT);
		bottomButtonBox.setMinHeight(40);
		bottomButtonBox.getChildren().add(sendButton);

		BorderPane borderPane = new BorderPane();
		borderPane.setCenter(splitPane);
		borderPane.setBottom(bottomButtonBox);

		baseBorderPane.setTop(topVBox);
		baseBorderPane.setCenter(borderPane);

		this.getChildren().add(baseBorderPane);
	}
 
Example 16
Source File: ChatPanel.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {
	this.setTop(topPane);
	this.setCenter(showSplitPane);
	this.setRight(rightPane);

	//rightPane.setPrefWidth(140);
	//rightPane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.5)");

	topPane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.2)");
	topPane.setPrefHeight(80);
	topPane.getChildren().add(topPanel);

	WebView webView = showPanel.getWebView();
	webView.setPrefWidth(20);
	webView.setPrefHeight(50);

	showSplitPane.setTop(showBox);
	showSplitPane.setBottom(writeBox);
	showSplitPane.setStyle("-fx-background-color:rgba(255, 255, 255, 0.9)");

	showBox.getChildren().add(webView);
	VBox.setVgrow(webView, Priority.ALWAYS);

	HBox line = new HBox();
	line.setMinHeight(1);
	line.setStyle("-fx-background-color:rgba(180, 180, 180, 1);");

	middleToolBarBox.setMinHeight(25);
	middleToolBarBox.setSpacing(8);
	middleToolBarBox.setAlignment(Pos.CENTER_LEFT);

	rightFunctionBox.setPadding(new Insets(0, 5, 0, 0));
	
	HBox functionRootBox = new HBox();

	functionRootBox.setAlignment(Pos.CENTER_RIGHT);

	functionRootBox.getChildren().add(middleToolBarBox);
	functionRootBox.getChildren().add(rightFunctionBox);

	HBox.setHgrow(middleToolBarBox, Priority.ALWAYS);

	VBox writeTempBox = new VBox();

	writeTempBox.getChildren().add(line);
	writeTempBox.getChildren().add(functionRootBox);

	writeBox.getChildren().add(writeTempBox);
	writeBox.getChildren().add(writePanel);
	writeBox.getChildren().add(bottomButtonBox);

	fontBox.setMinHeight(25);
	fontBox.setSpacing(2);

	bottomButtonBox.setPadding(new Insets(0, 15, 0, 0));
	bottomButtonBox.setSpacing(5);
	bottomButtonBox.setAlignment(Pos.CENTER_RIGHT);
	bottomButtonBox.setMinHeight(40);

	closeButton.setText("关闭");
	sendButton.setText("发送");

	closeButton.setPrefSize(72, 24);
	sendButton.setPrefSize(72, 24);

	closeButton.setFocusTraversable(false);
	sendButton.setFocusTraversable(false);

	bottomButtonBox.getChildren().add(closeButton);
	bottomButtonBox.getChildren().add(sendButton);

}
 
Example 17
Source File: ListItemPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {

		
		headImageView.setClip(headImageClip);

		StackPane headStackPane = new StackPane();
		headStackPane.setPadding(new Insets(12, 8, 12, 18));
		headStackPane.getChildren().add(headImageView);

		redLabel.setStyle("-fx-text-fill:rgba(255, 255, 255, 1);");

		StackPane redStackPane = new StackPane();
		redStackPane.getChildren().add(redImageView);
		redStackPane.getChildren().add(redLabel);

		HBox redHBox = new HBox();
		redHBox.setAlignment(Pos.TOP_RIGHT);
		redHBox.getChildren().add(redStackPane);
		
		VBox redVBox = new VBox();
		redVBox.setAlignment(Pos.TOP_RIGHT);
		redVBox.getChildren().add(redHBox);

		StackPane leftStackPane = new StackPane();

		leftStackPane.getChildren().add(headStackPane);
		leftStackPane.getChildren().add(redVBox);

		nameLabel.setStyle("-fx-text-fill:rgba(255, 255, 255, 1);-fx-font-size: 14px;");

		HBox nameHBox = new HBox();
		nameHBox.setAlignment(Pos.CENTER_LEFT);
		nameHBox.getChildren().add(nameLabel);

		VBox centerVBox = new VBox();
		centerVBox.setAlignment(Pos.CENTER_LEFT);
		centerVBox.getChildren().add(nameHBox);

		HBox lineHBox = new HBox();
		lineHBox.setPrefHeight(1);
		lineHBox.setStyle("-fx-background-color:#292c33;");

		borderPane.setLeft(leftStackPane);
		borderPane.setCenter(centerVBox);
		borderPane.setBottom(lineHBox);
		//this.getStyleClass().add("chat-item-pane");
		this.getChildren().add(borderPane);
	}
 
Example 18
Source File: ChatItemPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {

		headImageView.setClip(headImageClip);

		StackPane headStackPane = new StackPane();
		headStackPane.setPadding(new Insets(12, 8, 12, 18));
		headStackPane.getChildren().add(headImageView);

		redLabel.setStyle("-fx-text-fill:rgba(255, 255, 255, 1);");

		StackPane redStackPane = new StackPane();
		redStackPane.getChildren().add(redImageView);
		redStackPane.getChildren().add(redLabel);

		HBox redHBox = new HBox();
		redHBox.setAlignment(Pos.TOP_RIGHT);
		redHBox.getChildren().add(redStackPane);

		VBox redVBox = new VBox();
		redVBox.setAlignment(Pos.TOP_RIGHT);
		redVBox.getChildren().add(redHBox);

		StackPane leftStackPane = new StackPane();

		leftStackPane.getChildren().add(headStackPane);
		leftStackPane.getChildren().add(redVBox);

		nameLabel.setStyle("-fx-text-fill:rgba(255, 255, 255, 1);-fx-font-size: 14px;");

		HBox nameHBox = new HBox();
		nameHBox.getChildren().add(nameLabel);

		timeLabel.setStyle("-fx-text-fill:#666a77;");

		BorderPane nameBorderPane = new BorderPane();

		nameBorderPane.setCenter(nameHBox);
		nameBorderPane.setRight(timeLabel);

		textLabel.setStyle("-fx-text-fill:rgba(152, 152, 152, 1);");

		HBox textHBox = new HBox();
		textHBox.setAlignment(Pos.CENTER_LEFT);
		textHBox.getChildren().add(textLabel);

		VBox centerVBox = new VBox();
		centerVBox.setSpacing(5);
		centerVBox.setPadding(new Insets(10, 0, 0, 0));
		centerVBox.getChildren().add(nameBorderPane);
		centerVBox.getChildren().add(textHBox);

		HBox lineHBox = new HBox();
		lineHBox.setPrefHeight(0.5);
		lineHBox.setStyle("-fx-background-color:#292c33;");

		borderPane.setLeft(leftStackPane);
		borderPane.setCenter(centerVBox);
		borderPane.setBottom(lineHBox);
		// borderPane.getStyleClass().add("selected-button");
		// this.getStyleClass().add("chat-item-pane");
		this.getChildren().add(borderPane);
	}
 
Example 19
Source File: AboutDialog.java    From JetUML with GNU General Public License v3.0 4 votes vote down vote up
private Scene createScene() 
{
	final int verticalSpacing = 5;
	
	VBox info = new VBox(verticalSpacing);
	Text name = new Text(RESOURCES.getString("application.name"));
	name.setStyle("-fx-font-size: 18pt;");
	
	Text version = new Text(String.format("%s %s", RESOURCES.getString("dialog.about.version"), 
			UMLEditor.VERSION));
	
	Text copyright = new Text(RESOURCES.getString("application.copyright"));
	
	Text license = new Text(RESOURCES.getString("dialog.about.license"));
	
	Text quotes = new Text(RESOURCES.getString("quotes.copyright"));
	
	Hyperlink link = new Hyperlink(RESOURCES.getString("dialog.about.link"));
	link.setBorder(Border.EMPTY);
	link.setPadding(new Insets(0));
	link.setOnMouseClicked(e -> UMLEditor.openBrowser(RESOURCES.getString("dialog.about.url")));
	link.setUnderline(true);
	link.setFocusTraversable(false);
	
	info.getChildren().addAll(name, version, copyright, license, link, quotes);
	
	final int padding = 15;
	HBox layout = new HBox(padding);
	layout.setStyle("-fx-background-color: gainsboro;");
	layout.setPadding(new Insets(padding));
	layout.setAlignment(Pos.CENTER_LEFT);
	
	ImageView logo = new ImageView(RESOURCES.getString("application.icon"));
	logo.setEffect(new BoxBlur());
	layout.getChildren().addAll(logo, info);
	layout.setAlignment(Pos.TOP_CENTER);
	
	aStage.requestFocus();
	aStage.addEventHandler(KeyEvent.KEY_PRESSED, pEvent -> 
	{
		if (pEvent.getCode() == KeyCode.ENTER) 
		{
			aStage.close();
		}
	});
	
	return new Scene(layout);
}
 
Example 20
Source File: FXColorPicker.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Constructs a new {@link FXColorPicker}.
 *
 * @param parent
 *            The parent {@link Composite}.
 * @param color
 *            The initial {@link Color} to set.
 */
public FXColorPicker(final Composite parent, Color color) {
	super(parent, SWT.NONE);
	setLayout(new FillLayout());

	FXCanvas canvas = new FXCanvas(this, SWT.NONE);

	// container
	Group colorPickerGroup = new Group();
	HBox hbox = new HBox();
	colorPickerGroup.getChildren().add(hbox);

	// color wheel
	WritableImage colorWheelImage = new WritableImage(64, 64);
	renderColorWheel(colorWheelImage, 0, 0, 64);
	ImageView colorWheel = new ImageView(colorWheelImage);
	colorWheel.setFitWidth(16);
	colorWheel.setFitHeight(16);

	BorderPane colorWheelPane = new BorderPane();
	Insets insets = new Insets(2.0);
	colorWheelPane.setPadding(insets);
	colorWheelPane.setCenter(colorWheel);
	// use background color of parent composite (the wheel image is
	// transparent outside the wheel, so otherwise the hbox color would look
	// through)
	colorWheelPane.setStyle("-fx-background-color: "
			+ computeRgbString(Color.rgb(parent.getBackground().getRed(),
					parent.getBackground().getGreen(),
					parent.getBackground().getBlue())));

	colorRectangle = new Rectangle(50, 20);
	// bind to ColorWheel instead of buttonPane to prevent layout
	// problems.
	colorRectangle.widthProperty().bind(colorWheel.fitWidthProperty()
			.add(insets.getLeft()).add(insets.getRight()).multiply(2.5));
	colorRectangle.heightProperty().bind(colorWheelPane.heightProperty());

	// draw 'border' around hbox (and fill background, which covers the
	// space beween color rect and wheel
	hbox.setStyle("-fx-border-color: " + computeRgbString(Color.DARKGREY)
			+ "; -fx-background-color: "
			+ computeRgbString(Color.DARKGREY));
	hbox.getChildren().addAll(colorRectangle, colorWheelPane);
	hbox.setSpacing(0.5);

	// interaction
	colorWheelPane.setOnMouseClicked(new EventHandler<MouseEvent>() {
		@Override
		public void handle(MouseEvent event) {
			Color colorOrNull = FXColorPicker.pickColor(getShell(),
					getColor());
			if (colorOrNull != null) {
				setColor(colorOrNull);
			}
		}
	});

	Scene scene = new Scene(colorPickerGroup);

	// copy background color from parent composite
	org.eclipse.swt.graphics.Color backgroundColor = parent.getBackground();
	scene.setFill(Color.rgb(backgroundColor.getRed(),
			backgroundColor.getGreen(), backgroundColor.getBlue()));
	canvas.setScene(scene);

	// initialize some color
	setColor(color);

	colorRectangle.fillProperty().bind(this.color);
}