本文整理匯總了Java中javafx.css.PseudoClass.getPseudoClass方法的典型用法代碼示例。如果您正苦於以下問題:Java PseudoClass.getPseudoClass方法的具體用法?Java PseudoClass.getPseudoClass怎麽用?Java PseudoClass.getPseudoClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.css.PseudoClass
的用法示例。
在下文中一共展示了PseudoClass.getPseudoClass方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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;
});
}
示例3: 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;
});
}
示例4: 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;
}
示例5: PseudoClassProperty
import javafx.css.PseudoClass; //導入方法依賴的package包/類
/**
* Creates a property for the specific node and pseudoClass.
*/
public PseudoClassProperty(Node node, String pseudoClass) {
this.node = node;
this.name = pseudoClass;
this.pseudoClass = PseudoClass.getPseudoClass(pseudoClass);
}
示例6: addPseudoClass
import javafx.css.PseudoClass; //導入方法依賴的package包/類
public static void addPseudoClass( Node node, String className ){
PseudoClass pseudoClass = PseudoClass.getPseudoClass( className );
node.pseudoClassStateChanged( pseudoClass, true );
}
示例7: initialize
import javafx.css.PseudoClass; //導入方法依賴的package包/類
public void initialize() {
edition.setShowTransitionFactory(BounceInRightTransition::new);
PseudoClass pseudoClassDisable = PseudoClass.getPseudoClass("disabled");
edition.showingProperty().addListener((obs, oldValue, newValue) -> {
if (newValue) {
submit.disableProperty().unbind();
Comment activeComment = service.activeCommentProperty().get();
if (activeComment != null) {
// disable avatar in case comment is not editable
// content is enabled if user is its author
commentsText.setDisable(!activeComment.getNetworkId().equals(service.getUser().getNetworkId()));
avatar.pseudoClassStateChanged(pseudoClassDisable, commentsText.isDisable());
avatar.setImage(Service.getUserImage(activeComment.getImageUrl()));
authorText.setText(activeComment.getAuthor());
commentsText.setText(activeComment.getContent());
submit.setText("Apply");
submit.disableProperty().bind(Bindings.createBooleanBinding(()->{
return authorText.textProperty()
.isEqualTo(activeComment.getAuthor())
.and(commentsText.textProperty()
.isEqualTo(activeComment.getContent())).get();
}, authorText.textProperty(),commentsText.textProperty()));
editMode = true;
} else {
commentsText.setDisable(false);
avatar.pseudoClassStateChanged(pseudoClassDisable, false);
avatar.setImage(Service.getUserImage(service.getUser().getPicture()));
authorText.setText(service.getUser().getName());
submit.setText("Submit");
submit.disableProperty().bind(Bindings.createBooleanBinding(() -> {
return authorText.textProperty()
.isEmpty()
.or(commentsText.textProperty()
.isEmpty()).get();
}, authorText.textProperty(), commentsText.textProperty()));
editMode = false;
}
authorText.setDisable(!authorText.getText().isEmpty());
AppBar appBar = getApp().getAppBar();
appBar.setNavIcon(MaterialDesignIcon.MENU.button(e ->
getApp().showLayer(DRAWER_LAYER)));
appBar.setTitleText("Edition");
} else {
authorText.clear();
commentsText.clear();
}
});
Services.get(DisplayService.class)
.ifPresent(d -> {
if (d.isTablet()) {
avatar.getStyleClass().add("tablet");
}
});
avatar.setImage(Service.getUserImage(service.getUser().getPicture()));
}
示例8: UserActionPane
import javafx.css.PseudoClass; //導入方法依賴的package包/類
public UserActionPane(LoginPane lp, UserManagementController rp) {
super(true);
loginPane = lp;
loginPane.setState(LoginPane.State.LOGINACTIVE);
//registrationController = rp;
BorderPane root = new BorderPane();
userActionPane = new TabPane();
TabPaneSelectionModelImpl selectionModel = new TabPaneSelectionModelImpl(userActionPane);
userActionPane.setSelectionModel(selectionModel);
selectionModel.selectedItemProperty().addListener((ov, oldTab, newTab) -> setState(State.OPEN));
selectionModel.setClickOnSelectedTabListener((tab) -> toggleState(tab));
HBox hbox = new HBox();
// Anchor the controls
AnchorPane anchor = new AnchorPane();
anchor.getChildren().addAll(userActionPane, hbox);
anchor.getStyleClass().addAll("bg-white");
AnchorPane.setTopAnchor(hbox, 3.0);
AnchorPane.setRightAnchor(hbox, 5.0);
AnchorPane.setTopAnchor(userActionPane, 1.0);
AnchorPane.setRightAnchor(userActionPane, 10.0);
AnchorPane.setLeftAnchor(userActionPane, 10.0);
AnchorPane.setBottomAnchor(userActionPane, 10.0);
Tab loginTab = createTab(this.loginPane, MaterialDesignIcon.LOGIN);
loginTab.getContent().maxHeight(100);
//Tab registerTab = createTab(this.registrationController, MaterialDesignIcon.ACCOUNT_PLUS);
userActionPane.getTabs().addAll(loginTab/*, registerTab*/);
userActionPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
tabpaneContentHidden = PseudoClass.getPseudoClass("tabcontenthidden");
root.setCenter(anchor);
this.setState(State.CLOSED);
this.getChildren().addAll(root);
}
示例9: putTableColumns
import javafx.css.PseudoClass; //導入方法依賴的package包/類
@SuppressWarnings({ "unchecked", "rawtypes" })
private void putTableColumns() {
TableColumn<TraceLog,Long> seqColumn;
seqColumn = new TableColumn<TraceLog,Long>("Seq.");
seqColumn.setCellValueFactory(new PropertyValueFactory("instanceNum"));
configureColumnWidth("seqColumnWidth", seqColumn);
TableColumn<TraceLog,String> pidColumn;
pidColumn = new TableColumn<TraceLog,String>("Pid");
pidColumn.setCellValueFactory(new PropertyValueFactory("pidString"));
configureColumnWidth("pidColumnWidth", pidColumn);
TableColumn<TraceLog,String> regNameColumn;
regNameColumn = new TableColumn<TraceLog,String>("Reg. Name");
regNameColumn.setCellValueFactory(new PropertyValueFactory("regName"));
configureColumnWidth("regNameColumnWidth", regNameColumn);
TableColumn<TraceLog,String> durationNameColumn;
durationNameColumn = new TableColumn<TraceLog,String>("Duration (microseconds)");
durationNameColumn.setCellValueFactory(new PropertyValueFactory("duration"));
configureColumnWidth("durationNameColumnWidth", durationNameColumn);
TableColumn<TraceLog,String> functionNameColumn;
functionNameColumn = new TableColumn<TraceLog,String>("Function");
functionNameColumn.setCellValueFactory(new PropertyValueFactory("function"));
configureColumnWidth("functionNameColumnWidth", functionNameColumn);
TableColumn<TraceLog,String> argsColumn;
argsColumn = new TableColumn<TraceLog,String>("Args");
argsColumn.setCellValueFactory(new PropertyValueFactory("args"));
configureColumnWidth("argsColumnWidth", argsColumn);
TableColumn<TraceLog,String> resultColumn;
resultColumn = new TableColumn<TraceLog,String>("Result");
resultColumn.setCellValueFactory(new PropertyValueFactory("result"));
configureColumnWidth("resultColumnWidth", resultColumn);
tracesBox.getColumns().setAll(
seqColumn, pidColumn, regNameColumn, durationNameColumn, functionNameColumn, argsColumn, resultColumn
);
// based on http://stackoverflow.com/questions/27015961/tableview-row-style
PseudoClass exceptionClass = PseudoClass.getPseudoClass("exception");
PseudoClass notCompletedClass = PseudoClass.getPseudoClass("not-completed");
PseudoClass breakerRowClass = PseudoClass.getPseudoClass("breaker-row");
tracesBox.setRowFactory(tv -> {
TableRow<TraceLog> row = new TableRow<>();
ChangeListener<Boolean> completeListener = (obs, oldComplete, newComplete) -> {
row.pseudoClassStateChanged(exceptionClass, row.getItem().isExceptionThrower());
row.pseudoClassStateChanged(notCompletedClass, !row.getItem().isComplete());
};
row.itemProperty().addListener((obs, oldTl, tl) -> {
if (oldTl != null) {
oldTl.isCompleteProperty().removeListener(completeListener);
}
if (tl != null) {
row.pseudoClassStateChanged(notCompletedClass, !row.getItem().isComplete());
if("breaker-row".equals(tl.getCssClass())) {
row.pseudoClassStateChanged(breakerRowClass, true);
row.pseudoClassStateChanged(exceptionClass, false);
row.pseudoClassStateChanged(notCompletedClass, false);
}
else {
tl.isCompleteProperty().addListener(completeListener);
row.pseudoClassStateChanged(breakerRowClass, false);
row.pseudoClassStateChanged(exceptionClass, tl.isExceptionThrower());
}
}
else {
row.pseudoClassStateChanged(exceptionClass, false);
row.pseudoClassStateChanged(notCompletedClass, false);
row.pseudoClassStateChanged(breakerRowClass, false);
}
});
return row ;
});
}