Java Code Examples for javafx.scene.control.Button.setFont()

The following are Jave code examples for showing how to use setFont() of the javafx.scene.control.Button class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Gleisbelegung   File: Gleis.java   Source Code and License Vote up 7 votes
private void aendereReihenfolge(){
    Stage stage = new Stage();

    Label l = new Label("Reihenfolge festlegen:");
    l.setStyle("-fx-text-fill: white");
    l.setFont(Font.font(settingsFontSize));
    l.setTranslateY(25);
    l.setTranslateX(25);

    TextField tf = new TextField(String.valueOf(orderId+1));
    tf.setFont(Font.font(settingsFontSize-3));
    tf.setTranslateX(25);
    tf.setTranslateY(60);

    Button b = new Button("Speichern");
    b.setFont(Font.font(settingsFontSize));
    b.setTranslateX(25);
    b.setTranslateY(120);
    b.setOnAction(e -> {
        orderId = Integer.parseInt(tf.getText())-1;
        stage.close();
        Plugin_Gleisbelegung.sortiereGleiseListener();
    });

    Pane p = new Pane(l,tf,b);
    p.setStyle("-fx-background-color: #303030");
    p.setMinSize(500,200);
    p.setMaxSize(500, 200);

    Scene scene = new Scene(p, 300,200);

    stage.setScene(scene);
    stage.show();
    stage.setAlwaysOnTop(true);
}
 
Example 2
Project: fwm   File: WorldSelector.java   Source Code and License Vote up 6 votes
@FXML
public void addNewWorld(){
	final File f = new File(AppConfig.getWorldsLocation() + newWorldName.getText());
	f.mkdirs();
	
	Button cur = new Button(f.getName());
	cur.setOnAction(new EventHandler<ActionEvent>(){
		public void handle(ActionEvent event) {
			selectedFile = new File(AppConfig.getWorldsLocation() + f.getName());
			closeWindow();
		}
	});
	cur.setFont(bFont);
	cur.minWidthProperty().bind(worlds.widthProperty().subtract(10));
	worlds.getChildren().add(cur);
}
 
Example 3
Project: fwm   File: WorldSelector.java   Source Code and License Vote up 5 votes
public void start(Stage primaryStage, VBox v, ComponentSelectorController ds) {
	started = true;
	this.primaryStage = primaryStage;
	Scene myScene = new Scene(v);
	primaryStage.setScene(myScene);
	this.ds = ds;
	try{
		File f = new File(AppConfig.getWorldsLocation());
		if(!f.exists()){
			f.mkdirs();
		}
		DirectoryStream<Path> stream = Files.newDirectoryStream(f.toPath());
		List<String> files = new ArrayList<String>();
		for(Path p: stream){
			try{
				files.add(p.getFileName().toString());
			}catch(NumberFormatException e){
				log.error(e);
			}
		}
		
		for(final String filename: files){
			Button cur = new Button(filename);
			cur.setOnAction(new EventHandler<ActionEvent>(){
				public void handle(ActionEvent event) {
					selectedFile = new File(AppConfig.getWorldsLocation() + filename);
					closeWindow();
				}
			});
			cur.setFont(bFont);
			cur.minWidthProperty().bind(worlds.widthProperty().subtract(10));
			worlds.getChildren().add(cur);
		}
	}catch(IOException ex){
		log.error(ex);
	}
	primaryStage.show();
}
 
Example 4
Project: Gleisbelegung   File: Plugin_Gleisbelegung.java   Source Code and License Vote up 5 votes
private void openLogWindow(){
    Stage stage = new Stage();

    //Label l = new Label("Während deiner aktuellen Sitzung sind Fehler aufgetreten. Durch einen Klick auf Weiter werden deine Log-Datei und deine Anregungen anonym hochgeladen.");
    Label l = new Label("Während deiner aktuellen Sitzung sind Fehler aufgetreten. Durch einen Klick auf Weiter wird deine Log-Datei anonym hochgeladen.");
    l.setStyle("-fx-text-fill: white");
    l.setFont(Font.font(settingsFontSize));
    l.setWrapText(true);
    l.setMaxWidth(450);
    l.setTranslateY(25);
    l.setTranslateX(25);

    /*TextField ta = new TextField();
    ta.setFont(Font.font(settingsFontSize-3));
    ta.setTranslateX(25);
    ta.setTranslateY(125);
    ta.setPrefWidth(450);
    ta.setPrefHeight(100);*/


    Button bno = new Button("Abbrechen");
    bno.setFont(Font.font(settingsFontSize));
    bno.setOnAction(e -> stage.close());
    bno.setTranslateX(250);
    bno.setTranslateY(150);

    Button byes = new Button("Weiter");
    byes.setFont(Font.font(settingsFontSize));
    byes.setTranslateX(150);
    byes.setTranslateY(150);
    byes.setOnAction(e -> {
        byes.setDisable(true);
        bno.setDisable(true);

        Runnable r = () -> {
            sendLogFile(l);
        };
        new Thread(r).start();
    });

    Pane p = new Pane(l, byes, bno);
    p.setStyle("-fx-background-color: #303030");
    p.setMinSize(500,200);
    p.setMaxSize(500, 200);

    Scene s = new Scene(p,500,200);


    stage.setScene(s);
    stage.setTitle("Log-Datei senden?");

    stage.setAlwaysOnTop(true);
    stage.show();
}