둘 이상의 선을 결합하여 형성된 모양에서 획 선 결합 속성은 두 선의 조인트 모양을 지정/정의합니다. setStrokeLineJoin()을 사용하여 획선 조인을 설정할 수 있습니다. 방법.
Java FX는 Enum StrokeLineJoin이라는 이름은 -
-
베벨 − 이 유형에서는 교차점의 외부 가장자리가 선분으로 연결됩니다.
-
마이터 − 이 유형은 교차로의 외부 모서리가 서로 결합되어 날카로운 모서리를 형성합니다.
-
라운드 − 이 유형에서 교차로의 바깥쪽 가장자리는 모서리를 둥글게 처리하여 결합되며, 반경은 결합 너비의 정확히 절반이 됩니다.
예
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.StrokeLineJoin;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class StrokeLineJoinExample extends Application {
public void start(Stage stage) {
Font font = Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 12);
Text label1 = new Text("Original Image");
label1.setFont(font);
label1.setX(250.0);
label1.setY(125.0);
Polygon rhombus1 = new Polygon(300.0, 0.0, 250.0, 50.0, 300.0, 100.0, 350.0, 50.0);
Text label2 = new Text("Line Join: Round");
label2.setFont(font);
label2.setX(25.0);
label2.setY(275.0);
Polygon rhombus2 = new Polygon(100.0, 150.0, 50.0, 200.0, 100.0, 250.0, 150.0, 200.0);
rhombus2.setStroke(Color.BLUE);
rhombus2.setStrokeWidth(20);
rhombus2.setStrokeLineJoin(StrokeLineJoin.ROUND);
Text label3 = new Text("Line Join: Bevel");
label3.setFont(font);
label3.setX(250.0);
label3.setY(275.0);
Polygon rhombus3 = new Polygon(300.0, 150.0, 250.0, 200.0, 300.0, 250.0, 350.0, 200.0);
rhombus3.setStroke(Color.BLUE);
rhombus3.setStrokeWidth(20.0);
rhombus3.setStrokeLineJoin(StrokeLineJoin.BEVEL);
Text label4 = new Text("Line Join: Miter");
label4.setFont(font);
label4.setX(430.0);
label4.setY(275.0);
Polygon rhombus4 = new Polygon(490.0, 150.0, 440, 200.0, 490.0, 250.0, 540.0, 200.0);
rhombus4.setStroke(Color.BLUE);
rhombus4.setStrokeWidth(20.0);
rhombus4.setStrokeLineJoin(StrokeLineJoin.MITER);
//Creating a Group object
Group root = new Group(label1, label2, label3, label4, rhombus1, rhombus2, rhombus3, rhombus4);
//Creating a scene object
Scene scene = new Scene(root, 595, 310);
//Setting title to the Stage
stage.setTitle("Stroke Line Join");
//Adding scene to the stage
stage.setScene(scene);
//Displaying the contents of the stage
stage.show();
}
public static void main(String args[]){
launch(args);
}
} 출력
