3 Commits
Author SHA1 Message Date
MehrdadShirvani 5150d2510e Merge PR 'develop' (#1) from develop into main
Full Mark
2026-07-10 17:10:45 +00:00
ZahraSadatMirvakili 4376fe6d10 edit 2026-05-17 22:35:00 +03:30
ZahraSadatMirvakili 30e199fc30 finish javafx 2026-05-17 22:19:51 +03:30
4 changed files with 50 additions and 65 deletions
+35 -45
View File
@@ -1,68 +1,58 @@
package workshop; package workshop;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.Button;
public class Controller public class Controller {
{ @FXML public Label basicPriceLabel;
@FXML @FXML public Label ProPriceLabel;
private Label titleLabel; @FXML public Label enterPrisePrice;
@FXML private Label titleLabel;
@FXML @FXML private Button themeToggle;
private Button themeToggle;
private boolean isDark = true; private boolean isDark = true;
// (Optional)
@FXML @FXML
public void initialize() {} private void initialize(){
basicPriceLabel.setText("$12.99 / month");
ProPriceLabel.setText("$20.66 / month");
enterPrisePrice.setText("Join us");
}
@FXML @FXML
private void buyBasic() {showAlert("You entered the payment gateway for the Basic plan.");} private void buyBasic() {
showAlert("Bacis plan Selected",Alert.AlertType.INFORMATION);
}
@FXML @FXML
private void buyPro() {showAlert("You entered the payment gateway for the Pro plan.");} private void buyPro() {
showAlert("Pro plan Selected",Alert.AlertType.WARNING);
}
@FXML @FXML
private void buyEnterprise() {showAlert("You entered the payment gateway for the Enterprise plan.");} private void buyEnterprise() {
showAlert("Enter price Selected",Alert.AlertType.CONFIRMATION);
}
@FXML @FXML
private void toggleTheme() private void toggleTheme() {
{ isDark= !isDark;
Scene scene = themeToggle.getScene(); themeToggle.getScene().getStylesheets().clear();
if(isDark){
if (isDark) themeToggle.getScene().getStylesheets().add(getClass().getResource("style.css").toExternalForm());
{ themeToggle.setText("Switch to light mood");
scene.getStylesheets().clear();
scene.getStylesheets().add(
getClass().getResource("light.css").toExternalForm()
);
themeToggle.setText("Switch to Dark Mode");
isDark = false;
} }
else else{
{ themeToggle.getScene().getStylesheets().add(getClass().getResource("light.css").toExternalForm());
scene.getStylesheets().clear(); themeToggle.setText("Switch to Dark mood");
scene.getStylesheets().add(
getClass().getResource("style.css").toExternalForm()
);
themeToggle.setText("Switch to Light Mode");
isDark = true;
} }
} }
private void showAlert(String message) private void showAlert(String msseage, Alert.AlertType alertType) {
{ Alert alert = new Alert(alertType);
Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText(msseage);
alert.setTitle("Payment"); alert.show();
alert.setHeaderText(null);
alert.setContentText(message);
alert.showAndWait();
} }
} }
+5 -4
View File
@@ -2,7 +2,8 @@ package workshop;
import javafx.application.Application; import javafx.application.Application;
public class Launcher public class Launcher {
{ public static void main(String[] args) {
public static void main(String[] args) {Application.launch(Main.class, args);} Application.launch(Main.class);
} }
}
+7 -13
View File
@@ -2,26 +2,20 @@ package workshop;
import javafx.application.Application; import javafx.application.Application;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.stage.Stage; import javafx.stage.Stage;
public class Main extends Application public class Main extends Application {
{
@Override @Override
public void start(Stage stage) throws Exception public void start(Stage stage) throws Exception {
{
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("pricing.fxml")); FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("pricing.fxml"));
Parent root = fxmlLoader.load(); Scene scene = new Scene(fxmlLoader.load(),750,450);
scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
Scene scene = new Scene(root, 750, 450);
scene.getStylesheets().add(
getClass().getResource("style.css").toExternalForm()
);
stage.setTitle("Pricing Plans");
stage.setScene(scene); stage.setScene(scene);
stage.setTitle("Pricing Plans");
stage.show(); stage.show();
//stage.setResizable(false);
} }
} }
+3 -3
View File
@@ -17,21 +17,21 @@
<HBox spacing="25" alignment="CENTER" HBox.hgrow="ALWAYS"> <HBox spacing="25" alignment="CENTER" HBox.hgrow="ALWAYS">
<VBox styleClass="card" prefWidth="200"> <VBox styleClass="card" prefWidth="200">
<Label text="Basic" styleClass="plan-name" /> <Label text="Basic" styleClass="plan-name" />
<Label text="\$9.99 / month" styleClass="price" /> <Label fx:id="basicPriceLabel" text="/$9.99 / month" styleClass="price" />
<Label text="Single user, basic features" styleClass="desc" wrapText="true" /> <Label text="Single user, basic features" styleClass="desc" wrapText="true" />
<Button text="Shop" onAction="#buyBasic" styleClass="shop-btn" /> <Button text="Shop" onAction="#buyBasic" styleClass="shop-btn" />
</VBox> </VBox>
<VBox styleClass="card" prefWidth="200"> <VBox styleClass="card" prefWidth="200">
<Label text="Pro" styleClass="plan-name" /> <Label text="Pro" styleClass="plan-name" />
<Label text="\$19.99 / month" styleClass="price" /> <Label fx:id="ProPriceLabel" text="/$19.99 / month" styleClass="price" />
<Label text="Up to 5 users, advanced features" styleClass="desc" wrapText="true" /> <Label text="Up to 5 users, advanced features" styleClass="desc" wrapText="true" />
<Button text="Shop" onAction="#buyPro" styleClass="shop-btn" /> <Button text="Shop" onAction="#buyPro" styleClass="shop-btn" />
</VBox> </VBox>
<VBox styleClass="card" prefWidth="200"> <VBox styleClass="card" prefWidth="200">
<Label text="Enterprise" styleClass="plan-name" /> <Label text="Enterprise" styleClass="plan-name" />
<Label text="Contact us" styleClass="price" /> <Label fx:id="enterPrisePrice" text="Contact us" styleClass="price" />
<Label text="Unlimited users, custom solutions" styleClass="desc" wrapText="true" /> <Label text="Unlimited users, custom solutions" styleClass="desc" wrapText="true" />
<Button text="Shop" onAction="#buyEnterprise" styleClass="shop-btn" /> <Button text="Shop" onAction="#buyEnterprise" styleClass="shop-btn" />
</VBox> </VBox>