本文整理汇总了Java中javafx.scene.control.Label.setMinSize方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setMinSize方法的具体用法?Java Label.setMinSize怎么用?Java Label.setMinSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Label
的用法示例。
在下文中一共展示了Label.setMinSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 ;
}
示例2: createStartTimeLabel
import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
* The label used to show the start time.
*
* @returns The label component.
*/
protected Label createStartTimeLabel() {
Label label = new Label();
label.setMinSize(0, 0);
return label;
}
示例3: createTitleLabel
import javafx.scene.control.Label; //导入方法依赖的package包/类
/**
* The label used to show the title.
*
* @returns The title component.
*/
protected Label createTitleLabel() {
Label label = new Label();
label.setWrapText(true);
label.setMinSize(0, 0);
return label;
}
示例4: mainScreen
import javafx.scene.control.Label; //导入方法依赖的package包/类
private void mainScreen(final Stage primaryStage) {
GridPane grid = new GridPane();
grid.setAlignment(Pos.CENTER);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(25, 25, 25, 25));
Text scenetitle = new Text("Game Of Life");
scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
grid.add(scenetitle, 0, 0);
Label heightLabel = new Label("Height:");
grid.add(heightLabel, 0, 2);
final TextField heightField = new TextField();
heightField.setText(String.valueOf(fieldHeight));
grid.add(heightField, 1, 2);
Label widthLabel = new Label("Width:");
grid.add(widthLabel, 0, 3);
final TextField widthField = new TextField();
widthField.setText(String.valueOf(fieldWidth));
grid.add(widthField, 1, 3);
Label cellDensityLabel = new Label("Cell density:");
grid.add(cellDensityLabel, 0, 4);
final Slider cellDensitySlider = new Slider();
cellDensitySlider.setMin(0);
cellDensitySlider.setMax(1);
cellDensitySlider.setValue(cellDensity);
cellDensitySlider.setShowTickLabels(true);
cellDensitySlider.setShowTickMarks(true);
cellDensitySlider.setMajorTickUnit(0.50);
cellDensitySlider.setMinorTickCount(10);
grid.add(cellDensitySlider, 1, 4);
final Label errorLabel = new Label("");
errorLabel.setMinSize(150, 10);
grid.add(errorLabel, 0, 6);
Button start = new Button("Start");
start.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
fieldHeight = Integer.parseInt(heightField.getText());
fieldWidth = Integer.parseInt(widthField.getText());
cellDensity = cellDensitySlider.getValue();
gameScreen(primaryStage);
} catch (NumberFormatException e) {
errorLabel.setText("Please enter an integer.");
}
}
});
grid.add(start,1,5);
Scene scene = new Scene(grid);
primaryStage.setScene(scene);
}
示例5: createMemoryControlPanel
import javafx.scene.control.Label; //导入方法依赖的package包/类
private Node createMemoryControlPanel()
{
BorderPane addressPanel = new BorderPane();
Label watchAddressLabel = new Label("Watch Address: ");
addressPanel.setLeft(watchAddressLabel);
setAlignment(watchAddressLabel, Pos.CENTER);
TextField addressField = new TextField();
addressPanel.setCenter(addressField);
setAlignment(addressField, Pos.CENTER);
Button watchAddressButton = new Button("Add");
watchAddressButton.setOnAction((event) -> watchMemoryAddress(addressField
.getText()));
addressPanel.setRight(watchAddressButton);
setAlignment(watchAddressButton, Pos.CENTER);
BorderPane rangePanel = new BorderPane();
Label watchRangeFromLabel = new Label("Watch Range From ");
rangePanel.setLeft(watchRangeFromLabel);
setAlignment(watchRangeFromLabel, Pos.CENTER);
HBox inputBox = new HBox();
TextField fromField = new TextField();
inputBox.getChildren().add(fromField);
fromField.setPrefWidth(Integer.MAX_VALUE);
Label toLabel = new Label(" To ");
toLabel.setMinSize(Label.USE_PREF_SIZE, Label.USE_PREF_SIZE);
inputBox.getChildren().add(toLabel);
inputBox.setAlignment(Pos.CENTER);
TextField toField = new TextField();
toField.setPrefWidth(Integer.MAX_VALUE);
inputBox.getChildren().add(toField);
rangePanel.setCenter(inputBox);
setAlignment(inputBox, Pos.CENTER);
Button watchRangeButton = new Button("Add");
watchRangeButton.setOnAction((event) -> watchMemoryRange(fromField.getText(),
toField.getText()));
rangePanel.setRight(watchRangeButton);
setAlignment(watchRangeButton, Pos.CENTER);
Pair<Node, ComboBox<String>> optionsRowPair = createDisplayOptionsRow();
Node displayOptions = optionsRowPair.getKey();
ComboBox<String> displayDropdown = optionsRowPair.getValue();
displayDropdown.setOnAction((event) -> {
String selection = displayDropdown.getSelectionModel().getSelectedItem();
Function<Long, String> function = valueDisplayOptions.get(selection);
memoryDisplayFunction.set(function);
});
VBox controlPanel = new VBox();
controlPanel.getChildren().add(addressPanel);
controlPanel.getChildren().add(rangePanel);
controlPanel.getChildren().add(displayOptions);
controlPanel.setAlignment(Pos.CENTER);
setAlignment(controlPanel, Pos.CENTER);
controlPanel.setPadding(new Insets(CP_PADDING));
controlPanel.setSpacing(CP_SPACING);
return controlPanel;
}
示例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();
}