javafx.scene.shape.Rectangle.setStroke()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(252)

本文整理了Java中javafx.scene.shape.Rectangle.setStroke方法的一些代码示例,展示了Rectangle.setStroke的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.setStroke方法的具体详情如下:
包路径:javafx.scene.shape.Rectangle
类名称:Rectangle
方法名:setStroke

Rectangle.setStroke介绍

暂无

代码示例

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

/**
 * {@inheritDoc}
 */
@Override
public void setTextBorderColor( Paint aTextBorderColor ) {
  _rect.setStroke( aTextBorderColor );
}

代码示例来源:origin: org.jrebirth.af/component

private Rectangle buidlRectangle(double stroke) {
  Rectangle r = new Rectangle();
  r.setStrokeType(StrokeType.INSIDE);
  r.setStrokeWidth(stroke);
  r.setStroke(Color.RED);
  r.setFill(Color.TRANSPARENT);
  return r;
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

@Override
  protected void updateItem(Stop item, boolean empty) {
    super.updateItem(item, empty);
    if( item != null && ! empty ) {
      Rectangle r = new Rectangle(20,20,item.getColor());
      r.setStrokeWidth(1);
      r.setStroke(Color.BLACK);
      setGraphic(r);
      setText(FORMAT.format(item.getOffset()*100)+"%"); //$NON-NLS-1$
    } else {
      setGraphic(null);
      setText(null);
    }
  }
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

@Override
  protected void updateItem(Stop item, boolean empty) {
    super.updateItem(item, empty);
    if( item != null && ! empty ) {
      Rectangle r = new Rectangle(20,20,item.getColor());
      r.setStrokeWidth(1);
      r.setStroke(Color.BLACK);
      setGraphic(r);
      setText(FORMAT.format(item.getOffset()*100)+"%"); //$NON-NLS-1$
    } else {
      setGraphic(null);
      setText(null);
    }
  }
}

代码示例来源:origin: org.jrebirth.af/component

private Rectangle buidlRectangle(double stroke) {
  Rectangle r = new Rectangle();
  r.setStrokeType(StrokeType.INSIDE);
  r.setStrokeWidth(stroke);
  r.setStroke(Color.RED);
  r.setFill(Color.TRANSPARENT);
  return r;
}

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

public VCanvas() {
  Rectangle rect = new Rectangle();
  rect.setStroke(new Color(1, 1, 1, 1));
  rect.setFill(new Color(0, 0, 0, 0.5));
  contentProperty().addListener((ov, oldV, newV) -> {
    if (newV != null) {
      MouseControlUtil.
          addSelectionRectangleGesture((Parent) newV, rect);
    }
  });
  setContent(innerCanvas);
  getStyleClass().add("vflow-background");
}

代码示例来源:origin: com.powsybl/powsybl-gse-network-explorer

public SwitchSymbol(Color stroke, double strokeWidth, double size) {
  setPrefSize(size, size);
  leg1 = new Line();
  leg1.setFill(stroke);
  leg1.setStroke(stroke);
  leg1.setStrokeWidth(strokeWidth);
  leg2 = new Line();
  leg2.setFill(stroke);
  leg2.setStroke(stroke);
  leg2.setStrokeWidth(strokeWidth);
  box = new Rectangle();
  box.setFill(Color.TRANSPARENT);
  box.setStroke(stroke);
  box.setStrokeWidth(strokeWidth);
  getChildren().addAll(leg1, leg2, box);
}

代码示例来源:origin: org.gillius/jfxutils

selectRect.setMouseTransparent( true );
selectRect.setOpacity( 0.3 );
selectRect.setStroke( Color.rgb( 0, 0x29, 0x66 ) );
selectRect.setStrokeType( StrokeType.INSIDE );
selectRect.setStrokeWidth( 3.0 );

代码示例来源:origin: org.controlsfx/controlsfx

/**
 * Creates a default ColorGridCell instance.
 */
public ColorGridCell() {
  getStyleClass().add("color-grid-cell"); //$NON-NLS-1$
  
  colorRect = new Rectangle();
  colorRect.setStroke(Color.BLACK);
  colorRect.heightProperty().bind(heightProperty());
  colorRect.widthProperty().bind(widthProperty());   
  setGraphic(colorRect);
  
  if (debug) {
    setContentDisplay(ContentDisplay.TEXT_ONLY);
  }
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Prepare Stage for dock feedback display
 */
void buildDockFeedbackStage() {
 dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT);
 dockFeedback = new Rectangle(0, 0, 100, 100);
 dockFeedback.setArcHeight(10);
 dockFeedback.setArcWidth(10);
 dockFeedback.setFill(Color.TRANSPARENT);
 dockFeedback.setStroke(Color.BLACK);
 dockFeedback.setStrokeWidth(2);
 dockFeedback.setCache(true);
 dockFeedback.setCacheHint(CacheHint.SPEED);
 dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3));
 dockFeedback.setMouseTransparent(true);
 BorderPane borderpane = new BorderPane();
 borderpane.setStyle("-fx-background-color:transparent"); // J8
 borderpane.setCenter(dockFeedback);
 Scene scene = new Scene(borderpane);
 scene.setFill(Color.TRANSPARENT);
 dockFeedbackPopup.setScene(scene);
 dockFeedbackPopup.sizeToScene();
}

代码示例来源:origin: stackoverflow.com

r1.setStroke(Color.BLACK);

代码示例来源:origin: com.github.almasb/fxgl-base

PressAnyKeyState() {
    getInput().addEventHandler(KeyEvent.KEY_PRESSED, e -> {
      if (Input.isIllegal(e.getCode()))
        return;
      boolean rebound = FXGL.getInput().rebind(actionContext, e.getCode(), InputModifier.from(e));
      if (rebound)
        FXGL.getStateMachine().popState();
    });
    getInput().addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
      boolean rebound = FXGL.getInput().rebind(actionContext, e.getButton(), InputModifier.from(e));
      if (rebound)
        FXGL.getStateMachine().popState();
    });
    Rectangle rect = new Rectangle(250, 100);
    rect.setStroke(Color.color(0.85, 0.9, 0.9, 0.95));
    rect.setStrokeWidth(10);
    rect.setArcWidth(15);
    rect.setArcHeight(15);
    Text text = getUIFactory().newText(getLocalizedString("menu.pressAnyKey"), 24);
    StackPane pane = new StackPane(rect, text);
    pane.setTranslateX(FXGL.getAppWidth() / 2 - 125);
    pane.setTranslateY(FXGL.getAppHeight() / 2 - 50);
    getChildren().add(pane);
  }
}

代码示例来源:origin: stackoverflow.com

rectangle.setStroke(Color.DARKGREY);
rectangle.setArcHeight(4);
rectangle.setArcWidth(6);

代码示例来源:origin: com.github.almasb/fxgl-base

bg.setStroke(Color.WHITE);
bg.setStrokeWidth(4);
bg.setArcWidth(25);

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

/**
 * Constructs a {@link FxLabelDecorator} with the required minimum
 * attributes.
 * 
 * @param aText The with which to initialize the cell.
 * @param aFontName The font name to be used when rendering.
 * @param aTextSizeFactor The factor to be used relative to the width of the
 *        cell.
 * @param aNode The background image to be used.
 */
public FxLabelDecoratorImpl( String aText, String aFontName, double aTextSizeFactor, Node aNode ) {
  _text = aText;
  _fontName = aFontName;
  _textSizeFactor = aTextSizeFactor;
  _content = aNode;
  _textNode = new Text( aText );
  _textNode.setFont( new Font( aFontName, PROBE_FONT_SIZE ) );
  _textNode.setFill( DEFAULT_TEXT_COLOR );
  _rect = new Rectangle( _textNode.getBoundsInLocal().getWidth(), _textNode.getBoundsInLocal().getHeight(), DEFAULT_TEXT_BACKGROUND_COLOR );
  _rect.setStroke( DEFAULT_TEXT_BORDER_COLOR );
  setBorder( null );
  StackPane.setMargin( _content, null );
  StackPane.setAlignment( _content, Pos.CENTER );
  StackPane.setMargin( _rect, null );
  StackPane.setAlignment( _rect, FxGraphicalUtility.toPos( _horizAlignTextMode, _vertAlignTextMode ) );
  StackPane.setMargin( _textNode, null );
  StackPane.setAlignment( _textNode, FxGraphicalUtility.toPos( _horizAlignTextMode, _vertAlignTextMode ) );
  getChildren().addAll( _rect, _content, _textNode );
  _redraw.run();
}

相关文章

微信公众号

最新文章

更多