java中borderpane_Java BorderPane.setAlignment方法代碼示例

import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類

private void update() {

if (!entries.isEmpty()) {

List> 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);

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值