DO NOT COPY AND PASTE SOMEONES CODE HERE THAT IS INCORRECT PLEASE The code here
ID: 3859477 • Letter: D
Question
DO NOT COPY AND PASTE SOMEONES CODE HERE THAT IS INCORRECT PLEASE
The code here does not work https://www.chegg.com/homework-help/questions-and-answers/create-complex-gui-exercise-going-build-complex-java-fx-gui-toppane-middlepane-bottompane--q16535083
Programmed in java using an ide such as netbeans or eclipse
Problem #1: (Create Complex GUI) In this exercise, you are going to build a complex Java FX GUI with a TopPane, a MiddlePane and a BottomPane. Call your Class StudentGUI.java. Use a BorderPane for the Scene. Add the 3 smaller Panes to the BorderPane. Make the GUI show up. That’s it. No Events. The TopPane should say “Student Info”. The middle Pane will have 4 Labels and 4 Textfields. One each for ID, FirstName, LastName and GPA. The bottomPane will have 3 Buttons: Find, Update and Exit.
Add an event to the StudentGUI from above. Modify StudentGUI.java. Make it so when the user clicks on the Update button, a new window pops-up. Just include one Button on this new window.
Explanation / Answer
import java.applet.*;
import java.awt.*;
//StudentGUI derived from Frame
public class StudentGUI extends Frame
{
//Creates 3 panel obect
Panel TopPane, MiddlePane, BottomPane;
//Creates 5 label oblect
Label lInfo, lID, lFN, lLN, lGPA;
//Creates 4 text field object
TextField tID, tFN, tLN, tGPA;
//Creates 3 button object
Button bFind, bUpdate, bExit;
//Creates frame object
Frame f;
//Constructor to initialize the object
StudentGUI()
{
f = new Frame("Border Layout Demo");
//sets the frame to border layout
f.setLayout(new BorderLayout());
//Panel initialization
TopPane = new Panel();
MiddlePane = new Panel();
BottomPane = new Panel();
//Lable initialization
lInfo = new Label("Student Info");
lID = new Label("Enter Student ID");
lFN = new Label("Enter Student First Name");
lLN = new Label("Enter Student Last Name");
lGPA = new Label("Enter Student GPA");
//Text Field initialization
tID = new TextField(10);
tFN = new TextField(10);
tLN = new TextField(10);
tGPA = new TextField(10);
//Button initialization
bFind = new Button("Find");
bUpdate = new Button("Update");
bExit = new Button("Exit");
//Adds components to the panel
TopPane.add(lInfo);
MiddlePane.add(lID);
MiddlePane.add(tID);
MiddlePane.add(lFN);
MiddlePane.add(tFN);
MiddlePane.add(lLN);
MiddlePane.add(tLN);
MiddlePane.add(lGPA);
MiddlePane.add(tGPA);
BottomPane.add(bFind);
BottomPane.add(bUpdate);
BottomPane.add(bExit);
//Adds the panel to the border layout
f.add(TopPane, BorderLayout.NORTH);
f.add(MiddlePane, BorderLayout.CENTER);
f.add(BottomPane, BorderLayout.SOUTH);
f.setVisible(true);
f.setSize(300, 300);
}
public static void main(String [] s)
{
StudentGUI sg = new StudentGUI();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.