本文整理汇总了Java中javafx.scene.control.OverrunStyle类的典型用法代码示例。如果您正苦于以下问题:Java OverrunStyle类的具体用法?Java OverrunStyle怎么用?Java OverrunStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OverrunStyle类属于javafx.scene.control包,在下文中一共展示了OverrunStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addState
import javafx.scene.control.OverrunStyle; //导入依赖的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: paneFor
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
private Pane paneFor(Component component) {
if (panes.containsKey(component)) {
return panes.get(component);
}
BorderPane pane = new BorderPane(component.getView());
ActionList.registerSupplier(pane, () -> actionsForComponent(component));
pane.getStyleClass().add("layout-stack");
EditableLabel label = new EditableLabel(component.titleProperty());
label.getStyleClass().add("layout-label");
((Label) label.lookup(".label")).setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
BorderPane.setAlignment(label, Pos.TOP_LEFT);
pane.setBottom(label);
panes.put(component, pane);
return pane;
}
示例3: initGraphics
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
@Override protected void initGraphics() {
super.initGraphics();
final ZonedDateTime TIME = tile.getTime();
titleText = new Text(DAY_FORMATTER.format(TIME));
titleText.setFill(tile.getTitleColor());
description = new Label(Integer.toString(TIME.getDayOfMonth()));
description.setAlignment(Pos.CENTER);
description.setTextAlignment(TextAlignment.CENTER);
description.setWrapText(true);
description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
description.setTextFill(tile.getTextColor());
description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.72);
description.setFont(Fonts.latoLight(PREFERRED_HEIGHT * 0.65));
text = new Text(MONTH_YEAR_FORMATTER.format(TIME));
text.setFill(tile.getTextColor());
getPane().getChildren().addAll(titleText, text, description);
}
示例4: initGraphics
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
@Override protected void initGraphics() {
super.initGraphics();
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
description = new Label(tile.getDescription());
description.setAlignment(tile.getDescriptionAlignment());
description.setTextAlignment(TextAlignment.RIGHT);
description.setWrapText(true);
description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
description.setTextFill(tile.getTextColor());
description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795);
Helper.enableNode(description, tile.isTextVisible());
text = new Text(tile.getText());
text.setFill(tile.getUnitColor());
Helper.enableNode(text, tile.isTextVisible());
getPane().getChildren().addAll(titleText, text, description);
}
示例5: initGraphics
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
@Override protected void initGraphics() {
super.initGraphics();
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
description = new Label(tile.getDescription());
description.setAlignment(Pos.CENTER);
description.setTextAlignment(TextAlignment.CENTER);
description.setWrapText(true);
description.setTextOverrun(OverrunStyle.WORD_ELLIPSIS);
description.setTextFill(tile.getTextColor());
description.setPrefSize(PREFERRED_WIDTH * 0.9, PREFERRED_HEIGHT * 0.795);
Helper.enableNode(description, tile.isTextVisible());
text = new Text(tile.getText());
text.setFill(tile.getUnitColor());
Helper.enableNode(text, tile.isTextVisible());
getPane().getChildren().addAll(titleText, text, description);
}
示例6: toValue
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
public static String toValue(OverrunStyle s)
{
switch(s)
{
case CENTER_ELLIPSIS:
return "center-ellipsis";
case CENTER_WORD_ELLIPSIS:
return "center-word-ellipsis";
case CLIP:
return "clip";
case ELLIPSIS:
return "ellipsis";
case LEADING_ELLIPSIS:
return "leading-ellipsis";
case LEADING_WORD_ELLIPSIS:
return "leading-word-ellipsis";
case WORD_ELLIPSIS:
return "word-ellipsis";
}
throw new Error("?" + s);
}
示例7: createTraceWidget
import javafx.scene.control.OverrunStyle; //导入依赖的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;
}
示例8: btnOverRunAction
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
@FXML
private void btnOverRunAction()
{
overrunStyleDeque.add(overrunStyle); // Recycle the last overrunStyle.
overrunStyle = overrunStyleDeque.pop(); //
propertyList.forEach(prop -> prop.setValue(overrunStyle));
if(overrunStyle == OverrunStyle.ELLIPSIS)
btnOverRun.setText("...<<");
else if(overrunStyle == OverrunStyle.CENTER_ELLIPSIS)
btnOverRun.setText(">>...");
else
btnOverRun.setText(">...<");
}
示例9: Tile
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
/**
* Creates an empty tile. The content and size must be set with {@link #setContent(T)} and
* {@link #setSize(TileSize)}.
*/
protected Tile() {
try {
FXMLLoader loader = new FXMLLoader(Tile.class.getResource("Tile.fxml"));
loader.setRoot(this);
loader.load();
} catch (IOException e) {
throw new RuntimeException("Could not load the widget tile FXML", e);
}
getStyleClass().addAll("tile", "card");
PropertyUtils.bindWithConverter(idProperty(), contentProperty(), w -> "tile[" + w + "]");
EditableLabel editableLabel = (EditableLabel) lookup("#titleLabel");
editableLabel.textProperty().bindBidirectional(contentTitle);
((Label) lookup("#titleLabel").lookup(".label")).setTextOverrun(OverrunStyle.LEADING_ELLIPSIS);
contentView.addListener((__, oldContent, newContent) -> {
getContentPane()
.map(Pane::getChildren)
.ifPresent(c -> {
if (newContent == null) {
c.clear();
} else {
c.setAll(newContent);
}
});
});
contentTitle.addListener((__, prev, cur) -> editableLabel.setText(cur));
}
示例10: TimeScaleViewSkin
import javafx.scene.control.OverrunStyle; //导入依赖的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();
}
示例11: createLeftHandSide
import javafx.scene.control.OverrunStyle; //导入依赖的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;
}
示例12: addTextAlignment
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
protected void addTextAlignment(List<Change<Labeled>> list, final Utils.LayoutSize layout, final boolean wrapped, final String text) {
for (final OverrunStyle overrun : OverrunStyle.values()) {
list.add(new Change<Labeled>(overrun.toString()) {
public void apply(Labeled labeled) {
layout.apply(labeled);
labeled.setText(text);
labeled.setTextOverrun(overrun);
labeled.setWrapText(wrapped);
if (labeled.getTextOverrun() != overrun) {
reportGetterFailure("labeled.overrun()");
}
}
});
}
}
示例13: textOverrun
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
@ScreenshotCheck
@Test(timeout=300000)
public void textOverrun() throws Throwable {
for (OverrunStyle display : OverrunStyle.values()) {
textOverrun.as(Selectable.class).selector().select(display);
show.mouse().move();
checkScreenshot("Tooltip-text-overrun-" + display, testPane);
}
throwScreenshotError();
}
示例14: setColumnCellFactories
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
private void setColumnCellFactories()
{
columnMsgText.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("messageText"));
columnMsgOutputMethod.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("messageOutputMethod"));
columnPacketDirection.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("packetDirection"));
columnIP.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("ipAddress"));
columnProtocol.setCellValueFactory(new PropertyValueFactory<>("protocol"));
columnSrcPort.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("srcPort"));
columnDstPort.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("dstPort"));
columnPacketSize.setCellValueFactory(new PropertyValueFactory<PacketTypeToMatch, String>("packetSize"));
columnIP.setCellFactory(new Callback<TableColumn<PacketTypeToMatch, String>, TableCell<PacketTypeToMatch, String>>()
{
@Override
public TableCell<PacketTypeToMatch, String> call(TableColumn<PacketTypeToMatch, String> param)
{
return new TableCell<PacketTypeToMatch, String>()
{
@Override
protected void updateItem(String item, boolean empty)
{
super.updateItem(item, empty);
setText(item);
setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
}
};
}
});
}
示例15: setLabel
import javafx.scene.control.OverrunStyle; //导入依赖的package包/类
protected void setLabel(ITask task, Rectangle backgroundRectangle) {
// Вешаем лэйбл с наименованием задачи
Label taskLabel = new Label(task.getName());
taskLabel.setTextOverrun(OverrunStyle.CLIP);
taskLabel.setTextFill(Color.WHITE);
taskLabel.setLayoutY(6);
taskLabel.prefWidthProperty().bind(backgroundRectangle.widthProperty());
taskLabel.onMousePressedProperty().bind(backgroundRectangle.onMousePressedProperty());
taskLabel.onMouseDraggedProperty().bind(backgroundRectangle.onMouseDraggedProperty());
this.getChildren().add(taskLabel);
}