how to make lines glow in java

Solutions on MaxInterview for how to make lines glow in java by the best coders in the world

showing results for - "how to make lines glow in java"
Rodger
18 Sep 2020
1package application;  
2import javafx.application.Application;  
3import javafx.stage.Stage;  
4import javafx.scene.Group;  
5import javafx.scene.Scene;  
6import javafx.scene.effect.Glow;  
7import javafx.scene.image.Image;  
8import javafx.scene.image.ImageView;  
9import javafx.scene.paint.Color;  
10import javafx.scene.text.Font;  
11import javafx.scene.text.FontPosture;  
12import javafx.scene.text.FontWeight;  
13import javafx.scene.text.Text;  
14public class GlowEffect extends Application{  
15  
16    @Override  
17    public void start(Stage primaryStage) throws Exception {  
18        // TODO Auto-generated method stub  
19        Image img1 = new Image("https://www.javatpoint.com/linux/images/linux-first.png");  
20        Image img2 = new Image("https://www.javatpoint.com/linux/images/linux-first.png");  
21          
22        ImageView imgview1 = new ImageView(img1);  
23        ImageView imgview2 = new ImageView(img2);  
24        Text text1 = new Text();  
25        Text text2 = new Text();  
26        text1.setText("Glowing with level 10");  
27        text2.setText("Not Glowing");  
28        text1.setX(60);  
29        text1.setY(300);  
30        text2.setX(325);  
31        text2.setY(300);  
32        text1.setFont(Font.font("Courier 10 Pitch",FontWeight.BOLD,FontPosture.REGULAR,16));  
33        text2.setFont(Font.font("Courier 10 Pitch",FontWeight.BOLD,FontPosture.REGULAR,16));  
34        text1.setFill(Color.RED);  
35        text2.setFill(Color.RED);  
36        text1.setStroke(Color.BLACK);  
37        text2.setStroke(Color.BLACK);  
38        imgview1.setX(70);  
39        imgview1.setY(90);  
40        imgview2.setX(300);  
41        imgview2.setY(90);  
42        Glow glow = new Glow();   
43        glow.setLevel(10);  
44        imgview1.setEffect(glow);  
45        Group root = new Group();  
46        root.getChildren().addAll(imgview1,imgview2,text1,text2);  
47        Scene scene = new Scene(root,500,350);  
48        primaryStage.setScene(scene);  
49        primaryStage.setTitle("Glow Effect Example");  
50        primaryStage.show();      
51          
52    }  
53    public static void main(String[] args) {  
54        launch(args);  
55          
56    }  
57}