本文整理汇总了Java中javafx.scene.control.ContentDisplay类的典型用法代码示例。如果您正苦于以下问题:Java ContentDisplay类的具体用法?Java ContentDisplay怎么用?Java ContentDisplay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContentDisplay类属于javafx.scene.control包,在下文中一共展示了ContentDisplay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StackPaneSample
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
public StackPaneSample() {
StackPane stackPane = new StackPane();
Rectangle rectangle = new Rectangle(280, 70, Color.BISQUE);
rectangle.setStroke(Color.BLACK);
ImageView imageView = new ImageView(ICON_48);
Label label = new Label("Your name could be here.", imageView);
label.setContentDisplay(ContentDisplay.RIGHT);
stackPane.getChildren().addAll(rectangle, label);
getChildren().add(stackPane);
}
示例2: addIntegrationButtonsToVbox
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
private void addIntegrationButtonsToVbox(Integration integration, VBox vbox)
{
for (String buttonKey : integration.getActions().keySet())
{
System.out.println("*" + buttonKey);
final Action clickableButton = integration.getActions().get(buttonKey);
if (clickableButton.isHiddenFromFrontend())
{
continue;
}
final Button jfxButton = new Button(clickableButton.getName());
jfxButton.setPadding(new Insets(2, 4, 2, 4));
jfxButton.setMinWidth(256);
jfxButton.setMaxWidth(256);
jfxButton.setAlignment(Pos.BASELINE_LEFT);
jfxButton.setContentDisplay(ContentDisplay.RIGHT);
jfxButton.setTooltip(new Tooltip(buttonKey + "\n" + clickableButton.getDescription())); // I tried it, but it looks a bit janky
jfxButton.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent arg0)
{
try
{
triggerEvent("<" + clickableButton.getName() + "> from frontend", null);
clickableButton.onAction(null);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
vbox.getChildren().add(jfxButton);
}
}
示例3: CheckBoxListCell
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
public CheckBoxListCell(
final Callback<T, ObservableValue<Boolean>> getSelectedProperty,
final BooleanProperty disableProperty,
final StringConverter<T> converter
) {
this.getStyleClass().add("check-box-list-cell");
setSelectedStateCallback(getSelectedProperty);
setConverter(converter);
checkBox = new CheckBox();
checkBox.disableProperty().bind(disableProperty);
setAlignment(Pos.CENTER_LEFT);
setContentDisplay(ContentDisplay.LEFT);
// by default the graphic is null until the cell stops being empty
setGraphic(null);
}
示例4: startEdit
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
@Override
public void startEdit()
{
super.startEdit();
if (textField == null)
{
createTextField();
}
setGraphic(textField);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
Platform.runLater(new Runnable()
{
@Override
public void run()
{
textField.requestFocus();
textField.selectAll();
}
});
}
示例5: LogTooltip
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
public LogTooltip(List<GridEntry> gridEntries){
super();
this.gridEntries = gridEntries;
GridPane grid = new GridPane();
grid.setHgap(GRID_HGAP);
for(int Cnt = 0; Cnt < gridEntries.size(); Cnt++){
grid.add(new Rectangle(LABEL_RECT_SIZE, LABEL_RECT_SIZE, gridEntries.get(Cnt).getColor()), 0, Cnt);
grid.add(gridEntries.get(Cnt).getLabel(), 1, Cnt);
grid.add(gridEntries.get(Cnt).getContentLabel(), 2, Cnt);
}
this.setContentDisplay(ContentDisplay.BOTTOM);
this.setGraphic(grid);
}
示例6: IconButton
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
public IconButton(String buttonText, String imageLoc, String tooltipText, EventHandler<ActionEvent> actionEventHandler) {
super(buttonText);
setTooltip(new Tooltip(tooltipText));
getStyleClass().add("icon-button");
setMaxWidth(Double.MAX_VALUE);
setAlignment(Pos.CENTER_LEFT);
final ImageView imageView = new ImageView(ResourceUtil.getImage(imageLoc));
imageView.setFitHeight(16);
imageView.setPreserveRatio(true);
setGraphic(imageView);
setContentDisplay(ContentDisplay.LEFT);
VBox.setMargin(this, new Insets(0, 5, 0, 5));
setOnAction(actionEventHandler);
}
示例7: ColorPickerTableCell
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
public ColorPickerTableCell(TableColumn<T, Color> column , ColorCellFactory parent) {
this.parent = parent;
this.colorPicker = new ColorPicker();
this.colorPicker.getStyleClass().add("button");
this.colorPicker.setStyle("-fx-color-label-visible:false;");
this.colorPicker.editableProperty().bind(column.editableProperty());
this.colorPicker.disableProperty().bind(column.editableProperty().not());
this.colorPicker.setOnShowing(event -> {
final TableView<T> tableView = getTableView();
tableView.getSelectionModel().clearSelection();
tableView.getSelectionModel().select(getTableRow().getIndex());
tableView.edit(getIndex(), column);
});
this.colorPicker.valueProperty().addListener((observable, oldValue, newValue) -> {
if (isEditing()) {
commitEdit(newValue);
parent.chage(getIndex());
}
});
// 텍스트는 화면에 보여주지않음.
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}
示例8: BasicMacroItemCategory
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
public BasicMacroItemCategory() {
final double height = 100;
VBox vb = new VBox(10);
categoryNode = vb;
ResourceBundle bundle = Lang.ApplicationBundle();
taComment.setPrefHeight(height);
taComment.setEditable(false);
Label lblComment = new Label(bundle.getString("Macros.comment"), taComment);
lblComment.setContentDisplay(ContentDisplay.BOTTOM);
taValue.setEditable(false);
taValue.setPrefHeight(height);
Label lblValue = new Label(bundle.getString("Macros.value"), taValue);
lblValue.setContentDisplay(ContentDisplay.BOTTOM);
lblMacroPropertyType = new Label(String.format(bundle.getString("Popups.ChooseMacro.property_type"), "?"));
vb.getChildren().addAll(lblValue, lblComment, lblMacroPropertyType);
}
示例9: startEdit
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
@Override
public void startEdit() {
super.startEdit();
if (isEmpty()) {
return;
}
if (textBox == null) {
createTextBox();
} else {
textBox.setText(getItem());
}
setGraphic(textBox);
setContentDisplay(ContentDisplay.TEXT_ONLY);
textBox.requestFocus();
textBox.selectAll();
}
示例10: setButtonImages
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
private void setButtonImages() {
// new
ImageView newView = new ImageView(new Image("images/New.png", 16, 16, true, true));
btNew.setGraphic(newView);
btNew.setContentDisplay(ContentDisplay.RIGHT);
// save
ImageView saveView = new ImageView(new Image("images/Save.png", 16, 16, true, true));
btSave.setGraphic(saveView);
btSave.setContentDisplay(ContentDisplay.RIGHT);
// delete
ImageView deleteView = new ImageView(new Image("images/Delete.png", 16, 16, true, true));
btDelete.setGraphic(deleteView);
btDelete.setContentDisplay(ContentDisplay.RIGHT);
// refresh
ImageView refreshView = new ImageView(new Image("images/Refresh.png", 16, 16, true, true));
btRefresh.setGraphic(refreshView);
btRefresh.setContentDisplay(ContentDisplay.RIGHT);
}
示例11: updateItem
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
/**
*
* @param item
* @param empty
*/
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (!empty) {
// Show the Text Field
this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
ObservableValue<String> ov = getTableColumn().getCellObservableValue(getIndex());
SimpleStringProperty sp = (SimpleStringProperty) ov;
if (this.boundToCurrently == null) {
this.boundToCurrently = sp;
this.textField.textProperty().bindBidirectional(sp);
} else if (this.boundToCurrently != sp) {
this.textField.textProperty().unbindBidirectional(this.boundToCurrently);
this.boundToCurrently = sp;
this.textField.textProperty().bindBidirectional(this.boundToCurrently);
}
} else {
this.setContentDisplay(ContentDisplay.TEXT_ONLY);
}
}
示例12: updateItem
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
@Override
public void updateItem(TMACoreObject item, boolean empty) {
super.updateItem(item, empty);
setWidth(150);
setHeight(150);
setMaxWidth(200);
setMaxHeight(200);
if (item == null || empty) {
setText(null);
setGraphic(null);
setTooltip(null);
return;
}
if (item.isMissing())
setTextFill(ColorToolsFX.getCachedColor(PathPrefs.getTMACoreMissingColor()));
else
setTextFill(ColorToolsFX.getCachedColor(PathPrefs.getTMACoreColor()));
setAlignment(Pos.CENTER);
setTextAlignment(TextAlignment.CENTER);
setContentDisplay(ContentDisplay.CENTER);
setText(getDisplayString(item));
tooltip.setText(getExtendedDescription(item));
setTooltip(tooltip);
}
示例13: RadialMenuSkinBase
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
/**
* Constructor for all SkinBase instances.
*
* @param control The control for which this Skin should attach to.
*/
public RadialMenuSkinBase(C control, B button) {
super(control);
this.button = button;
this.model = control;
button.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
getChildren().add(button);
bindSize();
bindGraphic();
bindTooltip();
bindCoords();
button.setVisible(false);
updateVisibility();
}
示例14: SelectableTitledPane
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
public SelectableTitledPane(String title, Node content) {
super(title, content);
checkBox = new CheckBox(title);
checkBox.selectedProperty().
bindBidirectional(this.expandedProperty());
setExpanded(false);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(checkBox);
setSkin(new TitledPaneSkin(this));
lookup(".arrow").
setVisible(false);
lookup(".title").
setStyle("-fx-padding: 0 0 4 -10;"
+ "-fx-font-color: white;"
+ "-fx-background-color: black;");
lookup(".content").
setStyle("-fx-background-color: black;"
+ "-fx-font-color: white;"
+ "-fx-font-smoothing-type: lcd;"
+ "-fx-padding: 0.2em 0.2em 0.2em 1.316667em;");
}
示例15: ItemTypePanes
import javafx.scene.control.ContentDisplay; //导入依赖的package包/类
public ItemTypePanes(Consumer<List<ItemType>> onChangeConsumer) {
this.onChangeConsumer = onChangeConsumer;
itemTypesChkbxs = Arrays.asList(ItemType.values())
.stream()
.map(it -> {
ToggleButton chbBx = new ToggleButton(it.displayName());
chbBx.setUserData(it);
chbBx.setMinWidth(PREF_TILE_WIDTH);
chbBx.setMinHeight(PREF_TILE_HEIGHT);
chbBx.setGraphic(new ImageView(ImageCache.getInstance().get(it.icon())));
chbBx.setContentDisplay(ContentDisplay.RIGHT);
chbBx.setOnAction(e -> checked());
return chbBx;
})
.collect(Collectors.toList());
itemTypePane1 = new ItemTypePane(itemTypesChkbxs.subList(0, 8));
itemTypePane2 = new ItemTypePane(itemTypesChkbxs.subList(8, 17));
itemTypePane3 = new ItemTypePane(itemTypesChkbxs.subList(17, 30));
}