Java 类javafx.scene.text.TextFlow 实例源码
项目:jrfl
文件:Colors.java
/**
* @param text Text
* @return Parsed text
*/
public static TextFlow parse(String text) throws JrflColorException {
boolean startsWithColor = text.startsWith(COLOR_CHAR);
TextFlow flow = new TextFlow();
String[] parts = text.split(COLOR_CHAR);
for(int i = 0; i<parts.length; i++) {
String part = parts[i];
if(part.length() > 0) {
String value = part.charAt(0) + "";
if(startsWithColor || i > 0) part = part.substring(1);
if(!(!startsWithColor && i == 0) && !isValid(value.charAt(0))) throw new JrflColorException(value.charAt(0));
Paint paint = Paint.valueOf(!startsWithColor && i == 0 ? Jrfl.ACTIVE_STYLE.getConfiguration().get("text.color") : colors.get(COLOR_CHAR + value));
Text label = new Text(part);
label.setFill(paint);
flow.getChildren().add(label);
}
}
return flow;
}
项目:CORNETTO
文件:MainStageController.java
@FXML
/**
*
* Shows information about the software.
*/ private void showAboutAlert() {
Hyperlink hyperlink = new Hyperlink();
hyperlink.setText("https://github.com/jmueller95/CORNETTO");
Text text = new Text("Cornetto is a modern tool to visualize and calculate correlations between" +
"samples.\nIt was created in 2017 by students of the group of Professor Huson in Tübingen.\nThe group" +
"was supervised by Caner Bagci.\n\n" +
"This project is licensed under the MIT License.\n\n" +
"For more information go to: ");
TextFlow textFlow = new TextFlow(text, hyperlink);
text.setWrappingWidth(500);
aboutAlert = new Alert(Alert.AlertType.INFORMATION);
aboutAlert.setTitle("About " + GlobalConstants.NAME_OF_PROGRAM);
aboutAlert.setHeaderText("What is " + GlobalConstants.NAME_OF_PROGRAM);
aboutAlert.getDialogPane().setContent(textFlow);
aboutAlert.show();
}
项目:voogasalad-ltub
文件:GameStatsView.java
private void makeStatsPane(Map<String, String> stats) {
myStats = new VBox(5);
for(String statName : stats.keySet()){
Text nameAndValue = new Text(statName + ": " + stats.get(statName));
//TODO: set text size
TextFlow wrapper = new TextFlow(nameAndValue);
wrapper.setTextAlignment(TextAlignment.LEFT);
wrapper.getStylesheets().add("resources/socialStyle.css");
wrapper.getStyleClass().add("textfill");
myStats.getChildren().add(wrapper);
}
myStats.getStylesheets().add("resources/socialStyle.css");
myStats.getStyleClass().add("statsbox");
}
项目:tenhou-visualizer
文件:AppController.java
public void showAbout(ActionEvent actionEvent) throws URISyntaxException {
Dialog<Void> dialog = new Dialog<>();
dialog.setTitle("Tenhou Visualizer について");
dialog.initOwner(this.root.getScene().getWindow());
dialog.getDialogPane().getStylesheets().add(this.getClass().getResource(Main.properties.getProperty("css")).toExternalForm());
dialog.getDialogPane().setGraphic(new ImageView(new Image("/logo.png")));
dialog.getDialogPane().setHeaderText("TenhouVisualizer v0.3");
final Hyperlink oss = new Hyperlink("open-source software");
final URI uri = new URI("https://crazybbb.github.io/tenhou-visualizer/thirdparty");
oss.setOnAction(e -> {
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
throw new UncheckedIOException(e1);
}
});
dialog.getDialogPane().setContent(new TextFlow(new Label("Powered by "), oss));
dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
dialog.showAndWait();
}
项目:pattypan
文件:LoginPane.java
private void setContent() {
TextFlow flow = new TextFlow(new Text(Util.text("login-intro")), link);
flow.setTextAlignment(TextAlignment.CENTER);
addElement(flow);
addElement(loginText);
addElement(passwordText);
addElement(loginButton);
addElement(loginStatus);
if (!Settings.getSetting("user").isEmpty()) {
loginText.setText(Settings.getSetting("user"));
Platform.runLater(() -> {
passwordText.requestFocus();
});
}
}
项目:pattypan
文件:CreateFilePane.java
private void showOpenFileButton() {
Hyperlink link = new Hyperlink(Util.text("create-file-open"));
TextFlow flow = new TextFlow(new WikiLabel("create-file-success"), link);
flow.setTextAlignment(TextAlignment.CENTER);
addElement(flow);
link.setOnAction(ev -> {
try {
Desktop.getDesktop().open(Session.FILE);
} catch (IOException ex) {
LOGGER.log(Level.WARNING,
"Cannot open file: {0}",
new String[]{ex.getLocalizedMessage()}
);
}
});
nextButton.linkTo("StartPane", stage, true).setText(Util.text("create-file-back-to-start"));
nextButton.setVisible(true);
}
项目:jstackfx
文件:ThreadListCellFactory.java
protected TextFlow buildThreadListGraphic(final TableCell<ThreadElement, Set<ThreadElement>> cell, final Set<ThreadElement> threads) {
final TextFlow threadsGraphic = new TextFlow();
threadsGraphic.setPrefHeight(20);
final Iterator<ThreadElement> threadIterator = threads.iterator();
while (threadIterator.hasNext()) {
final ThreadElement thread = threadIterator.next();
threadsGraphic.getChildren().add(buildThreadLink(cell, thread));
if (threadIterator.hasNext()) {
threadsGraphic.getChildren().add(buildThreadSeparator());
}
}
return threadsGraphic;
}
项目:openjfx-8u-dev-tests
文件:RichTextDifferentCasesApp.java
@Override
public Node drawNode() {
Pane root = new Pane();
root.setStyle("-fx-background-color: green;");
root.setPrefHeight(HEIGHT);
root.setPrefWidth(WIDTH);
root.setMinHeight(HEIGHT);
root.setMinWidth(WIDTH);
root.setMaxHeight(HEIGHT);
root.setMaxWidth(WIDTH);
TextFlow tf = new TextFlow();
tf.setStyle("-fx-border-color: red;-fx-background-color: white;");
tf.setPrefHeight(FLOW_HEIGHT);
tf.setPrefWidth(FLOW_WIDTH);
tf.setMinHeight(FLOW_HEIGHT - 30);
tf.setMinWidth(FLOW_WIDTH - 30);
tf.setMaxHeight(FLOW_HEIGHT + 30);
tf.setMaxWidth(FLOW_WIDTH + 30);
prepareCase(tf);
root.getChildren().add(tf);
return root;
}
项目:openjfx-8u-dev-tests
文件:RichTextDifferentCasesApp.java
@Override
protected void prepareCase(TextFlow tf) {
for (int i = 0; i < 8; i++) {
Rectangle rect = new Rectangle();
rect.setHeight(FLOW_HEIGHT - 30);
rect.setWidth(20);
rect.setFill(Color.AQUA);
rect.setStroke(Color.BLUE);
tf.getChildren().add(rect);
if (i == 5) {
rect = new Rectangle();
rect.setHeight(FLOW_HEIGHT + 30);
rect.setWidth(100);
rect.setFill(Color.AQUA);
rect.setStroke(Color.BLUE);
tf.getChildren().add(rect);
}
}
}
项目:openjfx-8u-dev-tests
文件:RichTextDifferentCasesApp.java
@Override
protected void prepareCase(TextFlow tf) {
for (int i = 0; i < 8; i++) {
Rectangle rect = new Rectangle();
rect.setWidth(FLOW_WIDTH - 30);
rect.setHeight(20);
rect.setFill(Color.AQUA);
rect.setStroke(Color.BLUE);
tf.getChildren().add(rect);
if (i == 5) {
rect = new Rectangle();
rect.setHeight(100);
rect.setWidth(FLOW_WIDTH + 30);
rect.setFill(Color.AQUA);
rect.setStroke(Color.BLUE);
tf.getChildren().add(rect);
}
}
}
项目:openjfx-8u-dev-tests
文件:RichTextDifferentCasesApp.java
@Override
protected void prepareCase(TextFlow tf) {
tf.getChildren().add(new Rectangle(57, 10));
Rectangle rect = new Rectangle();
rect.setHeight(100);
rect.setWidth(FLOW_WIDTH - 60);
rect.setFill(Color.AQUA);
rect.setStroke(Color.BLUE);
tf.getChildren().add(rect);
tf.getChildren().add(new Rectangle(57, 10));
rect = new Rectangle();
rect.setHeight(100);
rect.setWidth(FLOW_WIDTH - 30);
rect.setFill(Color.AQUA);
rect.setStroke(Color.BLUE);
tf.getChildren().add(rect);
tf.getChildren().add(new Rectangle(57, 10));
}
项目:openjfx-8u-dev-tests
文件:RichTextDifferentCasesApp.java
@Override
protected void prepareCase(TextFlow tf) {
tf.getChildren().add(new Rectangle(60, 10));
Rectangle rect = new Rectangle();
rect.setHeight(FLOW_HEIGHT / 2 - 30);
rect.setWidth(30);
rect.setFill(Color.AQUA);
rect.setStroke(Color.BLUE);
tf.getChildren().add(rect);
tf.getChildren().add(new Text("\n"));
tf.getChildren().add(new Rectangle(140, 10));
rect = new Rectangle();
rect.setHeight(FLOW_HEIGHT / 2 - 30);
rect.setWidth(30);
rect.setFill(Color.AQUA);
rect.setStroke(Color.BLUE);
tf.getChildren().add(rect);
}
项目:openjfx-8u-dev-tests
文件:RichTextDifferentCasesApp.java
@Override
public Node drawNode() {
HBox testBox = new HBox();
Pane testPane = new StackPane(testBox);
testPane.setPrefHeight(HEIGHT);
testPane.setPrefWidth(WIDTH);
testPane.setMinHeight(HEIGHT);
testPane.setMinWidth(WIDTH);
testPane.setMaxHeight(HEIGHT);
testPane.setMaxWidth(WIDTH);
testPane.setStyle("-fx-background-color: green;");
testBox.setFillHeight(false);
addGrid(testBox, new Label("Etalon Label"));
addGrid(testBox, new TextFlow(new Text("Text in Flow")));
addGrid(testBox, new TextFlow(new Label("Label in Flow")));
addGrid(testBox, new TextFlow(new Button("Button in Flow")));
addGrid(testBox, new TextFlow(new Rectangle(100, 20)));
return testPane;
}
项目:helloiot
文件:TopicInfoEdit.java
@Override
public Node getGraphic() {
Text t = new Text();
t.setFill(Color.WHITE);
t.setFont(Font.font(ExternalFonts.ROBOTOBOLD, FontWeight.BOLD, 10.0));
TextFlow tf = new TextFlow(t);
tf.setPrefWidth(55);
tf.setTextAlignment(TextAlignment.CENTER);
tf.setPadding(new Insets(2, 5, 2, 5));
if ("Subscription".equals(getType())) {
t.setText("SUB");
tf.setStyle("-fx-background-color: #001A80; -fx-background-radius: 12px;");
} else if ("Publication".equals(getType())) {
t.setText("PUB");
tf.setStyle("-fx-background-color: #4D001A; -fx-background-radius: 12px;");
} else { // "Publication/Subscription"
t.setText("P/SUB");
tf.setStyle("-fx-background-color: #003300; -fx-background-radius: 12px;");
}
return tf;
}
项目:helloiot
文件:TopicInfoCode.java
@Override
public Node getGraphic() {
Text t = new Text();
t.setFill(Color.WHITE);
t.setFont(Font.font(ExternalFonts.ROBOTOBOLD, FontWeight.BOLD, 10.0));
TextFlow tf = new TextFlow(t);
tf.setPrefWidth(55);
tf.setTextAlignment(TextAlignment.CENTER);
tf.setPadding(new Insets(2, 5, 2, 5));
t.setText("CODE");
tf.setStyle("-fx-background-color: #001A80; -fx-background-radius: 12px;");
return tf;
}
项目:Maze
文件:MazeMaker.java
private TextFlow parse(List<String> lines) {
Text[] parsedSegments = new Text[lines.size()];
for (int i = 0 ; i < lines.size() ; i++) {
parsedSegments[i] = new Text(lines.get(i).substring(1) + "\n");
switch (lines.get(i).charAt(0)) {
case '#':
parsedSegments[i].setStyle("-fx-font-size: 20px;");
break;
case '$':
parsedSegments[i].setStyle("-fx-font-size: 16px;");
break;
default:
parsedSegments[i].setStyle("-fx-font-size: 12px; -fx-line-spacing: 4px;");
break;
}
}
return new TextFlow(parsedSegments);
}
项目:drbookings
文件:UpcomingController.java
private static void addCheckInNotes(final LocalDate date, final VBox box,
final List<CheckInOutDetails> checkInNotes) {
if (checkInNotes.size() > 0) {
for (final CheckInOutDetails next : checkInNotes) {
final TextFlow tf = new TextFlow();
final Text t0 = new Text("Room " + next.room);
t0.getStyleClass().add("emphasis");
final Text t1 = new Text(" (" + next.bookingOrigin + ")");
tf.getChildren().addAll(t0, t1);
if (!StringUtils.isBlank(next.notes)) {
final Text t2 = new Text(": " + next.notes);
t2.getStyleClass().add("guest-message");
tf.getChildren().add(t2);
}
box.getChildren().add(tf);
}
box.getChildren().add(new Separator());
}
}
项目:drbookings
文件:UpcomingController.java
private static void addCheckInSummary(final LocalDate date, final VBox box,
final List<CheckInOutDetails> checkInNotes) {
final TextFlow tf = new TextFlow();
if (checkInNotes.size() > 0) {
final Text t1 = new Text(checkInNotes.size() + " ");
t1.getStyleClass().add("emphasis");
t1.getStyleClass().add("copyable-label");
final Text t2;
if (checkInNotes.size() > 1) {
t2 = new Text("check-ins,");
} else {
t2 = new Text("check-in,");
}
t2.getStyleClass().add("emphasis");
tf.getStyleClass().add("copyable-label");
tf.getChildren().addAll(t1, t2);
}
if (checkInNotes.isEmpty()) {
// tf.getChildren().add(new Text("no check-ins,"));
}
box.getChildren().add(tf);
}
项目:drbookings
文件:UpcomingController.java
private static void addCheckOutNotes(final LocalDate date, final VBox box,
final List<CheckInOutDetails> checkOutNotes) {
if (checkOutNotes.size() > 0) {
for (final CheckInOutDetails next : checkOutNotes) {
final TextFlow tf = new TextFlow();
final Text t0 = new Text("Room " + next.room);
t0.getStyleClass().add("emphasis");
final Text t1 = new Text(" (" + next.bookingOrigin + ")");
tf.getChildren().addAll(t0, t1);
if (!StringUtils.isBlank(next.notes)) {
final Text t2 = new Text(": " + next.notes);
t2.getStyleClass().add("guest-message");
tf.getChildren().add(t2);
}
box.getChildren().add(tf);
}
box.getChildren().add(new Separator());
}
}
项目:drbookings
文件:UpcomingController.java
private static void addCheckOutSummary(final LocalDate date, final VBox box,
final List<CheckInOutDetails> checkOutNotes) {
final TextFlow tf = new TextFlow();
if (checkOutNotes.size() > 0) {
final Text t0;
t0 = new Text("");
final Text t1 = new Text(checkOutNotes.size() + " ");
t1.getStyleClass().add("emphasis");
final Text t2;
if (checkOutNotes.size() > 1) {
t2 = new Text("check-outs,");
} else {
t2 = new Text("check-out,");
}
t2.getStyleClass().add("emphasis");
tf.getChildren().addAll(t0, t1, t2);
}
if (checkOutNotes.isEmpty()) {
// tf.getChildren().add(new Text("no check-outs,"));
}
box.getChildren().add(tf);
}
项目:drbookings
文件:UpcomingController.java
private static void addCleaningSummary(final LocalDate date, final VBox box,
final Collection<CleaningEntry> upcomingBookings) {
final TextFlow tf = new TextFlow();
if (upcomingBookings.isEmpty()) {
// final Text t0 = new Text("and no cleaning.");
// tf.getChildren().add(t0);
} else {
final Text t0 = new Text("and ");
final Text t1 = new Text(upcomingBookings.size() + " ");
t1.getStyleClass().add("emphasis");
final Text t2 = new Text(" cleaning" + (upcomingBookings.size() > 1 ? "s." : "."));
t2.getStyleClass().add("emphasis");
tf.getChildren().addAll(t0, t1, t2);
}
box.getChildren().add(tf);
}
项目:drbookings
文件:BookingDetailsController.java
private void addRowNetEarnings(final Pane content, final Booking be) {
final HBox box = new HBox();
box.setSpacing(boxSpacing);
box.setPadding(boxPadding);
box.setAlignment(Pos.CENTER_LEFT);
box.setFillHeight(true);
final TextField grossEarningsExpression = new TextField(be.getGrossEarningsExpression());
grossEarningsExpression.setPrefWidth(prefTextInputFieldWidth * 1.5);
booking2GrossEarnings.put(be, grossEarningsExpression);
final Text grossEarnings = new Text(decimalFormat.format(be.getGrossEarnings()));
final TextFlow tf = new TextFlow(new Text("Gross Earnings: "), grossEarningsExpression, new Text(" = "),
grossEarnings, new Text("€"));
box.getChildren().addAll(tf);
if (be.getGrossEarnings() <= 0) {
box.getStyleClass().addAll("warning", "warning-bg");
}
content.getChildren().add(box);
}
项目:drbookings
文件:BookingDetailsController.java
private static void addRow4(final Pane content, final Booking be) {
final HBox box = new HBox();
box.setPadding(new Insets(4));
box.setAlignment(Pos.CENTER_LEFT);
box.setFillHeight(true);
final TextFlow tf = new TextFlow();
final Text t0 = new Text("Net Earnings: \t");
final Text netEarnings = new Text(String.format("%3.2f", be.getNetEarnings()));
final Text t1 = new Text("€ total \t");
final Text netEarningsDay = new Text(String.format("%3.2f", be.getNetEarnings() / be.getNumberOfNights()));
final Text t2 = new Text("€ /night");
tf.getChildren().addAll(t0, netEarnings, t1, netEarningsDay, t2);
box.getChildren().addAll(tf);
if (be.getNetEarnings() <= 0) {
box.getStyleClass().addAll("warning", "warning-bg");
}
content.getChildren().add(box);
}
项目:drbookings
文件:JavaFXTest.java
@Override
public void start(final Stage primaryStage) {
final StackPane root = new StackPane();
final TextFlow tf = new TextFlow();
final Text t0 = new Text("First part");
final Text t1 = new Text(", second");
final TextField t2 = new TextField(" and very, very, very long third");
t2.setEditable(false);
t2.setBackground(Background.EMPTY);
t2.setFocusTraversable(false);
tf.getChildren().addAll(t0, t1, t2);
root.getChildren().add(tf);
final Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
项目:TweetwallFX
文件:Devoxx17FlipInTweets.java
private HBox createSingleTweetDisplay(final Tweet displayTweet, final WordleSkin wordleSkin, final double maxWidth) {
String textWithoutMediaUrls = displayTweet.getDisplayEnhancedText();
Text text = new Text(textWithoutMediaUrls.replaceAll("[\n\r]", "|"));
text.setCache(true);
text.setCacheHint(CacheHint.SPEED);
text.getStyleClass().add("tweetText");
Image profileImage = wordleSkin.getProfileImageCache().get(displayTweet.getUser().getBiggerProfileImageUrl());
ImageView profileImageView = new ImageView(profileImage);
profileImageView.setSmooth(true);
profileImageView.setCacheHint(CacheHint.QUALITY);
TextFlow flow = new TextFlow(text);
flow.getStyleClass().add("tweetFlow");
flow.maxWidthProperty().set(maxWidth);
flow.maxHeightProperty().set(70);
flow.minHeightProperty().set(70);
flow.setCache(true);
flow.setCacheHint(CacheHint.SPEED);
Text name = new Text(displayTweet.getUser().getName());
name.getStyleClass().add("tweetUsername");
name.setCache(true);
name.setCacheHint(CacheHint.SPEED);
HBox tweet = new HBox(profileImageView, new VBox(name, flow));
tweet.setCacheHint(CacheHint.QUALITY);
tweet.setSpacing(10);
return tweet;
}
项目:POL-POM-5
文件:StepRepresentationPresentation.java
@Override
protected void drawStepContent() {
final String title = this.getParentWizardTitle();
VBox contentPane = new VBox();
contentPane.setId("presentationBackground");
Label titleWidget = new Label(title + "\n\n");
titleWidget.setId("presentationTextTitle");
Text textWidget = new Text(textToShow);
textWidget.setId("presentationText");
TextFlow flow = new TextFlow();
flow.getChildren().add(textWidget);
ScrollPane scrollPane = new ScrollPane();
scrollPane.setId("presentationScrollPane");
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setFitToWidth(true);
scrollPane.setContent(flow);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
contentPane.getChildren().add(scrollPane);
getParent().getRoot().setCenter(contentPane);
}
项目:pipeline-gui
文件:ScriptInfoHeaderVBox.java
public void populate(Script script) {
this.flow = new TextFlow();
Text name = new Text(script.getName());
name.getStyleClass().add("subtitle");
this.getChildren().add(name);
RootNode node = mdProcessor.parseMarkdown(script.getDescription().toCharArray());
//Text desc = new Text(script.getDescription());
//this.getChildren().add(desc);
node.accept(this.mdToFx);
//add description flow
this.getChildren().add(flow);
final String documentationPage = script.getXProcScript().getHomepage();
if (documentationPage != null && documentationPage.isEmpty() == false) {
Hyperlink link = new Hyperlink();
link.setText("Read online documentation");
link.setOnAction(Links.getEventHander(main.getHostServices(),documentationPage));
this.getChildren().add(link);
}
}
项目:RichTextFX
文件:ParagraphBox.java
ParagraphBox(Paragraph<PS, SEG, S> par, BiConsumer<TextFlow, PS> applyParagraphStyle,
Function<StyledSegment<SEG, S>, Node> nodeFactory) {
this.getStyleClass().add("paragraph-box");
this.text = new ParagraphText<>(par, nodeFactory);
applyParagraphStyle.accept(this.text, par.getParagraphStyle());
this.index = Var.newSimpleVar(0);
getChildren().add(text);
graphic = Val.combine(
graphicFactory,
this.index,
(f, i) -> f != null ? f.apply(i) : null);
graphic.addListener((obs, oldG, newG) -> {
if(oldG != null) {
getChildren().remove(oldG);
}
if(newG != null) {
getChildren().add(newG);
}
});
graphicOffset.addListener(obs -> requestLayout());
}
项目:systemdesign
文件:FXMLDrawingNode.java
private void getTextNodes(TextFlow flow, boolean first, DiffPair<String> line) {
String sep = first ? "" : "\n";
if (line.isDeleted() || line.isChanged()) {
Text oldText = new Text(sep + line.getWasInstance().get());
oldText.getStyleClass().add("deleted");
flow.getChildren().add(oldText);
sep = "\n";
}
if (line.isAdded() || line.isChanged()) {
Text newText = new Text(sep + line.getIsInstance().get());
newText.getStyleClass().add("changed");
flow.getChildren().add(newText);
sep = "\n";
}
if (!line.isAdded() && !line.isDeleted() && !line.isChanged()) {
flow.getChildren().add(new Text(sep + line.getSample()));
}
}
项目:jvarkit
文件:BamStage.java
private Tab buildJavascriptPane()
{
final ScrollPane scroll=new ScrollPane(super.javascriptArea);
scroll.setFitToWidth(true);
scroll.setFitToHeight(true);
final BorderPane pane=new BorderPane(scroll);
pane.setPadding(new Insets(10));
final FlowPane top=new FlowPane();
top.getChildren().addAll(super.makeJavascriptButtons());
pane.setTop(top);
final FlowPane bottom=new FlowPane(
new TextFlow(new Text("The script injects:\n"+
"* '"+HEADER_CONTEXT_KEY+"' an instance of "),javadocFor(SAMFileHeader.class),new Text("\n"+
"* '"+RECORD_CONTEXT_KEY+"' an instance of "),javadocFor(SAMRecord.class),new Text("\n"+
"* '"+TOOL_CONTEXT_KEY+"' an instance of "),javadocFor(BamTools.class),new Text("\n"+
"The script should return a boolean: true (accept record) or false (reject record)")
));
pane.setBottom(bottom);
final Tab tab=new Tab(JAVASCRIPT_TAB_KEY,pane);
tab.setClosable(false);
return tab;
}
项目:jrfl
文件:Colors.java
/**
* @param flow <tt>TextFlow</tt> to check
* @return <tt>true</tt> if the flow is empty
*/
public static boolean isEmpty(TextFlow flow) {
String text = "";
for(Node t : flow.getChildren()) {
text += ((Text) t).getText();
}
return text.isEmpty();
}
项目:jrfl
文件:JrflNode.java
private void styleAll() {
String[] styles = {
"color", "font", "size",
"fill", "bgcolor",
"stroke-color", "stroke-size", "border-size", "border-color", "opacity"
};
String regex = "";
for(String style : styles) {
regex += style + "|";
}
regex = regex.substring(0, regex.length()-1);
if(n instanceof Label || n instanceof TextField || n instanceof TextFlow || n instanceof TextArea) {
style("text-fill", styles[0], "#000");
style("font-family", styles[1], Font.getDefault().getName());
style("font-size", styles[2], Font.getDefault().getSize() + "");
}
else {
style("background-color", styles[0], "#FFF");
style("fill", styles[0], "#000");
}
if(n instanceof TextArea) {
style("background-color", styles[4], "#FFF");
}
style("stroke", styles[5], "#000");
style("stroke-width", styles[6], "0");
style("border-width", styles[7], "0");
style("border-color", styles[8], "#000");
style("opacity", styles[9], "1");
for(Object key : Jrfl.ACTIVE_STYLE.getConfiguration().properties.keySet()) {
if(key.toString().startsWith(id + ".")) {
String attr = key.toString().split("\\.")[1];
if(!attr.matches(regex)) {
n.setStyle(
n.getStyle() + attr + ": " + Jrfl.ACTIVE_STYLE.getConfiguration().get(key.toString()) + "; ");
}
}
}
}
项目:voogasalad-ltub
文件:UserSocialPage.java
private void configProfile() {
profileView = new BorderPane();
VBox profileInfo = new VBox(10);
ImageView img = new ImageView(myUser.getImage());
Text name = new Text(myUser.getName());
name.setFont(new Font(18));
TextFlow textWrapper = new TextFlow(name);
textWrapper.setTextAlignment(TextAlignment.CENTER);
profileInfo.getChildren().addAll(img, textWrapper);
profileInfo.setAlignment(Pos.CENTER);
profileView.setCenter(profileInfo);
}
项目:voogasalad-ltub
文件:MessagingView.java
private VBox makeMessageDisplay(Map<String, String> displayableMessages) {
VBox messagesBox = new VBox(5);
for (String person: displayableMessages.keySet()){
Text display = new Text(person + ": " + displayableMessages.get(person));
TextFlow wrapper = new TextFlow(display);
wrapper.setTextAlignment(TextAlignment.LEFT);
messagesBox.getChildren().add(wrapper);
}
return messagesBox;
}
项目:voogasalad-ltub
文件:GameStatsView.java
private void configure(String name) {
Text gameName = new Text(name);
TextFlow wrapper = new TextFlow(gameName);
wrapper.setTextAlignment(TextAlignment.CENTER);
this.getChildren().addAll(wrapper, myStats, myInteractiveElements);
}
项目:DeskChan
文件:PluginOptionsControlItem.java
@Override
public void init(Map<String, Object> options, Object value) {
scrollPane = new ScrollPane();
area = new TextFlow(new Text("Пустой текст"));
area.setPadding(new Insets(0, 5, 0, 5));
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
scrollPane.setContent(area);
scrollPane.setFitToWidth(true);
area.prefHeightProperty().bind(scrollPane.heightProperty());
area.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
setValue(value);
}
项目:tilesfx
文件:TimeTileSkin.java
@Override protected void initGraphics() {
super.initGraphics();
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
text = new Text(tile.getText());
text.setFill(tile.getUnitColor());
Helper.enableNode(text, tile.isTextVisible());
LocalTime duration = tile.getDuration();
leftText = new Text(Integer.toString(duration.getHour() > 0 ? duration.getHour() : duration.getMinute()));
leftText.setFill(tile.getValueColor());
leftUnit = new Text(duration.getHour() > 0 ? "h" : "m");
leftUnit.setFill(tile.getValueColor());
rightText = new Text(Integer.toString(duration.getHour() > 0 ? duration.getMinute() : duration.getSecond()));
rightText.setFill(tile.getValueColor());
rightUnit = new Text(duration.getHour() > 0 ? "m" : "s");
rightUnit.setFill(tile.getValueColor());
timeText = new TextFlow(leftText, leftUnit, rightText, rightUnit);
timeText.setTextAlignment(TextAlignment.RIGHT);
timeText.setPrefWidth(PREFERRED_WIDTH * 0.9);
description = new Label(tile.getDescription());
description.setAlignment(Pos.TOP_RIGHT);
description.setWrapText(true);
description.setTextFill(tile.getTextColor());
Helper.enableNode(description, !tile.getDescription().isEmpty());
getPane().getChildren().addAll(titleText, text, timeText, description);
}
项目:tilesfx
文件:NumberTileSkin.java
@Override protected void initGraphics() {
super.initGraphics();
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
text = new Text(tile.getText());
text.setFill(tile.getUnitColor());
Helper.enableNode(text, tile.isTextVisible());
valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100)));
valueText.setFill(tile.getValueColor());
valueText.setTextOrigin(VPos.BASELINE);
Helper.enableNode(valueText, tile.isValueVisible());
unitText = new Text(" " + tile.getUnit());
unitText.setFill(tile.getUnitColor());
unitText.setTextOrigin(VPos.BASELINE);
Helper.enableNode(unitText, !tile.getUnit().isEmpty());
valueUnitFlow = new TextFlow(valueText, unitText);
valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);
description = new Label(tile.getText());
description.setAlignment(tile.getDescriptionAlignment());
description.setWrapText(true);
description.setTextFill(tile.getTextColor());
Helper.enableNode(description, tile.isTextVisible());
getPane().getChildren().addAll(titleText, text, valueUnitFlow, description);
}
项目:programmierpraktikum-abschlussprojekt-null
文件:InformationItem.java
/**
* Constructs an information item with title and (optional) children
*
* @param title
* @param children
*/
public InformationItem(String title, String content) {
getStyleClass().add("information-item");
setText(title);
TextFlow textFlow = new TextFlow(new Text(content));;
AnchorPane contentPane = new AnchorPane(textFlow);
contentPane.getStyleClass().add("information-item-content-wrap");
setContent(contentPane);
setExpanded(false);
}
项目:FxEditor
文件:StyledTextPaneMouseController.java
public StyledTextPaneMouseController(StyledTextPane p)
{
this.editor = p;
TextFlow ed = p.textField;
ed.addEventFilter(KeyEvent.KEY_PRESSED, (ev) -> handleKeyPressed(ev));
ed.addEventFilter(KeyEvent.KEY_RELEASED, (ev) -> handleKeyReleased(ev));
ed.addEventFilter(KeyEvent.KEY_TYPED, (ev) -> handleKeyTyped(ev));
ed.addEventFilter(MouseEvent.MOUSE_PRESSED, (ev) -> handleMousePressed(ev));
ed.addEventFilter(MouseEvent.MOUSE_RELEASED, (ev) -> handleMouseReleased(ev));
ed.addEventFilter(MouseEvent.MOUSE_DRAGGED, (ev) -> handleMouseDragged(ev));
}