java drawnum_Java Text.setFont方法代碼示例

本文整理匯總了Java中javafx.scene.text.Text.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java Text.setFont方法的具體用法?Java Text.setFont怎麽用?Java Text.setFont使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.text.Text的用法示例。

在下文中一共展示了Text.setFont方法的19個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: start

​點讚 4

import javafx.scene.text.Text; //導入方法依賴的package包/類

@Override

public void start(Stage primaryStage) throws Exception {

primaryStage.setOnShowing(event -> uiHandlers.onShow());

BorderPane border = new BorderPane();

hbox = new HBox();

border.setTop(hbox);

hbox.setMinHeight(60);

hbox.setAlignment(Pos.CENTER_LEFT);

hbox.setBackground(new Background(new BackgroundFill(Color.web("#2196f3"), CornerRadii.EMPTY, Insets.EMPTY)));

hbox.setPadding(new Insets(10));

menu = new VBox();

menu.setPadding(new Insets(20, 0, 0, 0));

BorderStroke borderStroke = new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(0,1,0,0));

menu.setBorder(new Border(borderStroke));

menu.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));

menu.setMinWidth(50);

menu.setSpacing(20);

border.setLeft(menu);

primaryStage.setTitle("Todo list");

Text text = new Text("Todo List");

text.setFill(Color.WHITE);

text.setFont(Font.font("Verdana", FontWeight.BOLD, 25));

center = new VBox();

center.setPadding(new Insets(20));

center.setSpacing(10);

Image image = new Image(getClass().getResourceAsStream("/add.png"));

Button add = new Button("", new ImageView(image));

add.setCursor(Cursor.HAND);

add.setBackground(Background.EMPTY);

add.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);

add.setOnAction(event -> uiHandlers.onCreate());

border.setCenter(center);

hbox.setPadding(new Insets(10, 10, 10, 10));

final Pane spacer = new Pane();

HBox.setHgrow(spacer, Priority.ALWAYS);

spacer.setMinSize(10, 1);

hbox.getChildren().addAll(text, spacer, add);

primaryStage.setScene(new Scene(border, 500, 500));

primaryStage.show();

}

開發者ID:GwtDomino,項目名稱:domino-todolist,代碼行數:51,

示例2: ColorPickerSample

​點讚 3

import javafx.scene.text.Text; //導入方法依賴的package包/類

public ColorPickerSample() {

final ColorPicker colorPicker = new ColorPicker(Color.GRAY);

ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

final Text coloredText = new Text("Colors");

Font font = new Font(53);

coloredText.setFont(font);

final Button coloredButton = new Button("Colored Control");

Color c = colorPicker.getValue();

coloredText.setFill(c);

coloredButton.setStyle(createRGBString(c));

colorPicker.setOnAction(new EventHandler() {

public void handle(Event t) {

Color newColor = colorPicker.getValue();

coloredText.setFill(newColor);

coloredButton.setStyle(createRGBString(newColor));

}

});

VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();

VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();

getChildren().add(outerVBox);

}

開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:26,

示例3: createElement

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

/**

* @param s

* @param i

* add an Element in the scroll

*/

private void createElement(Supplier s, int i){

HBox suppliersBox = new HBox();

suppliersBox.setOnMouseClicked(event -> {

for (int j=0; j

if(j % 2 == 1)

suppliers.getChildren().get(j).setStyle("-fx-background-color: #336699;");

else

suppliers.getChildren().get(j).setStyle("-fx-background-color: #0F355C;");

}

lastClickedValue = s;

updateDetail(s);

suppliersBox.setStyle("-fx-background-color: #ff6600;");

});

suppliersBox.setMinWidth(HomeView.TAB_CONTENT_W / 4);

suppliersBox.setPadding(new Insets(20));

Text supplierText = new Text(s.getName());

supplierText.setFont(new Font(20));

supplierText.setFill(Color.WHITE);

suppliersBox.getChildren().add(supplierText);

if (i % 2 == 1)

suppliersBox.setStyle("-fx-background-color: #336699;");

else

suppliersBox.setStyle("-fx-background-color: #0F355C;");

suppliers.getChildren().add(suppliersBox);

}

開發者ID:Moccko,項目名稱:campingsimulator2017,代碼行數:36,

示例4: drawSquare

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

/**

* Draw square on canvas with given message.

*

* @param message text to display in middle of square

* @param x upper left x of square

* @param y upper left y of square

* @param squareFill {@link Color} fill of background of square

* @param textFill {@link Color} fill of text in square

*/

private void drawSquare(final String message, final double x, final double y,

final Color squareFill, final Color textFill) {

graphicsContext.setStroke(squareFill);

graphicsContext.strokeRoundRect(x, y, SQUARE_WIDTH, SQUARE_HEIGHT, ARC_SIZE, ARC_SIZE);

final Text messageText = new Text(message);

messageText.setFont(graphicsContext.getFont());

final double textWidth = messageText.getBoundsInLocal().getWidth();

graphicsContext.setStroke(textFill);

graphicsContext.fillText(

message,

x + SQUARE_WIDTH / 2 - textWidth / 2,

y + SQUARE_HEIGHT * TEXT_HEIGHT_PORTION_OFFSET);

}

開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:25,

示例5: createNumber

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

private Text createNumber(String number, double layoutX, double layoutY) {

Text text = new Text(number);

text.setLayoutX(layoutX);

text.setLayoutY(layoutY);

text.setTextAlignment(TextAlignment.CENTER);

text.setFill(FILL_COLOR);

text.setFont(NUMBER_FONT);

return text;

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,

示例6: Mesazhi

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

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();

}

開發者ID:urankajtazaj,項目名稱:Automekanik,代碼行數:37,

示例7: init

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

private void init(Stage primaryStage) {

Group root = new Group();

primaryStage.setScene(new Scene(root));

final ColorPicker colorPicker = new ColorPicker(Color.GRAY);

ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

final Text coloredText = new Text("Colors");

Font font = new Font(53);

coloredText.setFont(font);

final Button coloredButton = new Button("Colored Control");

Color c = colorPicker.getValue();

coloredText.setFill(c);

coloredButton.setStyle(createRGBString(c));

colorPicker.setOnAction(new EventHandler() {

@Override

public void handle(ActionEvent t) {

Color newColor = colorPicker.getValue();

coloredText.setFill(newColor);

coloredButton.setStyle(createRGBString(newColor));

}

});

VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();

VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();

root.getChildren().add(outerVBox);

}

開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,

示例8: createIconContent

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

public static Node createIconContent() {

Text sample = new Text("FX");

sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));

sample.setStyle("-fx-font-size: 80px;");

sample.setFill(Color.web("#333333"));

final DropShadow dropShadow = new DropShadow();

dropShadow.setOffsetX(4);

dropShadow.setOffsetY(6);

dropShadow.setColor(Color.rgb(0,0,0,0.7));

sample.setEffect(dropShadow);

return sample;

}

開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:13,

示例9: draw

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

public void draw() {

// Draw elevator

Rectangle rgB = new Rectangle(WIDTH, HEIGHT);

rgB.setFill(Color.TRANSPARENT);

this.getChildren().add(rgB);

rgT = new Rectangle((WIDTH / 3) * 2 + (WIDTH / (WIDTH / 8)), HEIGHT / 1.5 + (HEIGHT / (HEIGHT / 4)));

rgT.setFill(Color.web("bfbfbf"));

rgT.setX(WIDTH / 2 - rgT.getWidth() / 2);

rgT.setY(HEIGHT - rgT.getHeight());

this.getChildren().add(rgT);

//Left side elevator shaft door

rgD1 = new Rectangle(WIDTH / 3, HEIGHT / 1.5);

rgD1.setFill(Color.web("a5a5a5"));

rgD1.setX(WIDTH / 2 - rgD1.getWidth());

rgD1.setY(HEIGHT - rgD1.getHeight());

this.getChildren().add(rgD1);

//Right side elevator shaft door

rgD2 = new Rectangle(WIDTH / 3, HEIGHT / 1.5);

rgD2.setFill(Color.web("a5a5a5"));

rgD2.setX(WIDTH / 2);

rgD2.setY(HEIGHT - rgD2.getHeight());

this.getChildren().add(rgD2);

// Draw text

tFloorNum = new Text(String.valueOf(FLOORNUM));

tFloorNum.setFill(Color.web("bfbfbf"));

tFloorNum.setFont(Font.font("Verdana", 20));

tFloorNum.setX(WIDTH / 2 - tFloorNum.getBoundsInParent().getWidth() / 2);

tFloorNum.setY(rgT.getY() - tFloorNum.getBoundsInParent().getHeight() / 2);

this.getChildren().add(tFloorNum);

}

開發者ID:spencerhendon,項目名稱:projectintern,代碼行數:35,

示例10: createPiece

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

public Node createPiece(int piece, int column, int row) {

StackPane pane = new StackPane();

Rectangle background = new Rectangle(0, 0, 60, 60);

background.setFill(((column + row) % 2) == 0 ? Color.WHITE : Color.GRAY);

pane.getChildren().add(background);

if (piece >=0 && piece < 8) {

Circle circle = new Circle(30, 30, 25);

if (piece / 4 == 1) {

circle.setStrokeWidth(3);

} else {

circle.setStrokeWidth(0);

}

if ((piece % 4) / 2 == 0) {

circle.setFill(Color.WHITE);

circle.setStroke(Color.BLACK);

} else {

circle.setFill(Color.BLACK);

circle.setStroke(Color.WHITE);

}

pane.getChildren().add(circle);

if ((piece % 4) % 2 == 1) {

Text text = new Text("♔");

text.setFont(new Font(32));

text.setFill(((piece % 4) / 2 == 0) ? Color.BLACK : Color.WHITE);

text.setBoundsType(TextBoundsType.VISUAL);

pane.getChildren().add(text);

}

}

return pane;

}

開發者ID:edwardxia,項目名稱:board-client,代碼行數:36,

示例11: PackageNodeView

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

public PackageNodeView(PackageNode node) {

super(node);

refNode = node;

title = new Text(node.getTitle());

title.setFont(Font.font("Verdana", FontWeight.BOLD, 12));

//TODO Ugly solution, hardcoded value.

title.setWrappingWidth(node.getWidth() - 7);

container = new VBox();

bodyStackPane = new StackPane();

container.setSpacing(0);

createRectangles();

container.getChildren().add(top);

bodyStackPane.getChildren().addAll(body, title);

container.getChildren().addAll(bodyStackPane);

StackPane.setAlignment(title, Pos.TOP_CENTER);

StackPane.setAlignment(top, Pos.CENTER_LEFT);

setTitleSize();

this.getChildren().add(container);

this.setTranslateX(node.getTranslateX());

this.setTranslateY(node.getTranslateY());

createHandles();

}

開發者ID:kaanburaksener,項目名稱:octoBubbles,代碼行數:28,

示例12: licencesp

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

private ScrollPane licencesp(double width, double height) {

ScrollPane sp = new ScrollPane();

Text text = new Text();

text.setX(width * 0.1);

text.setY(height * 0.1);

text.setFont(new Font(20));

text.setFill(new Color(1, 1, 1, 1));

StringBuilder licence = new StringBuilder(10000);

String line;

try {

BufferedReader br = new BufferedReader(new FileReader("data/common/licence.txt"));

while ((line = br.readLine()) != null) {

licence.append('\n');

licence.append(line);

}

br.close();

} catch (IOException e) {

log.error("Exception", e);

}

text.setText(licence.toString());

sp.setContent(text);

sp.setFitToHeight(true);

sp.setFitToWidth(true);

sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);

sp.setVmax(height);

// sp.setPrefSize(width*0.8, height*0.8);

return sp;

}

開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:40,

示例13: createIconContent

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

public static Node createIconContent() {

Text sample = new Text("FX");

sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,80));

sample.setStyle("-fx-font-size: 80px;");

sample.setFill(Color.web("#333333"));

final GaussianBlur GaussianBlur = new GaussianBlur();

GaussianBlur.setRadius(15);

sample.setEffect(GaussianBlur);

return sample;

}

開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:12,

示例14: prepareRatioGrid

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

/**

* Note that JavaFx GridPane uses (col, row) instead of (row, col)

*/

private void prepareRatioGrid() {

squidSpeciesList = squidProject.getTask().getSquidSpeciesModelList();

indexOfBackgroundSpecies = -1;

ratiosGridPane.getRowConstraints().clear();

RowConstraints rowCon = new RowConstraints();

rowCon.setPrefHeight(BUTTON_HEIGHT);

ratiosGridPane.getRowConstraints().add(rowCon);

ratiosGridPane.getColumnConstraints().clear();

ColumnConstraints colcon = new ColumnConstraints(BUTTON_WIDTH);

colcon.setPrefWidth(BUTTON_WIDTH);

colcon.setHalignment(HPos.CENTER);

ratiosGridPane.getColumnConstraints().add(colcon);

for (int i = 0; i < squidSpeciesList.size(); i++) {

if (squidSpeciesList.get(i).getIsBackground()) {

indexOfBackgroundSpecies = squidSpeciesList.get(i).getMassStationIndex();

squidProject.getTask().setIndexOfBackgroundSpecies(indexOfBackgroundSpecies);

Text colText = new Text(squidSpeciesList.get(i).getIsotopeName());

colText.setFont(Font.font("Courier New", FontWeight.BOLD, 12));

ratiosGridPane.add(colText, 0, i + 1);

Text rowText = new Text(squidSpeciesList.get(i).getIsotopeName());

rowText.setFont(Font.font("Courier New", FontWeight.BOLD, 12));

ratiosGridPane.add(rowText, i + 1, 0);

} else {

Button colButton = new SquidRowColButton(i, -1, squidSpeciesList.get(i).getIsotopeName());

ratiosGridPane.add(colButton, 0, i + 1);

Button rowButton = new SquidRowColButton(-1, i, squidSpeciesList.get(i).getIsotopeName());

ratiosGridPane.add(rowButton, i + 1, 0);

}

Label corLabel = new Label("ROW /\n COL");

corLabel.setFont(Font.font("Courier New", FontWeight.BOLD, 2));

corLabel.setStyle(

" -fx-font-family: \"Courier New\", \"Lucida Sans\", \"Segoe UI\", Helvetica, Arial, sans-serif;\n"

+ " -fx-font-weight: bold;\n"

+ " -fx-font-size: 7pt;\n"

);

corLabel.setWrapText(true);

ratiosGridPane.add(corLabel, 0, 0);

ratiosGridPane.getRowConstraints().add(rowCon);

ratiosGridPane.getColumnConstraints().add(colcon);

}

populateRatioGrid();

// center in window

double width = primaryStageWindow.getScene().getWidth();

ratiosGridPane.setLayoutX((width - (squidSpeciesList.size() + 1) * BUTTON_WIDTH) / 2.0);

ratiosGridPane.setLayoutY(15);

}

開發者ID:CIRDLES,項目名稱:Squid,代碼行數:64,

示例15: createTitle

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

private void createTitle(){

Text stepTitle = new Text(myResources.getString("CREATION_STEPS"));

stepTitle.setFont(new Font(20));

stepHolder = new VBox();

this.getChildren().addAll(stepTitle, stepHolder);

}

開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:7,

示例16: setKeyFormat

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

public void setKeyFormat(Text control){

control.prefWidth(controlLength);

control.setFont(Font.font(null, FontWeight.BOLD, 12));

control.setFill(Color.DARKGRAY);

control.setTextAlignment(TextAlignment.RIGHT);

}

開發者ID:ztan5,項目名稱:TechnicalAnalysisTool,代碼行數:7,

示例17: adjustTextSize

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

@SuppressWarnings( "AssignmentToMethodParameter" )

private void adjustTextSize( final Text textComponent, final double availableWidth, double fontSize ) {

final String fontName = textComponent.getFont().getName();

textComponent.setFont(new Font(fontName, fontSize));

while ( textComponent.getLayoutBounds().getWidth() > availableWidth && fontSize > 0 ) {

fontSize -= 0.005;

textComponent.setFont(new Font(fontName, fontSize));

}

}

開發者ID:ESSICS,項目名稱:KNOBS,代碼行數:17,

示例18: initGraphics

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

private void initGraphics() {

Font regularFont = Fonts.latoRegular(10);

Font lightFont = Fonts.latoLight(10);

seriesText = new Text("SERIES");

seriesText.setFill(_textColor);

seriesText.setFont(regularFont);

seriesNameText = new Text("-");

seriesNameText.setFill(_textColor);

seriesNameText.setFont(lightFont);

seriesSumText = new Text("SUM");

seriesSumText.setFill(_textColor);

seriesSumText.setFont(regularFont);

seriesValueText = new Text("-");

seriesValueText.setFill(_textColor);

seriesValueText.setFont(lightFont);

itemText = new Text("ITEM");

itemText.setFill(_textColor);

itemText.setFont(regularFont);

itemNameText = new Text("-");

itemNameText.setFill(_textColor);

itemNameText.setFont(lightFont);

valueText = new Text("VALUE");

valueText.setFill(_textColor);

valueText.setFont(regularFont);

itemValueText = new Text("-");

itemValueText.setFill(_textColor);

itemValueText.setFont(lightFont);

line = new Line(0, 0, 0, 56);

line.setStroke(_textColor);

VBox vBoxTitles = new VBox(2, seriesText, seriesSumText, itemText, valueText);

vBoxTitles.setAlignment(Pos.CENTER_LEFT);

VBox.setMargin(itemText, new Insets(3, 0, 0, 0));

VBox vBoxValues = new VBox(2, seriesNameText, seriesValueText, itemNameText, itemValueText);

vBoxValues.setAlignment(Pos.CENTER_RIGHT);

VBox.setMargin(itemNameText, new Insets(3, 0, 0, 0));

HBox.setHgrow(vBoxValues, Priority.ALWAYS);

hBox = new HBox(5, vBoxTitles, line, vBoxValues);

hBox.setPrefSize(120, 69);

hBox.setPadding(new Insets(5));

hBox.setBackground(new Background(new BackgroundFill(_backgroundColor, new CornerRadii(3), Insets.EMPTY)));

hBox.setMouseTransparent(true);

getContent().addAll(hBox);

}

開發者ID:HanSolo,項目名稱:charts,代碼行數:57,

示例19: init

​點讚 2

import javafx.scene.text.Text; //導入方法依賴的package包/類

@SuppressWarnings("unchecked")

private void init(Stage primaryStage) {

scene= new Scene(vbox);

scene.getStylesheets().add(StudentsReports.class.getResource("att.css").toExternalForm());

primaryStage.setScene(scene);

vbox.setPadding(new Insets(12));

tableView = new TableView();

Button button = new Button("Refresh");

button.setOnAction(new EventHandler() {

public void handle(ActionEvent t) {

tableView.setItems(getAtt());

}

});

textname= new Text("ALL STUDENT REPORTS");

textname.setFont(Font.font("Andalus", FontPosture.REGULAR, 20));

idCol = new TableColumn<>();

idCol.setText("Id");

idCol.setMinWidth(110);

idCol.setCellValueFactory(new PropertyValueFactory<>("id"));

fnameCol = new TableColumn<>();

fnameCol.setText("First Name");

fnameCol.setMinWidth(200);

fnameCol.setCellValueFactory(new PropertyValueFactory<>("fname"));

lnamecol = new TableColumn<>();

lnamecol.setText("Last Name");

lnamecol.setMinWidth(150);

lnamecol.setCellValueFactory(new PropertyValueFactory<>("lname"));

admCol = new TableColumn<>();

admCol.setText("School Id");

admCol.setMinWidth(170);

admCol.setCellValueFactory(new PropertyValueFactory<>("adm"));

addressCol = new TableColumn<>();

addressCol.setText("Address");

addressCol.setMinWidth(170);

addressCol.setCellValueFactory(new PropertyValueFactory<>("address"));

townCol = new TableColumn<>();

townCol.setText("Town");

townCol.setMinWidth(150);

townCol.setCellValueFactory(new PropertyValueFactory<>("town"));

phoneCol = new TableColumn<>();

phoneCol.setText("Phone");

phoneCol.setMinWidth(150);

phoneCol.setCellValueFactory(new PropertyValueFactory<>("phone"));

tableView.getColumns().addAll(idCol, fnameCol,lnamecol,admCol,phoneCol, addressCol, townCol);

tableView.setItems(getAtt());

txtsearch= new TextField();

initFilter();

att=getAtt();

tableView.setItems(FXCollections.observableArrayList(att));

HBox layt= new HBox();

layt.getChildren().add(textname);

layt.setAlignment(Pos.CENTER);

HBox layre= new HBox();

layre.getChildren().add(txtsearch);

layre.setAlignment(Pos.TOP_LEFT);

vbox.getChildren().addAll(layt, layre, tableView, button);

vbox.setId("vb");

}

開發者ID:mikemacharia39,項目名稱:gatepass,代碼行數:74,

注:本文中的javafx.scene.text.Text.setFont方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
写出以下代码的函数说明:# 界面初始化,设置界面布局 def initUI(self): main_widget = QWidget() main_layout = QHBoxLayout() font = QFont('楷体', 15) # 主页面,设置组件并将组件放在布局上 left_widget = QWidget() left_layout = QVBoxLayout() img_title = QLabel("样本") img_title.setFont(font) img_title.setAlignment(Qt.AlignCenter) self.img_label = QLabel() img_init = cv2.imread(self.to_predict_name) h, w, c = img_init.shape scale = 400 / h img_show = cv2.resize(img_init, (0, 0), fx=scale, fy=scale) cv2.imwrite("images/show.png", img_show) img_init = cv2.resize(img_init, (224, 224)) cv2.imwrite('images/target.png', img_init) self.img_label.setPixmap(QPixmap("images/show.png")) left_layout.addWidget(img_title) left_layout.addWidget(self.img_label, 1, Qt.AlignCenter) left_widget.setLayout(left_layout) right_widget = QWidget() right_layout = QVBoxLayout() btn_change = QPushButton(" 上传图片 ") btn_change.clicked.connect(self.change_img) btn_change.setFont(font) btn_predict = QPushButton(" 开始识别 ") btn_predict.setFont(font) btn_predict.clicked.connect(self.predict_img) label_result_f = QLabel(' 花卉名称 ') self.result_f = QLabel("等待识别") self.label_info = QTextEdit() self.label_info.setFont(QFont('楷体', 12)) label_result_f.setFont(QFont('楷体', 16)) self.result_f.setFont(QFont('楷体', 24)) right_layout.addStretch() right_layout.addWidget(label_result_f, 0, Qt.AlignCenter) right_layout.addStretch() right_layout.addWidget(self.result_f, 0, Qt.AlignCenter) right_layout.addStretch() right_layout.addWidget(self.label_info, 0, Qt.AlignCenter) right_layout.addStretch() right_layout.addWidget(btn_change) right_layout.addWidget(btn_predict) right_layout.addStretch() right_widget.setLayout(right_layout)
最新发布
06-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值