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
Structure for forloop?
solong [7]

Answer:

for ( initialization; condition;increment)

{

code goes here;

}

in python:

for i in list/range:

code with proper indentation

By initialization above we mean, like int i=0; etc.

By condition like i<10;

and by increment it means like i++, ++i or i+=1; etc

And in python, i can be an integer value if the range is mentioned, and it can be an item of a list if the list is used. We can also use an array, string and various other data structures in python. like we can have characters in a string and so on.

Explanation:

Please check the answer section.

8 0
3 years ago
?an ip address reservation is made by creating an association between an ip address and what type of client identifier?
victus00 [196]
The ethernet address, a.k.a. mac address. That way, a DHCP server can give the same IP address to a returning client.
3 0
3 years ago
A support technician uses the ping utility on a system that is online, yet no response is received. What should be allowed throu
alexgriva [62]

Answer:

Internet Control Message Protocol (ICMP) Echo Requests

Explanation:

A system that has Windows Firewall or antivirus or other third party antivirus enabled with their configuration setting set to default, ping command from another device will not be able to see if the device with an enabled firewall is alive.

The ping command sends Internet Control Message Protocol (ICMP) Echo Request to a destination device after the destination device will reply with a Reply packet. However, by default, firewalls, such as Windows firewall blocks ICMP Echo Requests from the external network and pinging will  work when the firewall is disabled or an exception is created that lets ICMP Echo Requests pass through the firewall.

4 0
3 years ago
What is the difference, if any, between a Portable Media Player (PMP) and a Digital Media Device (DMD)? PMPs can be analog or di
lara [203]

Answer:

PMPs are typically referred to interchangeably.

Explanation:

3 0
3 years ago
Four possible skills a person could have
cluponka [151]

Answer:

Active listening skills.

Genuine interest in others.

Flexibility.

Good judgment.

Explanation:

4 0
3 years ago
Other questions:
  • Devices such as monitors and printers that are connected to a computer are called ________.
    12·1 answer
  • What Is the output of the following: =OR (5 &lt;7, 16*Rand ()&gt;23,FALSE)
    5·1 answer
  • Which option is most likely used to create many-to-many relationships in Access?
    8·1 answer
  • One blog may have a greater social influence than another when it has_______?
    12·2 answers
  • What are the two types of formulas in excel
    9·1 answer
  • What is the velocity of a 0.100kg car with a momentum of 5 kgm/s?
    12·1 answer
  • PLS HURRY<br> Look at the image below
    8·1 answer
  • What type of computer/device do you have i need it for a survey and it due today soooooooooooooo
    14·1 answer
  • What is the difference between a status bar, title bar, and tabs?
    15·1 answer
  • you are asked to create a four-digit code using the numbers from 1 to 9. how many possible codes are there--assuming that number
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!