Java Code Examples for javafx.scene.shape.Circle#setRadius()

The following examples show how to use javafx.scene.shape.Circle#setRadius() . 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: FontDemo.java    From BUPTJava with Apache License 2.0 6 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {    
  // Create a pane to hold the circle 
  Pane pane = new StackPane();
  
  // Create a circle and set its properties
  Circle circle = new Circle();
  circle.setRadius(50);
  circle.setStroke(Color.BLACK); 
  circle.setFill(new Color(0.5, 0.5, 0.5, 0.1));
  pane.getChildren().add(circle); // Add circle to the pane

  // Create a label and set its properties
  Label label = new Label("JavaFX");
  label.setFont(Font.font("Times New Roman", 
    FontWeight.BOLD, FontPosture.ITALIC, 20));
  pane.getChildren().add(label);

  // Create a scene and place it in the stage
  Scene scene = new Scene(pane);
  primaryStage.setTitle("FontDemo"); // Set the stage title
  primaryStage.setScene(scene); // Place the scene in the stage
  primaryStage.show(); // Display the stage
}
 
Example 2
Source File: RadialColorMenu.java    From RadialFx with GNU Lesser General Public License v3.0 6 votes vote down vote up
public RadialColorMenu() {
selectedColor = new SimpleObjectProperty<Paint>(Color.BLACK);
itemExtMouseHandler = new ItemExtEventHandler();

final Color[] colors = new Color[] { Color.BLACK, Color.web("00275b"),
	Color.web("008021"), Color.web("8e0000"), Color.web("ff8800") };

int i = 0;
for (final Color color : colors) {

    addColorItem(color, i * 360d / colors.length, 360d / colors.length);

    i++;
}

final Circle center = new Circle();
center.fillProperty().bind(selectedColor);
center.setRadius(40);
center.setCenterX(0);
center.setCenterY(0);

getChildren().add(center);
   }
 
Example 3
Source File: DetectionType.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node getCellNode(TreeTableCell<ModularFeatureListRow, FeatureStatus> cell,
    TreeTableColumn<ModularFeatureListRow, FeatureStatus> coll, FeatureStatus cellData,
    RawDataFile raw) {
  if (cellData == null)
    return null;

  Circle circle = new Circle();
  circle.setRadius(10);
  circle.setFill(cellData.getColorFX());
  return circle;
}
 
Example 4
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
 
Example 5
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
 
Example 6
Source File: StopWatch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void configureBackground() {
    ImageView imageView = new ImageView();
    Image image = loadImage();
    imageView.setImage(image);

    Circle circle1 = new Circle();
    circle1.setCenterX(140);
    circle1.setCenterY(140);
    circle1.setRadius(120);
    circle1.setFill(Color.TRANSPARENT);
    circle1.setStroke(Color.web("#0A0A0A"));
    circle1.setStrokeWidth(0.3);

    Circle circle2 = new Circle();
    circle2.setCenterX(140);
    circle2.setCenterY(140);
    circle2.setRadius(118);
    circle2.setFill(Color.TRANSPARENT);
    circle2.setStroke(Color.web("#0A0A0A"));
    circle2.setStrokeWidth(0.3);

    Circle circle3 = new Circle();
    circle3.setCenterX(140);
    circle3.setCenterY(140);
    circle3.setRadius(140);
    circle3.setFill(Color.TRANSPARENT);
    circle3.setStroke(Color.web("#818a89"));
    circle3.setStrokeWidth(1);

    Ellipse ellipse = new Ellipse(140, 95, 180, 95);
    Circle ellipseClip = new Circle(140, 140, 140);
    ellipse.setFill(Color.web("#535450"));
    ellipse.setStrokeWidth(0);
    GaussianBlur ellipseEffect = new GaussianBlur();
    ellipseEffect.setRadius(10);
    ellipse.setEffect(ellipseEffect);
    ellipse.setOpacity(0.1);
    ellipse.setClip(ellipseClip);
    background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
 
Example 7
Source File: FanPane.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
/** Return a Circle */
private Circle getCircle() {
	Circle c = new Circle();
	c.setRadius(100);
	c.setStroke(Color.BLACK);
	c.setFill(Color.WHITE);
	return c;
}
 
Example 8
Source File: Exercise_14_09.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
/** Return a Circle */
private Circle getCircle() {
	Circle c = new Circle();
	c.setRadius(100);
	c.setStroke(Color.BLACK);
	c.setFill(Color.WHITE);
	return c;
}
 
Example 9
Source File: Exercise_14_11.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
/** Returns a circle of specified properties */ 
private Circle getCircle() {
	Circle c = new Circle();
	c.setRadius(150);
	c.setStroke(Color.BLACK);
	c.setFill(Color.WHITE);
	return c;
}
 
Example 10
Source File: PopOverSkin.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private Node createCloseIcon() {
    Group group = new Group();
    group.getStyleClass().add("graphics"); //$NON-NLS-1$

    Circle circle = new Circle();
    circle.getStyleClass().add("circle"); //$NON-NLS-1$
    circle.setRadius(6);
    circle.setCenterX(6);
    circle.setCenterY(6);
    group.getChildren().add(circle);

    Line line1 = new Line();
    line1.getStyleClass().add("line"); //$NON-NLS-1$
    line1.setStartX(4);
    line1.setStartY(4);
    line1.setEndX(8);
    line1.setEndY(8);
    group.getChildren().add(line1);

    Line line2 = new Line();
    line2.getStyleClass().add("line"); //$NON-NLS-1$
    line2.setStartX(8);
    line2.setStartY(4);
    line2.setEndX(4);
    line2.setEndY(8);
    group.getChildren().add(line2);

    return group;
}
 
Example 11
Source File: BlendEffect.java    From Learn-Java-12-Programming with MIT License 4 votes vote down vote up
private static Circle createCircle(){
    Circle c = new Circle();
    c.setFill(Color.rgb(255, 0, 0, 0.5));
    c.setRadius(25);
    return c;
}
 
Example 12
Source File: CircleSegmentHandlePart.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Updates the color of this part's visualization. If this handle part
 * represents a way or end point of an {@link Connection}, it's color will
 * be set to indicate whether the handle is connected to another part or
 * not.
 */
protected void updateColor() {
	// only update when bound to anchorage
	SetMultimap<IVisualPart<? extends Node>, String> anchorages = getAnchoragesUnmodifiable();
	if (getRoot() == null || anchorages.keySet().size() != 1) {
		return;
	}

	Circle visual = getVisual();
	// no need to update the color if we are invisible
	if (!visual.isVisible()) {
		return;
	}
	if (getSegmentParameter() != 0.0 && getSegmentParameter() != 1.0) {
		visual.setFill(getInsertFill());
		visual.setRadius(DEFAULT_SIZE * 2d / 5d);
	} else {
		visual.setRadius(DEFAULT_SIZE / 2d);
		// determine connected state for end point handles
		boolean connected = false;
		IVisualPart<? extends Node> targetPart = anchorages.keySet()
				.iterator().next();
		if (targetPart.getVisual() instanceof Connection) {
			Connection connection = (Connection) targetPart.getVisual();
			if (getSegmentIndex() + getSegmentParameter() == 0.0) {
				// handle at start point
				connected = connection.isStartConnected();
			} else if (getSegmentParameter()
					+ getSegmentIndex() == getSegmentsInScene().length) {
				// handle at end point
				connected = connection.isEndConnected();
			}
		}
		// update color according to connected state
		if (connected) {
			visual.setFill(getConnectedFill());
		} else {
			visual.setFill(getMoveFill());
		}
	}
}
 
Example 13
Source File: CircularProgressIndicator.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
private void initGraphics() {
    double center = PREFERRED_WIDTH * 0.5;
    double radius = PREFERRED_WIDTH * 0.45;
    circle = new Circle();
    circle.setCenterX(center);
    circle.setCenterY(center);
    circle.setRadius(radius);
    circle.getStyleClass().add("indicator");
    circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316);
    circle.setStrokeDashOffset(dashOffset.get());
    circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);

    arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress());
    arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    arc.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    arc.getStyleClass().add("indicator");

    indeterminatePane = new StackPane(circle);
    indeterminatePane.setVisible(false);

    progressPane      = new Pane(arc);
    progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0);

    getChildren().setAll(progressPane, indeterminatePane);

    // Setup timeline animation
    KeyValue kvDashOffset_0    = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_50   = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_100  = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH);

    KeyValue kvDashArray_0_0   = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_50  = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);

    KeyValue kvRotate_0        = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR);
    KeyValue kvRotate_100      = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR);

    KeyFrame kf0               = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0);
    KeyFrame kf1               = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50);
    KeyFrame kf2               = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100);

    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.getKeyFrames().setAll(kf0, kf1, kf2);

    // Setup additional pane rotation
    indeterminatePaneRotation = new RotateTransition();
    indeterminatePaneRotation.setNode(indeterminatePane);
    indeterminatePaneRotation.setFromAngle(0);
    indeterminatePaneRotation.setToAngle(-360);
    indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR);
    indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE);
    indeterminatePaneRotation.setDuration(new Duration(4500));
}
 
Example 14
Source File: CircularProgressIndicator.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
private void initGraphics() {
    double center = PREFERRED_WIDTH * 0.5;
    double radius = PREFERRED_WIDTH * 0.45;
    circle = new Circle();
    circle.setCenterX(center);
    circle.setCenterY(center);
    circle.setRadius(radius);
    circle.getStyleClass().add("indicator");
    circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316);
    circle.setStrokeDashOffset(dashOffset.get());
    circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);

    arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress());
    arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    arc.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    arc.getStyleClass().add("indicator");

    indeterminatePane = new StackPane(circle);
    indeterminatePane.setVisible(false);

    progressPane      = new Pane(arc);
    progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0);

    getChildren().setAll(progressPane, indeterminatePane);

    // Setup timeline animation
    KeyValue kvDashOffset_0    = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_50   = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_100  = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH);

    KeyValue kvDashArray_0_0   = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_50  = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);

    KeyValue kvRotate_0        = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR);
    KeyValue kvRotate_100      = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR);

    KeyFrame kf0               = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0);
    KeyFrame kf1               = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50);
    KeyFrame kf2               = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100);

    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.getKeyFrames().setAll(kf0, kf1, kf2);

    // Setup additional pane rotation
    indeterminatePaneRotation = new RotateTransition();
    indeterminatePaneRotation.setNode(indeterminatePane);
    indeterminatePaneRotation.setFromAngle(0);
    indeterminatePaneRotation.setToAngle(-360);
    indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR);
    indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE);
    indeterminatePaneRotation.setDuration(new Duration(4500));
}
 
Example 15
Source File: LoadingScreen.java    From FXTutorials with MIT License 4 votes vote down vote up
private Node makeSymbol() {
    Pane symbol = new Pane();

    GaussianBlur blur = new GaussianBlur(2.5);
    symbol.setEffect(blur);

    Rectangle top = new Rectangle(70, 5, Colors.LOADING_SYMBOL);
    top.setArcWidth(25);
    top.setArcHeight(25);

    Rectangle mid = new Rectangle(100, 5, Colors.LOADING_SYMBOL);
    mid.setArcWidth(25);
    mid.setArcHeight(25);

    Rectangle bot = new Rectangle(70, 5, Colors.LOADING_SYMBOL);
    bot.setArcWidth(25);
    bot.setArcHeight(25);

    top.setTranslateX(15);
    bot.setTranslateX(15);

    top.setTranslateY(10);
    mid.setTranslateY(10 + 10 + 5);
    bot.setTranslateY(10 + 10 + 5 + 10 + 5);

    Circle circle = new Circle(25, 25, 25, Color.BLACK);
    circle.setStroke(Colors.LOADING_SYMBOL);
    circle.setStrokeWidth(2);
    circle.setTranslateX(25);

    Circle circle2 = new Circle(25, 25, 25, Color.BLACK);
    circle2.setStroke(Colors.LOADING_SYMBOL);
    circle2.setStrokeWidth(1);
    circle2.setTranslateX(25);
    circle2.setRadius(2);

    Circle point = new Circle(25, 25, 25, Colors.LOADING_SYMBOL);
    point.setStroke(Colors.LOADING_SYMBOL);
    point.setStrokeWidth(1);
    point.setTranslateX(25);
    point.setRadius(1);

    KeyFrame frame = new KeyFrame(Duration.seconds(1),
            new KeyValue(circle2.radiusProperty(), 20));

    timeline.getKeyFrames().add(frame);
    timeline.setCycleCount(5);
    timeline.play();

    symbol.getChildren().addAll(top, mid, bot, circle, circle2, point);
    return symbol;
}
 
Example 16
Source File: DraggableNode.java    From java_fx_node_link_demo with The Unlicense 3 votes vote down vote up
@FXML
private void initialize() {
	
	buildNodeDragHandlers();
	buildLinkDragHandlers();
				
	left_link_handle.setOnDragDetected(mLinkHandleDragDetected);
	right_link_handle.setOnDragDetected(mLinkHandleDragDetected);

	left_link_handle.setOnDragDropped(mLinkHandleDragDropped);
	right_link_handle.setOnDragDropped(mLinkHandleDragDropped);

	mDragLink = new NodeLink();
	mDragLink.setVisible(false);
	
	parentProperty().addListener(new ChangeListener() {

		@Override
		public void changed(ObservableValue observable,
				Object oldValue, Object newValue) {
			right_pane = (AnchorPane) getParent();
			
		}
		
	});
	
	Circle c =new Circle();
	c.setRadius(5.0f);
	this.getChildren().add(c);

}