本文整理匯總了Java中javafx.scene.text.Text.setStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java Text.setStyle方法的具體用法?Java Text.setStyle怎麽用?Java Text.setStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.text.Text
的用法示例。
在下文中一共展示了Text.setStyle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createIconContent
import javafx.scene.text.Text; //導入方法依賴的package包/類
public static Node createIconContent() {
Text htmlStart = new Text("<html>");
Text htmlEnd = new Text("</html>");
htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
htmlStart.setStyle("-fx-font-size: 20px;");
htmlStart.setTextOrigin(VPos.TOP);
htmlStart.setLayoutY(11);
htmlStart.setLayoutX(20);
htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
htmlEnd.setStyle("-fx-font-size: 20px;");
htmlEnd.setTextOrigin(VPos.TOP);
htmlEnd.setLayoutY(31);
htmlEnd.setLayoutX(20);
return new Group(htmlStart, htmlEnd);
}
示例2: createIconContent
import javafx.scene.text.Text; //導入方法依賴的package包/類
public static Node createIconContent() {
Text text = new Text("abc");
text.setTextOrigin(VPos.TOP);
text.setLayoutX(10);
text.setLayoutY(11);
text.setFill(Color.BLACK);
text.setOpacity(0.5);
text.setFont(Font.font(null, FontWeight.BOLD, 20));
text.setStyle("-fx-font-size: 20px;");
Text text2 = new Text("abc");
text2.setTextOrigin(VPos.TOP);
text2.setLayoutX(28);
text2.setLayoutY(51);
text2.setFill(Color.BLACK);
text2.setFont(javafx.scene.text.Font.font(null, FontWeight.BOLD, 20));
text2.setStyle("-fx-font-size: 20px;");
Line line = new Line(30, 32, 45, 57);
line.setStroke(Color.DARKMAGENTA);
return new javafx.scene.Group(text, line, text2);
}
示例3: getMessageBar
import javafx.scene.text.Text; //導入方法依賴的package包/類
private Node getMessageBar(VBox vbox) {
HBox hb = new HBox(10);
hb.setPrefHeight(32);
hb.setStyle("-fx-padding: 0 5px 0 5px; -fx-background-color: " + _message_bg + ";");
CheckBox cb = new CheckBox("Do Not Show Again");
cb.setStyle("-fx-text-fill: " + _message_fg + ";-fx-fill: " + _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(_message);
hb.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(t, Priority.ALWAYS);
t.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;");
b.setStyle("-fx-fill: " + _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;
}
示例4: _showMessageDialog
import javafx.scene.text.Text; //導入方法依賴的package包/類
public static void _showMessageDialog(Window parent, String message, String title, AlertType type, boolean monospace) {
Alert alert = new Alert(type);
alert.initOwner(parent);
alert.setTitle(title);
alert.setHeaderText(title);
alert.setContentText(message);
alert.initModality(Modality.APPLICATION_MODAL);
alert.setResizable(true);
if (monospace) {
Text text = new Text(message);
alert.getDialogPane().setStyle("-fx-padding: 0 10px 0 10px;");
text.setStyle(" -fx-font-family: monospace;");
alert.getDialogPane().contentProperty().set(text);
}
alert.showAndWait();
}
示例5: add_row
import javafx.scene.text.Text; //導入方法依賴的package包/類
/**
* Create a row with text and radio buttons
* @param name of the row
* @param i iterator
*/
private void add_row(String name, int i){
Text text = new Text(name);
text.setStyle("-fx-font-weight: bold;" +
"-fx-font-size: 17px");
text.setFill(Color.WHITESMOKE);
gridPane.add(text, 0, i+1);
RadioButton readButton = new RadioButton();
GridPane.setHalignment(readButton, HPos.CENTER);
gridPane.add(readButton, 1,i+1);
RadioButton editButton = new RadioButton();
GridPane.setHalignment(editButton, HPos.CENTER);
gridPane.add(editButton, 2, i+1);
editButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
readButton.setSelected(true);
}
});
radioButtonArrayList.add(readButton);
radioButtonArrayList.add(editButton);
}
示例6: createIconContent
import javafx.scene.text.Text; //導入方法依賴的package包/類
public static Node createIconContent() {
Text sample = new Text("FX");
sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,60));
sample.setStyle("-fx-font-size: 80px;");
sample.setFill(Color.web("#333333"));
final Reflection reflection = new Reflection();
reflection.setTopOffset(-28d);
reflection.setFraction(0.5);
sample.setEffect(reflection);
return sample;
}
示例7: createIconContent
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("#aaaaaa"));
final InnerShadow innerShadow = new InnerShadow();
innerShadow.setRadius(4);
innerShadow.setOffsetX(1);
innerShadow.setOffsetY(1);
innerShadow.setColor(Color.web("#333333"));
sample.setEffect(innerShadow);
return sample;
}
示例8: createIconContent
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;
}
示例9: createIconContent
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;
}
示例10: add_line
import javafx.scene.text.Text; //導入方法依賴的package包/類
private void add_line(String name, int i, Float value){
Text text = new Text(name);
text.setStyle("-fx-font-weight: bold;" +
"-fx-font-size: 17px");
text.setFill(Color.WHITESMOKE);
gridPane.add(text, 0, i);
Text textValue = new Text("(" + value.toString() + "%)");
textValue.setStyle("-fx-font-weight: bold;" +
"-fx-font-size: 17px");
textValue.setFill(Color.WHITESMOKE);
gridPane.add(textValue, 1, i);
RadioButton radioButton = new RadioButton();
GridPane.setHalignment(radioButton, HPos.CENTER);
gridPane.add(radioButton, 2, i);
if(value != 0 && value.equals(default_reduc))
radioButton.setSelected(true);
radioButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
for (int i = 0; i < reductionsArrayList.size(); i++){
for (Map.Entry<Text, Pair<RadioButton, Float>> entry : reductionsArrayList.get(i).entrySet()){
if(entry.getValue().getKey().isSelected())
entry.getValue().getKey().setSelected(false);
}
}
radioButton.setSelected(true);
}
});
Pair<RadioButton, Float> pair = new Pair<>(radioButton, value);
Map<Text, Pair<RadioButton, Float>> map = new HashMap<>();
map.put(text, pair);
reductionsArrayList.add(map);
}
示例11: onStart
import javafx.scene.text.Text; //導入方法依賴的package包/類
@Override
public void onStart() {
stuffBox.prefWidthProperty().bind(Main.mainController.contentBox.widthProperty());
stuffBox.prefHeightProperty().bind(Main.mainController.contentBox.heightProperty());
if (credits.getChildren().isEmpty()) {
String yearString = "2017";
int year = Calendar.getInstance().get(Calendar.YEAR);
if (year > 2017) {
yearString += "-" + year;
}
Text text = new Text("©" + yearString + " - HEARTH PROJECT");
text.setStyle("-fx-fill: #FFFFFF; -fx-font-family: 'Lato', sans-serif; -fx-font-size: 12;");
Hyperlink hyperlink = new Hyperlink("http://hearthproject.uk/");
hyperlink.setStyle("-fx-text-fill: #FFFFFF; -fx-font-family: 'Lato', sans-serif; -fx-font-size: 12;");
hyperlink.setOnAction(e -> openHearthSite());
hyperlink.focusTraversableProperty().setValue(false);
Text creditsText = new Text("\nCredits:");
creditsText.setStyle("-fx-fill: #FFFFFF; -fx-font-family: 'Lato', sans-serif; -fx-font-size: 14; -fx-font-weight: bold");
credits.getChildren().addAll(text, hyperlink, creditsText);
addCredit("modmuss50 - Lead Developer", "https://twitter.com/modmuss50");
addCredit("Prospector - UX Manager", "https://twitter.com/ProfProspector");
addCredit("primetoxinz - Various Contributions", "https://github.com/primetoxinz");
addCredit("loading.io - Splash Loading .gif", "https://loading.io/");
addCredit("Yannick - Home, About, Download, Instances, and Update icons", "https://www.flaticon.com/authors/yannick");
addCredit("Gregor Cresnar - Package icon", "https://www.flaticon.com/authors/gregor-cresnar");
addCredit("Egor Rumyantsev - Settings icon", "https://www.flaticon.com/authors/egor-rumyantsev");
addCredit("Icomoon - Log Out icon", "https://www.flaticon.com/authors/icomoon");
}
}
示例12: ocrStart
import javafx.scene.text.Text; //導入方法依賴的package包/類
@FXML
protected void ocrStart() {
try {
Text text1 = new Text(ocrObj.init());
text1.setStyle("-fx-font-size: 14; -fx-fill: blue;");
ocr.getChildren().add(text1);
} catch (FontFormatException e) {
e.printStackTrace();
}
}
示例13: Balloon
import javafx.scene.text.Text; //導入方法依賴的package包/類
Balloon(String id, String text) {
instance=this;
bubbleShadow.setRadius(10.0);
bubbleShadow.setOffsetX(1.5);
bubbleShadow.setOffsetY(2.5);
bubbleShadow.setColor(Color.color(0, 0, 0, Main.getProperties().getFloat("balloon.shadow-opacity", 1.0f)));
Text label = new Text("");
label.setStyle("-fx-alignment: center; -fx-text-alignment: center; -fx-content-display: center;");
label.setTextAlignment(TextAlignment.CENTER);
label.setWrappingWidth(300);
if (defaultFont != null) {
label.setFont(defaultFont);
} else {
label.setFont(LocalFont.defaultFont);
}
Integer animation_delay = Main.getProperties().getInteger("balloon.text-animation-delay", 50);
if (animation_delay > 0)
symbolsAdder = new SymbolsAdder(text, animation_delay);
else
label.setText(text);
content = label;
StackPane contentPane = new StackPane();
contentPane.getChildren().add(content);
bubblesGroup = new Group(bubbleShapes);
stackPane.getChildren().add(bubblesGroup);
stackPane.getChildren().add(contentPane);
StackPane.setMargin(content, margin);
setBalloonScaleFactor(Main.getProperties().getFloat("balloon.scale_factor", 100));
getChildren().add(stackPane);
setBalloonOpacity(Main.getProperties().getFloat("balloon.opacity", 100));
setOnMousePressed(event -> {
lastClick = System.currentTimeMillis();
if ((positionMode != PositionMode.AUTO) && event.getButton().equals(MouseButton.PRIMARY)) {
startDrag(event);
}
});
setOnMouseReleased(event -> {
if(!isDragging() && event.getButton().equals(MouseButton.PRIMARY) && (System.currentTimeMillis()-lastClick)<200) {
if (character != null) {
character.say(null);
} else {
close();
}
}
});
setOnMouseEntered(event -> {
if (character != null && timeoutTimeline != null) {
timeoutTimeline.stop();
}
});
setOnMouseExited(event -> {
if (character != null && timeoutTimeline != null) {
timeoutTimeline.play();
}
});
mouseEventNotificator
.setOnClickListener()
.setOnMovedListener()
// TODO: Figure out how to write more precise check.
.setOnScrollListener(event -> true);
}
示例14: ConfigDialogPane
import javafx.scene.text.Text; //導入方法依賴的package包/類
/**
* <p>
* Creates the view for a config dialog.
* </p>
*
* <p>
* Text fields and checkboxes have to be initialized from a
* {@link edu.kit.iti.formal.stvs.model.config.GlobalConfig} model. For that, use the
* {@link ConfigDialogManager}.
* </p>
*/
public ConfigDialogPane() {
verificationTimeout = new PositiveIntegerInputField();
simulationTimeout = new PositiveIntegerInputField();
editorFontSize = new PositiveIntegerInputField();
editorFontFamily = new TextField();
showLineNumbers = new CheckBox();
uiLanguage = new ComboBox<>();
nuxmvFilename = new FileSelectionField();
z3Path = new FileSelectionField();
getetaCommand = new TextField();
maxLineRollout = new PositiveIntegerInputField();
okButtonType = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE);
this.getButtonTypes().addAll(okButtonType, ButtonType.CANCEL);
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 10, 10, 10));
grid.add(new Label("Verification Timeout"), 0, 0);
grid.add(verificationTimeout, 1, 0);
grid.add(new Label("Simulation Timeout"), 0, 1);
grid.add(simulationTimeout, 1, 1);
grid.add(new Label("Editor Fontsize"), 0, 2);
grid.add(editorFontSize, 1, 2);
grid.add(new Label("Editor Font Family"), 0, 3);
grid.add(editorFontFamily, 1, 3);
grid.add(new Label("Show Line Numbers"), 0, 4);
grid.add(showLineNumbers, 1, 4);
grid.add(new Label("User Interface Language"), 0, 5);
grid.add(uiLanguage, 1, 5);
grid.add(new Label("Path to NuXmv Executable"), 0, 6);
grid.add(nuxmvFilename, 1, 6);
grid.add(new Label("Path to Z3"), 0, 7);
grid.add(z3Path, 1, 7);
grid.add(new Label("GeTeTa Command"), 0, 9);
grid.add(getetaCommand, 1, 9);
Text getetaCommandDescription =
new Text("Use ${code} and ${spec} for code and specification" + " filename substitution.");
getetaCommandDescription.setStyle("-fx-font-style: italic");
grid.add(getetaCommandDescription, 0, 10, 2, 1);
grid.add(new Label("Maximum Number of Rollouts per Line"), 0, 11);
grid.add(maxLineRollout, 1, 11);
this.setContent(grid);
ViewUtils.setupClass(this);
}
示例15: styleText
import javafx.scene.text.Text; //導入方法依賴的package包/類
void styleText(Text text, double size){
text.setFont(Font.font("Calibri", FontWeight.BLACK, size));
text.setStyle("-fx-fill: white; -fx-stroke: black; -fx-stroke-width: " + size/30 + "px");
}