当前位置: 首页>>代码示例>>Java>>正文


Java Label.setMaxSize方法代码示例

本文整理汇总了Java中javafx.scene.control.Label.setMaxSize方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setMaxSize方法的具体用法?Java Label.setMaxSize怎么用?Java Label.setMaxSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Label的用法示例。


在下文中一共展示了Label.setMaxSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AllDayEntryViewSkin

import javafx.scene.control.Label; //导入方法依赖的package包/类
public AllDayEntryViewSkin(AllDayEntryView view) {
    super(view);

    titleLabel = new Label();
    titleLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    titleLabel.setMouseTransparent(true);
    titleLabel.setManaged(false);

    Entry<?> entry = view.getEntry();

    entry.calendarProperty().addListener(weakUpdateViewListener);
    entry.fullDayProperty().addListener(weakUpdateViewListener);
    entry.titleProperty().addListener(weakUpdateViewListener);
    entry.intervalProperty().addListener(weakUpdateViewListener);

    updateView();

    getChildren().addAll(titleLabel);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:20,代码来源:AllDayEntryViewSkin.java

示例2: generate

import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
 * Generates a panel image form char.
 * <p>First, this function converts ch to upper case if ch is lower case.</p>
 * <p>Then, this generates javafx's image from ch.And return it.</p>
 * You can fix the resolution of image through {@link capslock.CharPanelGenerator#PANEL_IMAGE_SIZE}
 * and {@link capslock.CharPanelGenerator#FONT_SIZE}.
 * @param ch パネルの生成に使う1文字.
 * @param color 背景色.
 * @return 生成されたパネル.
 */
static final Image generate(char ch, Color color){
    final Label label = new Label(Character.toString(Character.toUpperCase(ch)));
    label.setMinSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setMaxSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setPrefSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setFont(Font.font(FONT_SIZE));
    label.setAlignment(Pos.CENTER);
    label.setTextFill(Color.WHITE);
    label.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
    final Scene scene = new Scene(new Group(label));
    final WritableImage img = new WritableImage(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    scene.snapshot(img);
    return img ;
}
 
开发者ID:chrootRISCassembler,项目名称:CapsLock,代码行数:25,代码来源:CharPanelGenerator.java

示例3: 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;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:38,代码来源:DayPageSkin.java

示例4: update

import javafx.scene.control.Label; //导入方法依赖的package包/类
private void update() {

        if (!entries.isEmpty()) {

            List<Entry<?>> workingList = new ArrayList<>(entries);

            /*
             * Individual calendars are already sorted, but now we are
             * displaying entries from several calendars, so let's resort.
             */
            Collections.sort(workingList);

            for (Entry<?> entry : workingList) {
                Calendar calendar = entry.getCalendar();

                BorderPane borderPane = new BorderPane();
                borderPane.getStyleClass().add("entry");

                Label titleLabel = new Label(entry.getTitle());
                BorderPane.setAlignment(titleLabel, Pos.CENTER_LEFT);
                titleLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
                titleLabel.getStyleClass().add("title"); //$NON-NLS-1$
                borderPane.setCenter(titleLabel);

                Circle colorDot = new Circle();
                colorDot.setRadius(2.5);
                colorDot.getStyleClass().add(
                        calendar.getStyle() + "-icon-small"); //$NON-NLS-1$
                titleLabel.setGraphic(colorDot);

                Label timeLabel = new Label();
                if (entry.isFullDay()) {
                    timeLabel.setText(Messages.getString("EntriesPane.FULL_DAY")); //$NON-NLS-1$
                } else {
                    timeLabel.setText(DateTimeFormatter.ofLocalizedTime(
                            FormatStyle.SHORT).format(entry.getStartTime()));
                }

                borderPane.setRight(timeLabel);

                timeLabel.getStyleClass().add("time"); //$NON-NLS-1$
                BorderPane.setAlignment(timeLabel, Pos.CENTER_RIGHT);

                getChildren().add(borderPane);
            }
        }
    }
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:48,代码来源:EntriesPane.java

示例5: updateView

import javafx.scene.control.Label; //导入方法依赖的package包/类
private void updateView() {
    controlsMap.clear();

    MonthView view = getSkinnable();
    gridPane.getChildren().clear();

    displayedYearMonth = view.getYearMonth();

    WeekFields weekFields = view.getWeekFields();
    DayOfWeek dayOfWeek = weekFields.getFirstDayOfWeek();

    if (view.isShowWeekdays()) {
        for (int i = 0; i < 7; i++) {
            Label dayOfWeekLabel = new Label(dayOfWeek.getDisplayName(TextStyle.SHORT_STANDALONE, Locale.getDefault()));
            dayOfWeekLabel.setAlignment(Pos.CENTER_RIGHT);
            dayOfWeekLabel.setMaxSize(MAX_VALUE, MAX_VALUE);
            dayOfWeekLabel.getStyleClass().add(DAY_OF_WEEK_LABEL);

            if (view.isShowWeekends() && view.getWeekendDays().contains(dayOfWeek)) {
                dayOfWeekLabel.getStyleClass().add(DAY_OF_WEEKEND_LABEL);
            }

            GridPane.setHgrow(dayOfWeekLabel, ALWAYS);
            gridPane.add(dayOfWeekLabel, i, 0);
            dayOfWeek = dayOfWeek.plus(1);
        }
    }

    LocalDate date = view.getDate().with(TemporalAdjusters.firstDayOfMonth());

    date = Util.adjustToFirstDayOfWeek(date, getSkinnable().getFirstDayOfWeek());

    for (int week = 0; week < 6; week++) {
        for (int day = 0; day < 7; day++) {
            // TODO: this should be done via a factory (cell factory already defined on MonthViewBase
            MonthDayView dayOfMonthLabel = new MonthDayView(date, week, day);
            controlsMap.put(date, dayOfMonthLabel);
            GridPane.setHgrow(dayOfMonthLabel, ALWAYS);
            GridPane.setVgrow(dayOfMonthLabel, ALWAYS);
            gridPane.add(dayOfMonthLabel, day, week + 1);
            date = date.plusDays(1);
        }
    }

    updateDaySelection();
    updateEntries("view was updated after a view property change");
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:48,代码来源:MonthViewSkin.java

示例6: MonthEntryViewSkin

import javafx.scene.control.Label; //导入方法依赖的package包/类
public MonthEntryViewSkin(MonthEntryView view) {
    super(view);

    Entry<?> entry = view.getEntry();
    if (entry.isRecurrence()) {
        entry = entry.getRecurrenceSourceEntry();
    }

    Calendar calendar = entry.getCalendar();

    colorDot = new Circle();
    colorDot.setRadius(2.5);
    colorDot.setMouseTransparent(true);

    titleLabel = new Label();
    titleLabel.setGraphic(colorDot);
    titleLabel.setMinSize(0, 0);
    titleLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    titleLabel.setMouseTransparent(true);

    timeLabel = new Label();
    timeLabel.setMouseTransparent(true);
    timeLabel.setMaxHeight(Double.MAX_VALUE);
    timeLabel.setMouseTransparent(true);

    // update in these cases
    entry.titleProperty().addListener(weakUpdateViewListener);
    entry.fullDayProperty().addListener(weakUpdateViewListener);
    entry.intervalProperty().addListener(weakUpdateViewListener);
    entry.calendarProperty().addListener(weakUpdateViewListener);

    view.positionProperty().addListener(weakUpdateViewListener);

    if (calendar != null) {
        calendar.styleProperty().addListener(weakUpdateViewListener);
    }

    getChildren().addAll(titleLabel, timeLabel);

    updateView();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:42,代码来源:MonthEntryViewSkin.java


注:本文中的javafx.scene.control.Label.setMaxSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。