本文整理匯總了Java中javafx.scene.control.Label.setTextOverrun方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setTextOverrun方法的具體用法?Java Label.setTextOverrun怎麽用?Java Label.setTextOverrun使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setTextOverrun方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addState
import javafx.scene.control.Label; //導入方法依賴的package包/類
private void addState(State<?,?> state, HBox line, Color color, int stateIndex, String stateDescription) {
final Rectangle rectangle = new Rectangle(WIDTH, WIDTH, color);
rectangle.setArcHeight(WIDTH);
rectangle.setArcWidth(WIDTH);
rectangle.setUserData(state);
Label text = new Label(computeStateLabel(stateIndex));
text.setTextOverrun(OverrunStyle.ELLIPSIS);
text.setAlignment(Pos.CENTER);
text.setMouseTransparent(true);
text.setTextFill(Color.WHITE);
text.setFont(STATE_FONT);
text.setMaxWidth(WIDTH);
final Tooltip tooltip = new Tooltip(stateDescription);
Tooltip.install(rectangle, tooltip);
StackPane layout = new StackPane();
StackPane.setMargin(rectangle, MARGIN_INSETS);
layout.getChildren().addAll(rectangle, text);
line.getChildren().add(layout);
}
示例2: createTraceWidget
import javafx.scene.control.Label; //導入方法依賴的package包/類
private Pane createTraceWidget(ITraceExtractor<Step<?>, State<?,?>, TracedObject<?>, Dimension<?>, Value<?>> extractor, String label, ReadOnlyDoubleProperty width) {
final Pane pane = new Pane();
pane.setBackground(TRANSPARENT_BACKGROUND);
final Rectangle rectangle = new Rectangle(0, 0, 0, 12);
rectangle.setFill(Color.LIGHTGRAY);
rectangle.widthProperty().bind(width.subtract(10));
rectangle.setArcHeight(12);
rectangle.setArcWidth(12);
Label text = new Label(label);
text.setTextOverrun(OverrunStyle.ELLIPSIS);
text.setAlignment(Pos.CENTER);
text.setMouseTransparent(true);
text.setTextFill(Color.WHITE);
text.setFont(FONT);
text.setMaxWidth(0);
text.maxWidthProperty().bind(rectangle.widthProperty());
StackPane layout = new StackPane();
layout.getChildren().addAll(rectangle, text);
pane.getChildren().add(layout);
layout.setTranslateY(13);
layout.setTranslateX(5);
pane.setPrefHeight(25);
pane.setMinHeight(25);
pane.setMaxHeight(25);
final Shape arrow1 = createCursor();
final Shape arrow2 = createCursor();
arrow1.setTranslateX(5);
arrow1.setTranslateY(4);
arrow2.translateXProperty().bind(rectangle.widthProperty().add(5));
arrow2.setTranslateY(4);
pane.getChildren().add(arrow1);
pane.getChildren().add(arrow2);
return pane;
}
示例3: TimeScaleViewSkin
import javafx.scene.control.Label; //導入方法依賴的package包/類
public TimeScaleViewSkin(T view) {
super(view);
LocalTime time = LocalTime.of(1, 0);
for (int i = 1; i < 24; i++) {
Label label = new Label(time.format(formatter));
label.setManaged(false);
label.setMaxWidth(Double.MAX_VALUE);
label.setAlignment(Pos.CENTER_RIGHT);
label.getStyleClass().add("time-label"); //$NON-NLS-1$
label.setTextOverrun(OverrunStyle.CLIP);
labels.add(label);
getChildren().add(label);
time = time.plusHours(1);
}
currentTimeLabel = new Label();
currentTimeLabel.getStyleClass().add("current-time-label"); //$NON-NLS-1$
currentTimeLabel.setManaged(false);
currentTimeLabel.setMaxWidth(Double.MAX_VALUE);
currentTimeLabel.setAlignment(Pos.CENTER_RIGHT);
currentTimeLabel.setOpacity(0);
currentTimeLabel.setTextOverrun(OverrunStyle.CLIP);
currentTimeLabel.visibleProperty().bind(view.enableCurrentTimeMarkerProperty());
getChildren().add(currentTimeLabel);
updateCurrentTimeMarkerVisibility();
view.showCurrentTimeMarkerProperty().addListener(
it -> updateCurrentTimeMarkerVisibility());
setupCurrentTimeMarkerSupport();
updateShowMarkers();
}
示例4: createLeftHandSide
import javafx.scene.control.Label; //導入方法依賴的package包/類
protected Node createLeftHandSide() {
DayPage dayPage = getSkinnable();
// today label
todayLabel = new Label();
todayLabel.getStyleClass().add("today-label"); //$NON-NLS-1$
todayLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
todayLabel.setAlignment(Pos.TOP_LEFT);
todayLabel.setTextOverrun(OverrunStyle.CLIP);
todayLabel.setMinWidth(Region.USE_PREF_SIZE);
HBox.setHgrow(todayLabel, Priority.ALWAYS);
// year month view
yearMonthView = dayPage.getYearMonthView();
yearMonthView.setSelectionMode(SelectionMode.SINGLE);
yearMonthView.setShowMonth(false);
yearMonthView.setShowYear(false);
yearMonthView.setShowTodayButton(false);
HBox.setHgrow(yearMonthView, Priority.NEVER);
getSkinnable().bind(yearMonthView, true);
HBox header = new HBox(10);
header.setFillHeight(true);
header.getChildren().addAll(todayLabel, yearMonthView);
header.getStyleClass().add("header");
AgendaView agendaView = dayPage.getAgendaView();
getSkinnable().bind(agendaView, true);
HBox.setMargin(agendaView, new Insets(10, 0, 0, 0));
BorderPane leftHandSide = new BorderPane();
leftHandSide.getStyleClass().add("left-side");
leftHandSide.setTop(header);
leftHandSide.setCenter(agendaView);
HBox.setHgrow(leftHandSide, Priority.ALWAYS);
return leftHandSide;
}
示例5: VertexView
import javafx.scene.control.Label; //導入方法依賴的package包/類
public VertexView(final int stateIndex, StateVertex vertex) {
circle = new Circle(RADIUS);
circle.setFill(Color.SLATEBLUE);
this.stateIndex = stateIndex;
final String s = vertex.getTooltip();
final Tooltip t = new Tooltip(s);
Tooltip.install(this, t);
vertex.setOnTooltipUpdateCommand(text -> Platform.runLater(() -> t.setText(text)));
label = new Label(computeStateLabel(this.stateIndex));
label.setTextOverrun(OverrunStyle.ELLIPSIS);
label.setAlignment(Pos.CENTER);
label.setMouseTransparent(true);
label.setTextFill(Color.WHITE);
label.setFont(STATE_INDEX_FONT);
label.setMaxWidth(RADIUS * 2);
StackPane layout = new StackPane();
layout.getChildren().addAll(circle, label);
layout.setTranslateX(-RADIUS);
layout.setTranslateY(-RADIUS);
getChildren().add(layout);
setOnMousePressed(event -> {
circle.setCursor(Cursor.MOVE);
mouseX = event.getX();
mouseY = event.getY();
event.consume();
});
setOnMouseReleased(event -> {
setCursor(Cursor.DEFAULT);
});
setOnMouseDragged(event -> {
double deltaX = event.getX() - mouseX;
double deltaY = event.getY() - mouseY;
setTranslateX(getTranslateX() + deltaX);
setTranslateY(getTranslateY() + deltaY);
event.consume();
});
setOnMouseEntered(event -> circle.setEffect(GLOW));
setOnMouseExited(event -> circle.setEffect(null));
}