本文整理匯總了Java中javafx.css.PseudoClass類的典型用法代碼示例。如果您正苦於以下問題:Java PseudoClass類的具體用法?Java PseudoClass怎麽用?Java PseudoClass使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PseudoClass類屬於javafx.css包,在下文中一共展示了PseudoClass類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import javafx.css.PseudoClass; //導入依賴的package包/類
private void init() {
editableState = false;
Platform.runLater(this::updateVisibleText);
// Register listeners and binds
editableLabel.getPseudoClassStates().addListener( (SetChangeListener<PseudoClass>) e -> {
if (e.getSet().contains(PseudoClass.getPseudoClass("editable"))) {
if ( !editableState ) {
// editableState change to editable
editableState = true;
updateVisibleText();
}
} else {
if ( editableState ) {
// editableState change to not editable
editableState = false;
updateVisibleText();
}
}
});
editableLabel.widthProperty().addListener( observable -> updateVisibleText() );
editableLabel.baseTextProperty().addListener( observable -> updateVisibleText() );
}
示例2: calculateFocusNodes
import javafx.css.PseudoClass; //導入依賴的package包/類
private int calculateFocusNodes(final Node node) {
int result = 0;
if (node instanceof javafx.scene.Parent) {
javafx.scene.Parent parent = (javafx.scene.Parent) node;
ObservableList<Node> childs = parent.getChildrenUnmodifiable();
if (!childs.isEmpty()) {
for (Node n : childs) {
result += calculateFocusNodes(n);
}
}
}
Set<PseudoClass> pseudoStates = node.getPseudoClassStates();
if (node.isFocused() || pseudoStates.contains(PseudoClass.getPseudoClass(FOCUSED_PSEUDO_CLASS))) {
System.out.println(node);
System.out.println(pseudoStates);
result++;
}
return (result);
}
示例3: waitPseudoState
import javafx.css.PseudoClass; //導入依賴的package包/類
protected void waitPseudoState(Boolean state) {
specialButtonWrap.waitState(new State<Boolean>() {
@Override
public Boolean reached() {
Set<PseudoClass> set = getSpecialButtonPseudoClasses();
return set.contains(MOUSE_PRESSED_PSEUDO_CLASS);
}
}, state);
specialButtonWrap.waitState(new State<Integer>() {
@Override
public Integer reached() {
return getActualFontSize();
}
}, state ? FONT_SIZE_CONST : initialFontSize);
}
示例4: SearchBox
import javafx.css.PseudoClass; //導入依賴的package包/類
public SearchBox(final TableView<T> table, final String prompt) {
this.table = table;
setText(prompt);
pseudoClassStateChanged(PseudoClass.getPseudoClass("prompting"), prompting);
textProperty().addListener(e -> updateTableView());
focusedProperty().addListener((e, o, n) -> {
if (n && prompting) {
prompting = false;
setText("");
} else if (!n && getText().equals("")) {
prompting = true;
setText(prompt);
}
pseudoClassStateChanged(PseudoClass.getPseudoClass("prompting"), prompting);
});
}
示例5: initPreviousButton
import javafx.css.PseudoClass; //導入依賴的package包/類
private void initPreviousButton() {
previousCircle.radiusProperty().set(previousButton.prefWidth(-1) / 2);
double pW = previousButtonContainer.prefWidth(-1);
double pH = previousButtonContainer.prefHeight(-1);
previousButtonContainer.setScaleX(iconW / pW);
previousButtonContainer.setScaleY(iconH / pH);
double paddingH = (iconW - pW) / 2;
double paddingV = (iconH - pH) / 2;
HBox.setMargin(previousButtonContainer, new Insets(paddingV, paddingH, paddingV, paddingH));
InvalidationListener onHoveredChange = dummy -> previousCircle.pseudoClassStateChanged(PseudoClass.getPseudoClass("button-hovered"),
previousCircle.isHover() || previousButton.isHover());
previousCircle.hoverProperty().addListener(onHoveredChange);
previousButton.hoverProperty().addListener(onHoveredChange);
InvalidationListener onPressedChange = dummy -> previousCircle.pseudoClassStateChanged(PseudoClass.getPseudoClass("button-pressed"),
previousCircle.isPressed() || previousButton.isPressed());
previousCircle.pressedProperty().addListener(onPressedChange);
previousButton.pressedProperty().addListener(onPressedChange);
EventHandler<MouseEvent> onClick = event -> model.hide();
previousCircle.setOnMouseClicked(onClick);
previousButton.setOnMouseClicked(onClick);
}
示例6: prepare
import javafx.css.PseudoClass; //導入依賴的package包/類
private void prepare() {
buildFileBrowserTreeTableView(treeTableView);
final PseudoClass firstRowClass = PseudoClass.getPseudoClass("first-row");
treeTableView.setRowFactory(treeTable -> {
TreeTableRow<File> row = new TreeTableRow<File>();
row.treeItemProperty().addListener((ov, oldTreeItem, newTreeItem) ->
row.pseudoClassStateChanged(firstRowClass, newTreeItem == treeTable.getRoot()));
row.setContextMenu(rightClickContextMenu);
return row;
});
treeTableView.setOnMouseClicked(
new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if (mouseEvent.getClickCount() == 2) {
openSelectedTreeitemInHmdEditor();
}
}
});
// this.getChildren().add(treeTableView);
}
示例7: show
import javafx.css.PseudoClass; //導入依賴的package包/類
public void show(String message, String pseudoClass, String actionText, long timeout, EventHandler<ActionEvent> actionHandler) {
toast.setText(message);
if (actionText != null && !actionText.isEmpty()) {
action.setVisible(true);
actionContainer.setVisible(true);
actionContainer.setManaged(true);
// to force updating the layout bounds
action.setText("");
action.setText(actionText);
action.setOnAction(actionHandler);
} else {
actionContainer.setVisible(false);
actionContainer.setManaged(false);
action.setVisible(false);
}
openAnimation = getTimeline(timeout);
if (pseudoClass != null) {
activePseudoClass = pseudoClass;
content.pseudoClassStateChanged(PseudoClass.getPseudoClass(activePseudoClass), true);
}
openAnimation.play();
}
示例8: setupRowFactory
import javafx.css.PseudoClass; //導入依賴的package包/類
/**
* Change the row color whenever an alert is fired
*/
protected void setupRowFactory() {
PseudoClass alert = PseudoClass.getPseudoClass("alert");
ekgDataTable.setRowFactory(tableView -> {
TableRow<EKGDataPacket> row = new TableRow<>();
row.itemProperty().addListener((obs, previousAlert, currentAlert) -> {
if (currentAlert != null) {
row.pseudoClassStateChanged(alert, ((EKGDataPacket) currentAlert).getAlertsTriggered().length() > 0);
} else {
row.pseudoClassStateChanged(alert, false);
}
});
return row;
});
}
示例9: addPseudoClassToLeafs
import javafx.css.PseudoClass; //導入依賴的package包/類
private void addPseudoClassToLeafs(TreeView<Path> tree) {
PseudoClass leaf = PseudoClass.getPseudoClass("leaf");
tree.setCellFactory(tv -> {
TreeCell<Path> cell = new TreeCell<>();
cell.itemProperty().addListener((obs, oldValue, newValue) -> {
if (newValue == null) {
cell.setText("");
cell.setGraphic(null);
} else {
cell.setText(newValue.toFile().getName());
cell.setGraphic(cell.getTreeItem().getGraphic());
}
});
cell.treeItemProperty().addListener((obs, oldTreeItem, newTreeItem) -> cell.pseudoClassStateChanged(leaf,
newTreeItem != null && newTreeItem.isLeaf()));
return cell;
});
}
示例10: includePseudoClassWhen
import javafx.css.PseudoClass; //導入依賴的package包/類
public static void includePseudoClassWhen(Node node, PseudoClass pseudoClass, ObservableValue<? extends Boolean> condition) {
BooleanProperty pseudoClassState = new BooleanPropertyBase(false) {
@Override
protected void invalidated() {
node.pseudoClassStateChanged(pseudoClass, get());
}
@Override
public Object getBean() {
return node;
}
@Override
public String getName() {
return pseudoClass.getPseudoClassName();
}
};
pseudoClassState.bind(condition);
}
示例11: LinearIndicator
import javafx.css.PseudoClass; //導入依賴的package包/類
@SuppressWarnings("JavadocMethod")
public LinearIndicator() {
getStyleClass().add("linear-indicator");
value.addListener(__ -> setRangeBounds());
center.addListener(__ -> setRangeBounds());
maxProperty().addListener(__ -> setRangeBounds());
minProperty().addListener(__ -> setRangeBounds());
setDisable(true);
pseudoClassStateChanged(PseudoClass.getPseudoClass("disabled"), false);
}
示例12: init
import javafx.css.PseudoClass; //導入依賴的package包/類
private void init() {
// name
name.bind(Bindings.when(file.isNull())
.then(Bindings.createStringBinding(() -> "new" + order.get(), order))
.otherwise(toStringBinding(map(file, f -> f.getName()))));
// graphics
tab.setGraphic(icon);
icon.setStyleClass("tab-icon");
icon.setIcon(FontAwesomeIcon.SAVE);
// Hold the object in cache to avoid gc
StringBinding state = CacheUtil.cache(this, "state",
() -> Bindings.when(Bindings.equal(toObjectBinding(currentTabEntity()), this))
.then(Bindings.when(manager.modifiedProperty())
.then("selected-modified")
.otherwise("selected"))
.otherwise(Bindings.when(manager.modifiedProperty())
.then("modified")
.otherwise("")));
state.addListener((ob, o, n) -> {
uncatch(() -> icon.pseudoClassStateChanged(PseudoClass.getPseudoClass(o), false));
uncatch(() -> icon.pseudoClassStateChanged(PseudoClass.getPseudoClass(n), true));
});
// recent
file.addListener((ob, o, n) -> todoAll(
() -> ifThat(n != null).todo(() -> recentSupport.setLastFile(n)),
() -> ifThat(o == null && n != null).todo(() -> releaseName())
));
}
示例13: OptionsDialog
import javafx.css.PseudoClass; //導入依賴的package包/類
OptionsDialog() {
super(Main.getString("deskchan_options"));
instance = this;
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
tabPane.setTabMaxWidth(0);
tabPane.setTabMaxHeight(0);
tabPane.setSide(Side.RIGHT);
tabPane.pseudoClassStateChanged(PseudoClass.getPseudoClass("right"), false);
tabPane.pseudoClassStateChanged(PseudoClass.getPseudoClass(TabPane.STYLE_CLASS_FLOATING), true);
tabListView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
initTabs();
syncTabListViewItems();
tabPane.getTabs().addListener((ListChangeListener<Tab>) change -> syncTabListViewItems());
tabListView.getSelectionModel().selectedIndexProperty().addListener((observableValue, oldValue, newValue) ->
tabPane.getSelectionModel().select(newValue.intValue()));
HBox contentPane = new HBox();
contentPane.getChildren().add(tabListView);
contentPane.getChildren().add(tabPane);
/* !!! FIXME: Begin of dirty code !!! */
HBox.setMargin(tabPane, new Insets(0, -13, 0, 6));
Rectangle clipRect = new Rectangle();
clipRect.widthProperty().bind(contentPane.widthProperty().subtract(13));
clipRect.heightProperty().bind(contentPane.heightProperty());
contentPane.setClip(clipRect);
/* !!! End of dirty code !!! */
getDialogPane().setContent(contentPane);
setOnHidden(event -> {
instance = null;
});
}
示例14: changePseudoClass
import javafx.css.PseudoClass; //導入依賴的package包/類
private void changePseudoClass(ObservableSet<PseudoClass> pseudoClassStates) {
pseudoClassStateChanged(oldPseudoClass, false);
if (pseudoClassStates != null) {
for (PseudoClass pseudoClass : pseudoClassStates) {
if (!COMMON_CELL_PSEUDO_CLASSES.contains(pseudoClass.getPseudoClassName())) {
pseudoClassStateChanged(pseudoClass, true);
oldPseudoClass = pseudoClass;
break;
}
}
}
}
示例15: Distance
import javafx.css.PseudoClass; //導入依賴的package包/類
Distance (double lowerBound, String cssClass, String audioTrack) {
this.lowerBound = lowerBound;
if (cssClass != null) {
cssPseudoClass = PseudoClass.getPseudoClass(cssClass);
}
this.audioTrack = audioTrack;
}