Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5150d2510e | ||
|
|
4376fe6d10 | ||
|
|
30e199fc30 |
@@ -1,68 +1,58 @@
|
||||
package workshop;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Button;
|
||||
|
||||
public class Controller
|
||||
{
|
||||
@FXML
|
||||
private Label titleLabel;
|
||||
|
||||
@FXML
|
||||
private Button themeToggle;
|
||||
public class Controller {
|
||||
@FXML public Label basicPriceLabel;
|
||||
@FXML public Label ProPriceLabel;
|
||||
@FXML public Label enterPrisePrice;
|
||||
@FXML private Label titleLabel;
|
||||
@FXML private Button themeToggle;
|
||||
|
||||
private boolean isDark = true;
|
||||
|
||||
// (Optional)
|
||||
@FXML
|
||||
public void initialize() {}
|
||||
private void initialize(){
|
||||
basicPriceLabel.setText("$12.99 / month");
|
||||
ProPriceLabel.setText("$20.66 / month");
|
||||
enterPrisePrice.setText("Join us");
|
||||
}
|
||||
|
||||
@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
|
||||
private void buyPro() {showAlert("You entered the payment gateway for the Pro plan.");}
|
||||
private void buyPro() {
|
||||
showAlert("Pro plan Selected",Alert.AlertType.WARNING);
|
||||
}
|
||||
|
||||
@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
|
||||
private void toggleTheme()
|
||||
{
|
||||
Scene scene = themeToggle.getScene();
|
||||
|
||||
if (isDark)
|
||||
{
|
||||
scene.getStylesheets().clear();
|
||||
scene.getStylesheets().add(
|
||||
getClass().getResource("light.css").toExternalForm()
|
||||
);
|
||||
|
||||
themeToggle.setText("Switch to Dark Mode");
|
||||
isDark = false;
|
||||
|
||||
private void toggleTheme() {
|
||||
isDark= !isDark;
|
||||
themeToggle.getScene().getStylesheets().clear();
|
||||
if(isDark){
|
||||
themeToggle.getScene().getStylesheets().add(getClass().getResource("style.css").toExternalForm());
|
||||
themeToggle.setText("Switch to light mood");
|
||||
}
|
||||
else
|
||||
{
|
||||
scene.getStylesheets().clear();
|
||||
scene.getStylesheets().add(
|
||||
getClass().getResource("style.css").toExternalForm()
|
||||
);
|
||||
|
||||
themeToggle.setText("Switch to Light Mode");
|
||||
isDark = true;
|
||||
else{
|
||||
themeToggle.getScene().getStylesheets().add(getClass().getResource("light.css").toExternalForm());
|
||||
themeToggle.setText("Switch to Dark mood");
|
||||
}
|
||||
}
|
||||
|
||||
private void showAlert(String message)
|
||||
{
|
||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||
alert.setTitle("Payment");
|
||||
alert.setHeaderText(null);
|
||||
alert.setContentText(message);
|
||||
alert.showAndWait();
|
||||
private void showAlert(String msseage, Alert.AlertType alertType) {
|
||||
Alert alert = new Alert(alertType);
|
||||
alert.setHeaderText(msseage);
|
||||
alert.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package workshop;
|
||||
|
||||
import javafx.application.Application;
|
||||
|
||||
public class Launcher
|
||||
{
|
||||
public static void main(String[] args) {Application.launch(Main.class, args);}
|
||||
}
|
||||
public class Launcher {
|
||||
public static void main(String[] args) {
|
||||
Application.launch(Main.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,26 +2,20 @@ package workshop;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Main extends Application
|
||||
{
|
||||
public class Main extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception
|
||||
{
|
||||
public void start(Stage stage) throws Exception {
|
||||
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.setTitle("Pricing Plans");
|
||||
stage.show();
|
||||
//stage.setResizable(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,21 +17,21 @@
|
||||
<HBox spacing="25" alignment="CENTER" HBox.hgrow="ALWAYS">
|
||||
<VBox styleClass="card" prefWidth="200">
|
||||
<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" />
|
||||
<Button text="Shop" onAction="#buyBasic" styleClass="shop-btn" />
|
||||
</VBox>
|
||||
|
||||
<VBox styleClass="card" prefWidth="200">
|
||||
<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" />
|
||||
<Button text="Shop" onAction="#buyPro" styleClass="shop-btn" />
|
||||
</VBox>
|
||||
|
||||
<VBox styleClass="card" prefWidth="200">
|
||||
<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" />
|
||||
<Button text="Shop" onAction="#buyEnterprise" styleClass="shop-btn" />
|
||||
</VBox>
|
||||
|
||||
Reference in New Issue
Block a user