當前位置: 首頁>>代碼示例>>Java>>正文


Java PseudoClass類代碼示例

本文整理匯總了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() );
}
 
開發者ID:vibridi,項目名稱:fxutils,代碼行數:25,代碼來源:EditableLabelSkin.java

示例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);

    }
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:22,代碼來源:FocusTestBase.java

示例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);
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:17,代碼來源:CustomPseudoClassTest.java

示例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);
	});
}
 
開發者ID:mbway,項目名稱:Simulizer,代碼行數:17,代碼來源:SearchBox.java

示例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);
}
 
開發者ID:to2mbn,項目名稱:LoliXL,代碼行數:22,代碼來源:PanelView.java

示例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);
    }
 
開發者ID:SohanChy,項目名稱:Lipi,代碼行數:27,代碼來源:FileTreeTable.java

示例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();
}
 
開發者ID:jfoenixadmin,項目名稱:JFoenix,代碼行數:23,代碼來源:JFXSnackbar.java

示例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;
    });
}
 
開發者ID:CowboyJim,項目名稱:mm3Capture,代碼行數:24,代碼來源:CaptureTablePanelController.java

示例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;
	});
}
 
開發者ID:RPTools,項目名稱:tokentool,代碼行數:20,代碼來源:TokenTool_Controller.java

示例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);
}
 
開發者ID:JabRef,項目名稱:jabref,代碼行數:20,代碼來源:BindingsHelper.java

示例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);
}
 
開發者ID:wpilibsuite,項目名稱:shuffleboard,代碼行數:11,代碼來源:LinearIndicator.java

示例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())
      ));
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:31,代碼來源:MainFrameController.java

示例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;
	});
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:31,代碼來源:OptionsDialog.java

示例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;
            }
        }
    }
}
 
開發者ID:gluonhq,項目名稱:javaone2016,代碼行數:13,代碼來源:SearchCell.java

示例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;
}
 
開發者ID:FrancisG-Massey,項目名稱:Capstone2016,代碼行數:8,代碼來源:NavigationView.java


注:本文中的javafx.css.PseudoClass類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。