কম্পিউটার টিউটোরিয়াল

জাভাFX ২D শেপের Smooth প্রপার্টি ব্যাখ্যা

Smooth প্রপার্টি

smooth প্রপার্টি নির্দেশ করে অ্যান্টি-অ্যালিয়াসিং হিন্টস ব্যবহার করা হবে কিনা। setSmooth() মেথড দিয়ে এটি সেট করা হয়। এটি বুলিয়ান ভ্যালু গ্রহণ করে; true দিলে শেপের এজগুলো সমüssen হয়।

উদাহরণ

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 SmoothExample extends Application { 
    public void start(Stage stage) { 
        Font font = Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 12); 
        Text label2 = new Text("Smooth: true"); 
        label2.setFont(font); 
        label2.setX(80.0); 
        label2.setY(250.0); 
        Polygon shape1 = new Polygon(100.0, 75.0, 50.0, 200.0, 200.0, 200.0); 
        shape1.setStroke(Color.BLUE); 
        shape1.setStrokeWidth(20); 
        shape1.setStrokeLineJoin(StrokeLineJoin.MITER); 
        shape1.setSmooth(true); 

        Text label3 = new Text("Smooth: false"); 
        label3.setFont(font); 
        label3.setX(370.0); 
        label3.setY(250.0); 
        Polygon shape2 = new Polygon(450.0, 75.0, 350.0, 200.0, 500.0, 200.0); 
        shape2.setStroke(Color.BLUE); 
        shape2.setStrokeWidth(20.0); 
        shape2.setStrokeLineJoin(StrokeLineJoin.MITER); 
        shape2.setSmooth(false); 

        Group root = new Group(label2, label3, shape1, shape2); 
        Scene scene = new Scene(root, 595, 310); 
        stage.setTitle("Smooth Example"); 
        stage.setScene(scene); 
        stage.show(); 
    } 
    public static void main(String args[]){ 
        launch(args); 
    } 
}

আউটপুট

জাভাFX ২D শেপের Smooth প্রপার্টি ব্যাখ্যা

  1. জাভाएফএক্স-এ পথ এলিমেন্ট লাইন তৈরি করার পদ্ধতি

  2. জাভाएফএক্স-এ ২D অবজেক্টের প্রপার্টিগুলো ব্যাখ্যা

  3. জাভाएফএক্স অ্যাপ্লিকেশন স্ট্রাকচার ব্যাখ্যা

  4. জাভाएফএক্স সিন গ্রাফ ব্যাখ্যা