实现基本功能
This commit is contained in:
26
src/com/dayrain/style/ButtonFactory.java
Normal file
26
src/com/dayrain/style/ButtonFactory.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.dayrain.style;
|
||||
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.Background;
|
||||
import javafx.scene.layout.BackgroundFill;
|
||||
import javafx.scene.layout.CornerRadii;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.Font;
|
||||
|
||||
public class ButtonFactory {
|
||||
|
||||
public static Button getButton(String text) {
|
||||
|
||||
BackgroundFill bgf = new BackgroundFill(Paint.valueOf("#145b7d"), new CornerRadii(10), new Insets(5));
|
||||
Button button = new Button();
|
||||
button.setText(text);
|
||||
button.setPrefWidth(100);
|
||||
button.setPrefHeight(50);
|
||||
button.setFont(Font.font("Microsoft YaHei",15));
|
||||
button.setTextFill(Color.WHITE);
|
||||
button.setBackground(new Background(bgf));
|
||||
return button;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user