Programming Basics SQL HTML CSS JavaScript Python C++ Java JavaFX Swing Problem Solving English English Conversations Computer Fundamentals Learn Typing

JavaFXطريقة تغيير حجم و لون خط الـRadioButton

المثال التالي يعلمك طريقة تغيير حجم و لون خط الـ RadioButton.


مثال

Main.java
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.RadioButton;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage stage) {
// يمثل الزر الذي نريد إضافته في النافذة RadioButton هنا قمنا بإنشاء كائن من الكلاس
RadioButton radioButton = new RadioButton("RadioButton");
// في النافذة radioButton هنا قمنا بتحديد مكان ظهور الكائن
radioButton.setTranslateX(140);
radioButton.setTranslateY(100);
// radioButton هنا قمنا بتغيير نوع و حجم خط الكائن
radioButton.setFont(new Font("Arial", 18));
// radioButton هنا قمنا بتغيير لون خط الكائن
radioButton.setTextFill(Color.RED);
// في النافذة Root Node لأننا ننوي جعله الـ Group هنا قمنا بإنشاء كائن من الكلاس
Group root = new Group();
// root في الكائن radioButton هنا قمنا بإضافة الكائن
root.getChildren().add(radioButton);
// فيها و تحديد حجمها Node كأول root هنا قمنا بإنشاء محتوى النافذة مع تعيين الكائن
Scene scene = new Scene(root, 400, 250);
// هنا وضعنا عنوان للنافذة
stage.setTitle("JavaFX RadioButton");
// أي وضعنا محتوى النافذة الذي قمنا بإنشائه للنافذة .stage في كائن الـ scene هنا وضعنا كائن الـ
stage.setScene(scene);
// هنا قمنا بإظهار النافذة
stage.show();
}
// هنا قمنا بتشغيل التطبيق
public static void main(String[] args) {
launch(args);
}
}
import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.RadioButton; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage stage) { // يمثل الزر الذي نريد إضافته في النافذة RadioButton هنا قمنا بإنشاء كائن من الكلاس RadioButton radioButton = new RadioButton("RadioButton"); // في النافذة radioButton هنا قمنا بتحديد مكان ظهور الكائن radioButton.setTranslateX(140); radioButton.setTranslateY(100); // radioButton هنا قمنا بتغيير نوع و حجم خط الكائن radioButton.setFont(new Font("Arial", 18)); // radioButton هنا قمنا بتغيير لون خط الكائن radioButton.setTextFill(Color.RED); // في النافذة Root Node لأننا ننوي جعله الـ Group هنا قمنا بإنشاء كائن من الكلاس Group root = new Group(); // root في الكائن radioButton هنا قمنا بإضافة الكائن root.getChildren().add(radioButton); // فيها و تحديد حجمها Node كأول root هنا قمنا بإنشاء محتوى النافذة مع تعيين الكائن Scene scene = new Scene(root, 400, 250); // هنا وضعنا عنوان للنافذة stage.setTitle("JavaFX RadioButton"); // أي وضعنا محتوى النافذة الذي قمنا بإنشائه للنافذة .stage في كائن الـ scene هنا وضعنا كائن الـ stage.setScene(scene); // هنا قمنا بإظهار النافذة stage.show(); } // هنا قمنا بتشغيل التطبيق public static void main(String[] args) { launch(args); } }

ستظهر لك النافذة التالية عند التشغيل.

طريقة تغيير حجم و لون خط الـ RadioButton في javafx