1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Reika [66]
3 years ago
9

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.
Computers and Technology
1 answer:
Alla [95]3 years ago
4 0

Answer:

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 SelectPane selectPane;

private ArrayList<Club> clubList;

public void start(Stage stage) {

StackPane root = new StackPane();

//clubList to be used in both createPane & selectPane

clubList = new ArrayList<Club>();

selectPane = new SelectPane(clubList);

createPane = new CreatePane(clubList, selectPane);

tabPane = new TabPane();

Tab tab1 = new Tab();

tab1.setText("Club Creation");

tab1.setContent(createPane);

Tab tab2 = new Tab();

tab2.setText("Club Selection");

tab2.setContent(selectPane);

tabPane.getSelectionModel().select(0);

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

root.getChildren().add(tabPane);

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

stage.setTitle("Club Selection Apps");

stage.setScene(scene);

stage.show();

}

public static void main(String[] args)

{

launch(args);

}

}

import java.util.ArrayList;

import javafx.scene.layout.HBox;

import javafx.event.ActionEvent; //**Need to import

import javafx.event.EventHandler; //**Need to import

public class CreatePane extends HBox {

ArrayList<Club> clubList;

private SelectPane selectPane;

//constructor

public CreatePane(ArrayList<Club> list, SelectPane sePane) {

this.clubList = list;

this.selectPane = sePane;

}

//using the toString method of the Club class.

//It also does error checking in case any of the textfields are empty,

//or a non-numeric value was entered for its number of members

private class ButtonHandler implements EventHandler<ActionEvent> {

//Override the abstact method handle()

public void handle(ActionEvent event) {

//declare any necessary local variables here

//---

//when a text field is empty and the button is pushed

//if ( //---- )

//{

//handle the case here

//}

//else //for all other cases

//{

//when a non-numeric value was entered for its number of

members

//and the button is pushed

//you will need to use try & catch block to catch

//the NumberFormatException

//When a club of an existing club name in the list

//was attempted to be added, do not add it to the list

//and display a message "Club not added - duplicate"

//at the end, don't forget to update the new arrayList

//information on the SelectPanel

//}

} //end of handle() method

} //end of ButtonHandler class

}

import javafx.scene.control.Label;

import javafx.scene.control.CheckBox;

import javafx.scene.layout.*;

import javafx.event.ActionEvent; //**Need to import

import javafx.event.EventHandler; //**Need to import

import java.util.ArrayList;

import javafx.collections.ObservableList;

import javafx.scene.Node;

//import all other necessary javafx classes here

public class SelectPane extends BorderPane {

private ArrayList<Club> clubList;

//constructor

public SelectPane(ArrayList<Club> list) {

//initialize instance variables

this.clubList = list;

//set up the layout

//create an empty pane where you can add check boxes later

//SelectPane is a BorderPane - add the components here

} //end of constructor

//This method uses the newly added parameter Club object

//to create a CheckBox and add it to a pane created in the constructor

//Such check box needs to be linked to its handler class

public void updateClubList(Club newClub)

{

//-------

}

//create a SelectionHandler class

private class SelectionHandler implements EventHandler<ActionEvent> {

//Override the abstact method handle()

public void handle(ActionEvent event){

//When any radio button is selected or unselected

//the total number of members of selected clubs should be updated

//and displayed using a label.

}

} //end of SelectHandler class

} //end of SelectPane class

public class Club {

private String clubName;

private int numberOfMembers;

private String university;

//Constructor to initialize all member variables

public Club() {

clubName = "?";

university = "?";

numberOfMembers = 0;

}

//Accessor method for club name

public String getClubName() {

return clubName;

}

//Accessor method for university

public String getUniversity() {

return university;

}

//Accessor method for number of members

public int getNumberOfMembers() {

return numberOfMembers;

}

//mutator/modifider method for club name

public void setClubName(String someClubName) {

clubName = someClubName;

}

//mutator/modifider method for university

public void setUniversity(String someUniversity) {

university = someUniversity;

}

//mutator/modifider method for number of members

public void setNumberOfMembers(int someNumber) {

numberOfMembers = someNumber;

}

//toString() method returns a string containg its name, number of members, and

university

public String toString() {

String result = "\nClub Name:\t\t" + clubName

+ "\nNumber Of Members:\t" + numberOfMembers

+ "\nUniversity:\t\t" + university

+ "\n\n";

return result;

}

}

Explanation:

You might be interested in
In python how do you write for prime factors
olasank [31]

Answer:

The while loop is used and the factors of the integer are computed by using the modulus operator and checking if the remainder of the number divided by i is 0. 3. Then the factors of the integer are then again checked if the factor is prime or not.

Explanation:

google

4 0
3 years ago
How to connect local account to domain account?
muminat
<span>Join them to the domain
Login with their domain credentials, logout
Login as local administrator (not the old account, not the new one, a 3rd local admin)
Right click My Computer and select properties
Select advanced system settings
Go to the Advanced tab
Click settings under user profiles
Select their old profile you want and click Copy to
Browse to the location of their new profile and overwrite it</span>

If the Copy button is grayed out then reboot and repeat steps two to nine.

8 0
3 years ago
Which of the following tools enables users to connect to a remote computer, including servers with no interaction required from
musickatia [10]

Answer:

Option (A) i.e., Remote Desktop is the correct answer to the following question.

Explanation:

The following option is correct because the remote desktop is an application or software which connects your computer to another system through the internet from anywhere and we can also connect with each other without the internet but in a range.

<u>Steps to connect in Windows 10</u>:

Step-1: Firstly, start your window and click on the start button.

Step-2: Then, type remote setting in search box.

Step-3: Then, you have to allow the remote access to the system.

Step-4: Then, you have select the Remote Tab which appears in System Properties.

Step-5: Then, you have to click and select the to Allow the Remote Connection.

7 0
3 years ago
Examples of crowdfunding and crowdsourcing include
taurus [48]
Patreon and gofunme are two good examples of crowd funding websites. Corwd sourcing is more along the lines of craigslist, reddit or 4chan.
6 0
3 years ago
The NSA could be hiding small snooping programs in, let's just say, a picture of a cute kitten or a fun Android game." So how ca
grin007 [14]
One way could be to check the code of the program.
But of course this might not be possible... Not everyone knows a programming language. And even if you did, you might not know the programming language they used.

Another way is to download a program that monitors your incoming connections and outgoing connections from your computer/android/iphone.

When someone or something connects to your device, the program should alert you. Or when the computer makes a connection to a website/device.
8 0
3 years ago
Other questions:
  • Write a program that uses the function isPalindrome given in Example 6-6 (Palindrome). Test your program on the following string
    9·1 answer
  • What is a break in the content that forces takes on to the next line
    10·2 answers
  • Suppose your parents are planning to take you
    8·1 answer
  • Write a loop that displays all possible combinations of two letters where the letters are 'a', or 'b', or 'c', or 'd', or 'e'. T
    12·1 answer
  • Eve has tricked Alice into decrypting a bunch of ciphertexts that Alice encrypted last month but forgot about. What type of atta
    6·1 answer
  • Social media is a type of ___________ ccommunication (type either push or pull for your response).
    8·2 answers
  • Assume that passwords are selected from four-character combinations of 26 alphabeticcharacters. Assume that an adversary is able
    11·1 answer
  • Assume that a 5 element array of type string named boroughs has been declared and initialized. Write the code necessary to switc
    5·1 answer
  • I think i have a virus on my computer what am i supposed to do
    10·1 answer
  • What do you think that the next version of IR (IR 5.0) will bring if it was discovered in near future? (hint:- advance IR 4.0 fe
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!