Example usage for javafx.scene.text FontWeight NORMAL

List of usage examples for javafx.scene.text FontWeight NORMAL

Introduction

In this page you can find the example usage for javafx.scene.text FontWeight NORMAL.

Prototype

FontWeight NORMAL

To view the source code for javafx.scene.text FontWeight NORMAL.

Click Source Link

Document

represents Normal font weight (400).

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("JavaFX Welcome");
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);/*  w  w w.  j a  va2 s .  c  o  m*/
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    Text scenetitle = new Text("Welcome");
    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 0, 0, 2, 1);

    Label userName = new Label("User Name:");
    grid.add(userName, 0, 1);

    TextField userTextField = new TextField();
    grid.add(userTextField, 1, 1);

    Label pw = new Label("Password:");
    grid.add(pw, 0, 2);

    PasswordField pwBox = new PasswordField();
    grid.add(pwBox, 1, 2);

    Button btn = new Button("Sign in");
    HBox hbBtn = new HBox(10);
    hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
    hbBtn.getChildren().add(btn);
    grid.add(hbBtn, 1, 4);

    final Text actiontarget = new Text();
    grid.add(actiontarget, 1, 6);

    btn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent e) {
            actiontarget.setFill(Color.FIREBRICK);
            actiontarget.setText("Sign in button pressed");
        }
    });

    Scene scene = new Scene(grid, 300, 275);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void openAccountManager() {
    //Window Crap
    Stage accountManagerStage = new Stage();
    accountManagerStage.setTitle("Starbound Server Account Manager");

    GridPane gp = new GridPane();
    gp.setAlignment(Pos.CENTER);/*from   w w  w.  jav  a2 s  .  c om*/
    gp.setVgap(10);
    gp.setHgap(10);
    gp.setPadding(new Insets(25, 25, 25, 25));

    Text title = new Text("Starbound Account Manager");
    title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(title, 0, 0, 2, 1);

    ListView<String> user_list = new ListView<String>();
    ObservableList<String> user_list_o = FXCollections.observableArrayList(users);
    user_list.setItems(user_list_o);
    user_list.setPrefHeight(50);

    ListView<String> banned_users_list = new ListView<String>();
    ObservableList<String> banned_users_list_o = FXCollections.observableArrayList(banned_usernames);
    banned_users_list.setItems(banned_users_list_o);
    banned_users_list.setPrefHeight(50);

    ListView<String> banned_ips_list = new ListView<String>();
    ObservableList<String> banned_ips_list_o = FXCollections.observableArrayList(banned_ips);
    banned_ips_list.setItems(banned_ips_list_o);
    banned_ips_list.setPrefHeight(50);

    ListView<String> banned_playernames_list = new ListView<String>();
    ObservableList<String> banned_playernames_list_o = FXCollections.observableArrayList(banned_playernames);
    banned_playernames_list.setItems(banned_playernames_list_o);
    banned_playernames_list.setPrefHeight(50);

    Label user_list_l = new Label("Current Users");
    Label banned_users_list_l = new Label("Banned Users");
    Label banned_ips_list_l = new Label("Banned IP's");
    Label banned_playernames_list_l = new Label("Banned Player Names");

    Button add_user = new Button("Add User");
    Button add_banned_user = new Button("Add Banned User");
    Button add_banned_ip = new Button("Add Banned IP");
    Button add_banned_playername = new Button("Add Banner Playername");

    Button remove_user = new Button("Remove User");
    Button remove_banned_user = new Button("Remove Banned User");
    Button remove_banned_ip = new Button("Remove Banned IP");
    Button remove_banned_playername = new Button("Remove Banner Playername");

    HBox userbox = new HBox();
    userbox.setAlignment(Pos.BOTTOM_LEFT);
    userbox.getChildren().addAll(add_user, remove_user);
    userbox.setSpacing(5);

    HBox b_userbox = new HBox();
    b_userbox.setAlignment(Pos.BOTTOM_LEFT);
    b_userbox.getChildren().addAll(add_banned_user, remove_banned_user);
    b_userbox.setSpacing(5);

    HBox b_ipbox = new HBox();
    b_ipbox.setAlignment(Pos.BOTTOM_LEFT);
    b_ipbox.getChildren().addAll(add_banned_ip, remove_banned_ip);
    b_ipbox.setSpacing(5);

    HBox b_playerbox = new HBox();
    b_playerbox.setAlignment(Pos.BOTTOM_LEFT);
    b_playerbox.getChildren().addAll(add_banned_playername, remove_banned_playername);
    b_playerbox.setSpacing(5);

    Button save = new Button("Save Config");
    save.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            save();
        }

    });

    add_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createAccount(user_list);
        }

    });
    add_banned_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedUser(banned_users_list);
        }

    });
    add_banned_ip.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedIP(banned_ips_list);
        }

    });
    add_banned_playername.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            createBannedPlayername(banned_playernames_list);
        }

    });

    remove_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            users.remove(user_list.getSelectionModel().getSelectedItem());
            user_list.setItems(FXCollections.observableArrayList(users));
        }

    });
    remove_banned_user.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_usernames.remove(banned_users_list.getSelectionModel().getSelectedItem());
            banned_users_list.setItems(FXCollections.observableArrayList(banned_usernames));
        }

    });
    remove_banned_ip.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_ips.remove(banned_ips_list.getSelectionModel().getSelectedItem());
            banned_ips_list.setItems(FXCollections.observableArrayList(banned_ips));
        }

    });
    remove_banned_playername.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_playernames.remove(banned_playernames_list.getSelectionModel().getSelectedItem());
            banned_playernames_list.setItems(FXCollections.observableArrayList(banned_playernames));
        }

    });

    gp.add(user_list_l, 0, 1);
    gp.add(user_list, 0, 2);
    gp.add(userbox, 0, 3);
    gp.add(banned_users_list_l, 0, 4);
    gp.add(banned_users_list, 0, 5);
    gp.add(b_userbox, 0, 6);
    gp.add(banned_ips_list_l, 0, 7);
    gp.add(banned_ips_list, 0, 8);
    gp.add(b_ipbox, 0, 9);
    gp.add(banned_playernames_list_l, 0, 10);
    gp.add(banned_playernames_list, 0, 11);
    gp.add(b_playerbox, 0, 12);
    gp.add(save, 0, 13);

    Scene sc = new Scene(gp, 800 / 2, 600);
    accountManagerStage.setScene(sc);
    accountManagerStage.show();

}

From source file:de.pixida.logtest.designer.automaton.RectangularNode.java

RectangularNode(final Graph graph, final ContentDisplayMode aContentDisplayMode, final int zIndex) {
    super(graph);

    Validate.notNull(aContentDisplayMode);
    this.contentDisplayMode = aContentDisplayMode;

    this.rectangle.setStroke(BORDER_COLOR_DEFAULT);

    final Font titleFont = Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, 10.0);
    this.titleText.setFont(titleFont);

    final Font contentFont = Font.font(titleFont.getFamily(), FontWeight.NORMAL, titleFont.getSize());
    this.contentText.setFont(contentFont);

    this.textFlow.getChildren().addAll(this.titleText, this.separatorText, this.contentText);
    this.textFlow.layoutXProperty().bind(this.rectangle.xProperty());
    this.textFlow.layoutYProperty().bind(this.rectangle.yProperty());
    final double insetTop = 0.0;
    final double insetRight = 3.0;
    final double insetBottom = 3.0;
    final double insetLeft = 3.0;
    this.textFlow.setPadding(new Insets(insetTop, insetRight, insetBottom, insetLeft));
    this.textFlow.setMouseTransparent(true);

    this.contentDisplayMode.init(this.textFlow, this.rectangle);

    if (this.contentDisplayMode.isResizable()) {
        //            this.createResizeSpots();
    }//from   ww w  .java2  s  .  c  o m

    this.registerPart(this.rectangle, zIndex);
    this.registerPart(this.textFlow, zIndex);
    this.registerActionHandler(this.rectangle);

    this.loadDimensionsFromJson(new JSONObject());

    this.setColor(Color.WHITE);

    this.setContent(null);
}

From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void createAccount(ListView<String> to_update) {
    Stage createAccountStage = new Stage();
    createAccountStage.initModality(Modality.APPLICATION_MODAL);

    //Set the stage info
    createAccountStage.setTitle("Add Server Account");

    //Create a layout
    GridPane gp = new GridPane();
    gp.setAlignment(Pos.CENTER);//from   w  ww .j av a  2 s.co m
    gp.setVgap(10);
    gp.setHgap(10);
    gp.setPadding(new Insets(25, 25, 25, 25));

    //Ads the important things
    Text welcome = new Text("Create Server Account");
    welcome.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(welcome, 0, 0, 2, 1);

    Label username = new Label("Username");
    Label password = new Label("Password");
    Label r_password = new Label("Repeat Password");

    TextField usernamefield = new TextField();
    PasswordField passwordfield = new PasswordField();
    PasswordField r_passwordfield = new PasswordField();

    gp.add(username, 0, 1);
    gp.add(password, 0, 2);
    gp.add(r_password, 0, 3);

    gp.add(usernamefield, 1, 1);
    gp.add(passwordfield, 1, 2);
    gp.add(r_passwordfield, 1, 3);

    Text error = new Text("");
    HBox error_box = new HBox(10);
    error_box.setAlignment(Pos.CENTER);
    error_box.getChildren().add(error);
    gp.add(error_box, 0, 4, 2, 1);

    Button finish = new Button("Finish");
    finish.setDisable(true);
    HBox center_button = new HBox(10);
    center_button.setAlignment(Pos.CENTER);
    center_button.getChildren().add(finish);
    gp.add(center_button, 0, 5, 2, 1);

    ChangeListener name = new ChangeListener<String>() {

        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            finish.setDisable(true);
            if (usernamefield.getText().equals("")) {
                error.setFill(Color.RED);
                error.setText("Username can not be blank!");
            }
            if (!passwordfield.getText().equals(r_passwordfield.getText())) {
                error.setFill(Color.RED);
                error.setText("Passwords do not match!");
            }
            if (passwordfield.getText().equals("") && r_passwordfield.getText().equals("")) {
                error.setFill(Color.RED);
                error.setText("Passwords can not be blank!");
            }
            if (passwordfield.getText().equals(r_passwordfield.getText()) && !usernamefield.getText().equals("")
                    && !passwordfield.getText().equals("")) {
                error.setFill(Color.GREEN);
                error.setText("No issues.");
                finish.setDisable(false);
            }
        }

    };

    usernamefield.textProperty().addListener(name);
    passwordfield.textProperty().addListener(name);
    r_passwordfield.textProperty().addListener(name);

    finish.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent e) {

            users.remove(usernamefield.getText());
            users.add(usernamefield.getText());
            userpasswords.put(usernamefield.getText(), passwordfield.getText());
            to_update.setItems(FXCollections.observableArrayList(users));

            createAccountStage.close();
        }

    });

    //Creates the scene
    Scene scene = new Scene(gp, 300, 275);
    scene.getStylesheets().add(this.getClass().getResource("login_css.css").toExternalForm());

    createAccountStage.setScene(scene);
    createAccountStage.show();

}

From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void createBannedUser(ListView<String> to_update) {
    Stage createBannedUser = new Stage();
    createBannedUser.setTitle("Add Banned User");
    createBannedUser.initModality(Modality.APPLICATION_MODAL);

    GridPane gp = new GridPane();
    gp.setPadding(new Insets(25, 25, 25, 25));
    gp.setAlignment(Pos.CENTER);/*from w  w  w  .  j av a  2 s.c o m*/
    gp.setVgap(10);
    gp.setHgap(10);

    Text title = new Text("Add Banned Username");
    title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(title, 0, 0, 2, 1);

    Label newusername = new Label("Ban Username");
    TextField username = new TextField();
    gp.add(newusername, 0, 1);
    gp.add(username, 1, 1);

    Button finish = new Button("Finish");
    HBox finish_box = new HBox(10);
    finish_box.setAlignment(Pos.CENTER);
    finish_box.getChildren().add(finish);

    finish.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_usernames.remove(username.getText());
            banned_usernames.add(username.getText());
            to_update.setItems(FXCollections.observableArrayList(banned_usernames));
            createBannedUser.close();
        }

    });

    gp.add(finish_box, 0, 2, 2, 1);

    Scene sc = new Scene(gp, 300, 175);
    createBannedUser.setScene(sc);
    createBannedUser.show();
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualization.java

/** add a {@link Text} node to the leaf container for the decluttered axis
 * labels/*w w w.  j  a  v a  2s.c  o m*/
 *
 * @param labelText  the string to add
 * @param labelWidth the width of the space available for the text
 * @param labelX     the horizontal position in the partPane of the text
 * @param bold       true if the text should be bold, false otherwise
 */
private synchronized void assignLeafLabel(String labelText, double labelWidth, double labelX, boolean bold) {

    Text label = new Text(" " + labelText + " ");
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10));
    //position label accounting for width
    label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0);
    label.autosize();

    if (leafPane.getChildren().isEmpty()) {
        //just add first label
        leafPane.getChildren().add(label);
    } else {
        //otherwise don't actually add the label if it would intersect with previous label
        final Text lastLabel = (Text) leafPane.getChildren().get(leafPane.getChildren().size() - 1);

        if (!lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) {
            leafPane.getChildren().add(label);
        }
    }
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane.java

/**
 * add a {@link Text} node to the leaf container for the decluttered axis
 * labels/*from  w w w .j a v  a2 s. c om*/
 *
 * @param labelText  the string to add
 * @param labelWidth the width of the space available for the text
 * @param labelX     the horizontal position in the partPane of the text
 * @param bold       true if the text should be bold, false otherwise
 */
private synchronized void assignLeafLabel(String labelText, double labelWidth, double labelX, boolean bold) {

    Text label = new Text(" " + labelText + " "); //NOI18N
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10));
    //position label accounting for width
    label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0);
    label.autosize();

    if (leafPane.getChildren().isEmpty()) {
        //just add first label
        leafPane.getChildren().add(label);
    } else {
        //otherwise don't actually add the label if it would intersect with previous label
        final Text lastLabel = (Text) leafPane.getChildren().get(leafPane.getChildren().size() - 1);

        if (!lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) {
            leafPane.getChildren().add(label);
        }
    }
}

From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void createBannedIP(ListView<String> to_update) {
    Stage createBannedIP = new Stage();
    createBannedIP.setTitle("Add Banned IP");
    createBannedIP.initModality(Modality.APPLICATION_MODAL);

    GridPane gp = new GridPane();
    gp.setPadding(new Insets(25, 25, 25, 25));
    gp.setAlignment(Pos.CENTER);/*from  w w  w  . j  a  va2s .com*/
    gp.setVgap(10);
    gp.setHgap(10);

    Text title = new Text("Add Banned IP");
    title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(title, 0, 0, 2, 1);

    Label newusername = new Label("Ban IP");
    TextField username = new TextField();
    gp.add(newusername, 0, 1);
    gp.add(username, 1, 1);

    Button finish = new Button("Finish");
    HBox finish_box = new HBox(10);
    finish_box.setAlignment(Pos.CENTER);
    finish_box.getChildren().add(finish);

    finish.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_ips.remove(username.getText());
            banned_ips.add(username.getText());
            to_update.setItems(FXCollections.observableArrayList(banned_ips));
            createBannedIP.close();
        }

    });

    gp.add(finish_box, 0, 2, 2, 1);

    Scene sc = new Scene(gp, 300, 175);
    createBannedIP.setScene(sc);
    createBannedIP.show();
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractTimelineChart.java

/**
 * Add a Text Node to the specific label container for the decluttered axis
 * labels./*  w  ww.jav  a  2  s.  c  o m*/
 *
 * @param labelText  The String to add.
 * @param labelWidth The width, in pixels, of the space available for the
 *                   text.
 * @param labelX     The horizontal position, in pixels, in the specificPane
 *                   of the text.
 * @param bold       True if the text should be bold, false otherwise.
 */
private synchronized void addSpecificLabel(String labelText, double labelWidth, double labelX, boolean bold) {
    Text label = new Text(" " + labelText + " "); //NON-NLS
    label.setTextAlignment(TextAlignment.CENTER);
    label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10));
    //position label accounting for width
    label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0);
    label.autosize();

    if (specificLabelPane.getChildren().isEmpty()) {
        //just add first label
        specificLabelPane.getChildren().add(label);
    } else {
        //otherwise don't actually add the label if it would intersect with previous label

        final Node lastLabel = specificLabelPane.getChildren().get(specificLabelPane.getChildren().size() - 1);

        if (false == lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) {
            specificLabelPane.getChildren().add(label);
        }
    }
}

From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void createBannedPlayername(ListView<String> to_update) {
    Stage createBannedPlayername = new Stage();
    createBannedPlayername.setTitle("Add Banned Playername");
    createBannedPlayername.initModality(Modality.APPLICATION_MODAL);

    GridPane gp = new GridPane();
    gp.setPadding(new Insets(25, 25, 25, 25));
    gp.setAlignment(Pos.CENTER);//from w ww.j av  a2s.  com
    gp.setVgap(10);
    gp.setHgap(10);

    Text title = new Text("Add Banned Playername");
    title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(title, 0, 0, 2, 1);

    Label newusername = new Label("Ban Playername");
    TextField username = new TextField();
    gp.add(newusername, 0, 1);
    gp.add(username, 1, 1);

    Button finish = new Button("Finish");
    HBox finish_box = new HBox(10);
    finish_box.setAlignment(Pos.CENTER);
    finish_box.getChildren().add(finish);

    finish.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_playernames.remove(username.getText());
            banned_playernames.add(username.getText());
            to_update.setItems(FXCollections.observableArrayList(banned_playernames));
            createBannedPlayername.close();
        }

    });

    gp.add(finish_box, 0, 2, 2, 1);

    Scene sc = new Scene(gp, 300, 175);
    createBannedPlayername.setScene(sc);
    createBannedPlayername.show();
}