本文整理汇总了Java中javafx.scene.control.Label.setMaxWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setMaxWidth方法的具体用法?Java Label.setMaxWidth怎么用?Java Label.setMaxWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setMaxWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LabelContainer
import javafx.scene.control.Label; //导入方法依赖的package包/类
public LabelContainer(int labelIndex, int bahnsteig, ArrayList<LabelContainer> labelTime) throws Exception{
this.labelTime = labelTime;
this.bahnsteig = bahnsteig;
this.labelIndex = labelIndex;
trains = new ArrayList<>();
hervorhebungDurchGleis = false;
l = new Label();
l.setFont(Font.font(settingsFontSize-5));
l.setMinWidth(settingsGridWidth);
l.setMaxWidth(settingsGridWidth);
l.setAlignment(Pos.CENTER);
if(bahnsteig > -1){
updateLabel();
}
}
示例2: 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);
}
示例3: createControl
import javafx.scene.control.Label; //导入方法依赖的package包/类
@Override
protected Node createControl() {
RecurrenceView view = new RecurrenceView();
Label label = new Label("Rule: " + view.getRecurrenceRule());
label.setMaxWidth(300);
label.setWrapText(true);
view.recurrenceRuleProperty().addListener(it -> label.setText(view.getRecurrenceRule()));
Separator separator = new Separator(Orientation.HORIZONTAL);
VBox box = new VBox(20);
box.setFillWidth(true);
box.getChildren().addAll(view, separator, label);
box.setAlignment(Pos.CENTER);
return box;
}
示例4: init
import javafx.scene.control.Label; //导入方法依赖的package包/类
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setScene(new Scene(root));
VBox vRoot = new VBox();
vRoot.setPadding(new Insets(8, 8, 8, 8));
vRoot.setSpacing(5);
htmlEditor = new HTMLEditor();
htmlEditor.setPrefSize(500, 245);
htmlEditor.setHtmlText(INITIAL_TEXT);
vRoot.getChildren().add(htmlEditor);
final Label htmlLabel = new Label();
htmlLabel.setMaxWidth(500);
htmlLabel.setWrapText(true);
ScrollPane scrollPane = new ScrollPane();
scrollPane.getStyleClass().add("noborder-scroll-pane");
scrollPane.setContent(htmlLabel);
scrollPane.setFitToWidth(true);
scrollPane.setPrefHeight(180);
Button showHTMLButton = new Button("Show the HTML below");
vRoot.setAlignment(Pos.CENTER);
showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
htmlLabel.setText(htmlEditor.getHtmlText());
}
});
vRoot.getChildren().addAll(showHTMLButton, scrollPane);
root.getChildren().addAll(vRoot);
}
示例5: createAndSetupButtons
import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
* Will create an {@link HBox} for every {@link SAMPVersion}, said {@link HBox}
* will contain a {@link Label} and a {@link Button}.
*/
private void createAndSetupButtons() {
for (final InstallationCandidate candidate : INSTALLATION_CANDIDATES) {
final HBox versionContainer = new HBox();
if (!buttonContainer.getChildren().isEmpty()) {
buttonContainer.getChildren().add(new Separator());
}
versionContainer.getStyleClass().add("installEntry");
final Label title = new Label(MessageFormat.format(SAMP_VERSION, candidate.getName()));
title.getStyleClass().add("installLabel");
title.setMaxWidth(Double.MAX_VALUE);
final Button installButton = new Button(INSTALL_TEXT);
installButton.setUserData(candidate);
installButton.setOnAction(__ -> installAction(installButton));
installButton.getStyleClass().add("installButton");
buttons.add(installButton);
versionContainer.getChildren().add(title);
versionContainer.getChildren().add(installButton);
buttonContainer.getChildren().add(versionContainer);
HBox.setHgrow(title, Priority.ALWAYS);
}
}
示例6: initComponents
import javafx.scene.control.Label; //导入方法依赖的package包/类
private void initComponents() {
messageLabel = new Label(message);
messageLabel.setAlignment(Pos.CENTER);
messageLabel.setStyle("-fx-background-color:#000000");
messageLabel.setTextFill(javafx.scene.paint.Color.WHITE);
messageLabel.setMaxWidth(Double.MAX_VALUE);
setScene(new Scene(new VBox(FXUIUtils.getImage("wait"), messageLabel)));
}
示例7: fillAuctionPane
import javafx.scene.control.Label; //导入方法依赖的package包/类
private void fillAuctionPane(Pane auctionPane, List<Auction> auctionList) {
auctionPane.getChildren().clear();
Random r = new Random(100);
int Low = 70;
int High = 250;
//For each auction
for (Auction auction : auctionList) {
int wh = r.nextInt(High - Low) + Low;
wh = 250; //no randomness for now
BorderPane tile = new BorderPane();
ImageView artPhoto = new ImageView(auction.getArtwork().getPhoto());
artPhoto.setFitHeight(wh);
artPhoto.setFitWidth(wh);
artPhoto.setPreserveRatio(true);
Label label = new Label(auction.getArtwork().getName());
label.setStyle("-fx-font-weight: bold; -fx-font-size: 11pt;");
label.setMaxWidth(Double.MAX_VALUE);
tile.setCenter(artPhoto);
tile.setBottom(new StackPane(label));
tile.setOnMouseClicked(e ->
GUIController.getPrimaryStage().setScene(new Scene(
new ArtworkScene(dc, curProfile, auction, curProfile).getPane(),
GUIConstants.SCENE_WIDTH,
GUIConstants.SCENE_HEIGHT
)
)
);
auctionPane.getChildren().add(tile);
}
}
示例8: 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;
}
示例9: createLabel
import javafx.scene.control.Label; //导入方法依赖的package包/类
public static Label createLabel(String text, Paint colour, String style, Insets insets, double width, double height)
{
Label label = createLabel(text, colour, style, insets);
label.setMinWidth(width);
label.setMaxWidth(width);
label.setMinHeight(height);
label.setMaxHeight(height);
return label;
}
示例10: createInterpolatorCell
import javafx.scene.control.Label; //导入方法依赖的package包/类
private Node createInterpolatorCell(InterpolatorModel item) {
Label label = new Label();
label.textProperty().bind(item.nameProperty());
label.graphicProperty().bind(ChainedBindingFunctions.from(item.iconSupplierProperty()).mapToObject(Supplier::get));
label.setMaxWidth(Double.MAX_VALUE);
return label;
}
示例11: CalendarFXSamplerWelcome
import javafx.scene.control.Label; //导入方法依赖的package包/类
public CalendarFXSamplerWelcome() {
super("CalendarFX", new Label(""));
Label label = (Label) getContent();
label.setWrapText(true);
label.setMaxWidth(Double.MAX_VALUE);
label.setMaxHeight(Double.MAX_VALUE);
label.setTextAlignment(TextAlignment.CENTER);
label.setAlignment(Pos.CENTER);
label.setPadding(new Insets(50));
label.setText("Welcome to the CalendarFX sampler. This application allows you to quickly browse through the "
+ "various controls that are available in this framework. In each sample you can play around with the "
+ "properties and controls shown on the right-hand side.");
}
示例12: 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();
}
示例13: AgendaViewSkin
import javafx.scene.control.Label; //导入方法依赖的package包/类
public AgendaViewSkin(AgendaView view) {
super(view);
listView = view.getListView();
listView.setMinWidth(1);
listView.setFixedCellSize(-1);
listView.setSelectionModel(Util.createEmptySelectionModel());
listView.getStyleClass().add("agenda-view-list");
statusLabel = new Label();
statusLabel.getStyleClass().add("status-label"); //$NON-NLS-1$
statusLabel.setMaxWidth(Double.MAX_VALUE);
statusLabel.visibleProperty().bind(view.showStatusLabelProperty());
statusLabel.managedProperty().bind(statusLabel.visibleProperty());
Label placeholderLabel = new Label(Messages.getString("AgendaViewSkin.NO_ENTRIES")); //$NON-NLS-1$
placeholderLabel.getStyleClass().add(AGENDA_VIEW_PLACEHOLDER_LABEL);
listView.setPlaceholder(placeholderLabel);
BorderPane borderPane = new BorderPane();
borderPane.getStyleClass().add("container"); //$NON-NLS-1$
getChildren().add(borderPane);
borderPane.setCenter(listView);
borderPane.setTop(statusLabel);
InvalidationListener reloadListener = it -> updateList("a view property has changed, property = " + it.toString());
view.lookAheadPeriodInDaysProperty().addListener(reloadListener);
view.lookBackPeriodInDaysProperty().addListener(reloadListener);
view.enableHyperlinksProperty().addListener(reloadListener);
view.getCalendars().addListener(reloadListener);
updateList("initial loading");
listenToCalendars();
view.getCalendars().addListener((Observable observable) -> listenToCalendars());
view.dateProperty().addListener(reloadListener);
}
示例14: setupInfoLabel
import javafx.scene.control.Label; //导入方法依赖的package包/类
private static void setupInfoLabel(final Label label) {
label.setMaxHeight(Double.MAX_VALUE);
label.setMaxWidth(Double.MAX_VALUE);
label.setTextAlignment(TextAlignment.CENTER);
HBox.setHgrow(label, Priority.ALWAYS);
}
示例15: formatcomment
import javafx.scene.control.Label; //导入方法依赖的package包/类
public static BorderPane formatcomment(String timestamp, String comment){
BorderPane notice = new BorderPane();
notice.setPadding(new Insets(0,-20,0,10));
notice.setMaxWidth(340);
VBox noticeVB = new VBox(5);
noticeVB.setStyle("-fx-background-color: transparent; -fx-border-color: #333; -fx-border-width: 1,1,1,1; -fx-border-radius: 10; -fx-text-color: #333;");
Label commentLabel = new Label(comment);
commentLabel.setPadding(new Insets(5));
commentLabel.setFont(new Font("Cambria", 16));
commentLabel.setTextFill(Color.web("#191919"));
commentLabel.setWrapText(true);
commentLabel.setMaxWidth(320);
commentLabel.setAlignment(Pos.BOTTOM_LEFT);
Label time = new Label(timeStampChangeFormat.timeStampChangeFormat(timestamp));
time.setFont(new Font("Cambria", 12));
time.setTextFill(Color.web("#4c4c4c"));
time.setPadding(new Insets(5));
time.setMaxWidth(320);
time.setAlignment(Pos.BOTTOM_LEFT);
noticeVB.getChildren().addAll(commentLabel,time);
notice.setLeft(noticeVB);
noticeVB.setStyle("-fx-background-color: #fff");
return notice;
}