Java Code Examples for javafx.scene.layout.Region#setMouseTransparent()

The following examples show how to use javafx.scene.layout.Region#setMouseTransparent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PushButtonSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void initGraphics() {
    frame = new Region();
    frame.getStyleClass().setAll("frame");

    outerBorder = new Region();
    outerBorder.getStyleClass().setAll("outer-border");

    innerBorder = new Region();
    innerBorder.getStyleClass().setAll("inner-border");

    body = new Region();
    body.getStyleClass().setAll("body");
    body.setMouseTransparent(true);

    text = new Text("Push");
    text.setTextOrigin(VPos.CENTER);
    text.setMouseTransparent(true);
    text.getStyleClass().setAll("text");

    pane.getChildren().setAll(frame,
                              outerBorder,
                              innerBorder,
                              body,
                              text);

    getChildren().setAll(pane);
    resize();
}
 
Example 2
Source File: OnOffSwitchSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void initGraphics() {
    Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.5 * PREFERRED_HEIGHT)); // "OpenSans"
    font = Font.font("Open Sans", 0.5 * PREFERRED_HEIGHT);

    background = new Region();
    background.getStyleClass().setAll("background");
    background.setStyle("-switch-color: " + Util.colorToCss((Color) getSkinnable().getSwitchColor()) + ";");

    selectedText  = new Text("1");
    selectedText.setFont(font);
    selectedText.getStyleClass().setAll("selected-text");
    selectedText.setStyle("-text-color-on: " + Util.colorToCss((Color) getSkinnable().getTextColorOn()) + ";");

    deselectedText = new Text("0");
    deselectedText.setFont(font);
    deselectedText.getStyleClass().setAll("deselected-text");
    deselectedText.setStyle("-text-color-off: " + Util.colorToCss((Color) getSkinnable().getTextColorOff()) + ";");

    thumb = new Region();
    thumb.getStyleClass().setAll("thumb");
    thumb.setMouseTransparent(true);
    thumb.setStyle("-thumb-color: " + Util.colorToCss((Color) getSkinnable().getThumbColor()) + ";");

    pane = new Pane(background, selectedText, deselectedText, thumb);
    pane.getStyleClass().setAll("on-off-switch");

    moveToDeselected = new TranslateTransition(Duration.millis(180), thumb);
    moveToSelected = new TranslateTransition(Duration.millis(180), thumb);

    // Add all nodes
    getChildren().setAll(pane);
}
 
Example 3
Source File: IconSwitchSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void initGraphics() {
    Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.5 * PREFERRED_HEIGHT)); // "OpenSans"
    font = Font.font("Open Sans", 0.5 * PREFERRED_HEIGHT);

    background = new Region();
    background.getStyleClass().setAll("background");
    background.setStyle("-switch-color: " + Util.colorToCss((Color) getSkinnable().getSwitchColor()) + ";");

    symbol = getSkinnable().getSymbol();
    symbol.setMouseTransparent(true);

    text = new Label(getSkinnable().getText());
    text.setTextAlignment(TextAlignment.CENTER);
    text.setAlignment(Pos.CENTER);
    text.setTextFill(getSkinnable().getSymbolColor());
    text.setFont(font);

    thumb = new Region();
    thumb.getStyleClass().setAll("thumb");
    thumb.setStyle("-thumb-color: " + Util.colorToCss((Color) getSkinnable().getThumbColor()) + ";");
    thumb.setMouseTransparent(true);

    pane = new Pane(background, symbol, text, thumb);
    pane.getStyleClass().setAll("icon-switch");

    moveToDeselected = new TranslateTransition(Duration.millis(180), thumb);
    moveToSelected = new TranslateTransition(Duration.millis(180), thumb);

    // Add all nodes
    getChildren().setAll(pane);
}
 
Example 4
Source File: MenuButton.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void initGraphics() {
    setPickOnBounds(false);

    cross = new Region();
    cross.getStyleClass().add("cross");
    cross.setMouseTransparent(true);
    crossRotate = new RotateTransition(Duration.millis(200), cross);
    crossRotate.setInterpolator(Interpolator.EASE_BOTH);

    // Add all nodes
    getChildren().addAll(cross);
}
 
Example 5
Source File: SelectionStripSkin.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
/**
 * Constructor for all SkinBase instances.
 *
 * @param strip The strip for which this Skin should attach to.
 */
public SelectionStripSkin(SelectionStrip<T> strip) {
  super(strip);

  content = new HBox();
  content.setMinWidth(Region.USE_PREF_SIZE);
  content.setMaxWidth(Double.MAX_VALUE);
  content.setAlignment(Pos.CENTER_LEFT);

  leftBtn = new Region();
  leftBtn.getStyleClass().addAll("scroller", "left");
  leftBtn.setOpacity(0);
  leftBtn.setVisible(false);

  rightBtn = new Region();
  rightBtn.getStyleClass().addAll("scroller", "right");
  rightBtn.setOpacity(0);
  rightBtn.setVisible(false);

  leftFader = new Region();
  leftFader.setMouseTransparent(true);
  leftFader.getStyleClass().addAll("fader", "left");
  leftFader.setOpacity(0);

  rightFader = new Region();
  rightFader.setMouseTransparent(true);
  rightFader.getStyleClass().addAll("fader", "right");
  rightFader.setOpacity(0);

  getChildren().addAll(content, leftFader, rightFader, leftBtn, rightBtn);
  getChildren().forEach(child -> child.setManaged(false));

  Rectangle clip = new Rectangle();
  clip.widthProperty().bind(strip.widthProperty());
  clip.heightProperty().bind(strip.heightProperty());
  getSkinnable().setClip(clip);

  setupListeners();
  setupBindings();
  setupEventHandlers();

  strip.itemsProperty().addListener((Observable it) -> buildContent());
  buildContent();
}