83.9k views
2 votes
If a user forgets to enter some field and pushes "Create a Club" button, show a message "Please fill all fields" with red color, and nothing should be added to the right hand side panel.

1 Answer

4 votes

Answer:

Task: Write a Java program that generates GUI (Graphical User Interface). Your program should provide labels and textfields to a user to enter information regarding clubs. This is all using JavaFx

xplanation:

// Description: The Assignment6 class creates a Tab Pane with

// two tabs, one for Movie Creation and one for

// Movie Review.

import javafx.application.Application;

import javafx.stage.Stage;

import javafx.scene.Scene;

import javafx.scene.control.Tab;

import javafx.scene.control.TabPane;

import javafx.scene.layout.StackPane;

import java.util.ArrayList;

public class Assignment6 extends Application

{

private TabPane tabPane;

private CreatePane createPane;

private ReviewPane reviewPane;

private ArrayList movieList;

public void start(Stage stage)

{

StackPane root = new StackPane();

//movieList to be used in both createPane & reviewPane

movieList = new ArrayList();

reviewPane = new ReviewPane(movieList);

createPane = new CreatePane(movieList, reviewPane);

tabPane = new TabPane();

Tab tab1 = new Tab();

tab1.setText("Movie Creation");

tab1.setContent(createPane);

Tab tab2 = new Tab();

tab2.setText("Movie Review");

tab2.setContent(reviewPane);

tabPane.getSelectionModel().select(0);

tabPane.getTabs().addAll(tab1, tab2);

root.getChildren().add(tabPane);

Scene scene = new Scene(root, 700, 400);

stage.setTitle("Movie Review Apps");

stage.setScene(scene);

stage.show();

}

public static void main(String[] args)

{

launch(args);

}

}

User Aman Virk
by
5.6k points