This week you learned how to handle events for JCheckBox, JRadioButtons, JTextfi
ID: 3554062 • Letter: T
Question
This week you learned how to handle events for JCheckBox, JRadioButtons, JTextfields, JTextArea, JComboBox, JListbox, JScrollBar and JSlider. How to handle the events for the first 3 classes was covered in an earlier assignment. So that should make life much easier. Created a class called Assign112 that has the main and does all the standard stuff (outlined in step 8 below), similar to the DrawingFrame main in assignment 7.2.
I suggest using one panel for textfields, another panel for combo box, list and slider, and a final panel for the three buttons. You will need to select the the best layout for each panel to make objects display as you like. Add those to the main frame using more than likely a BorderLayout.
Suggestion: You can use more panels to improve layout and place panels within other panels before adding to main frame. For example, if you have six JTextFields for first name, last name, address, city, state and zip, you could use three panels all with FlowLayout set to left. Add the first name label, first name textfield, last name label and last name textfield to the first FlowLayout panel, the address label and address textfield to the second FlowLayout panel, and add the labels and textfields for city state and zip to the third FlowLayout panel. Then, add all three panels to a grid layout panel using 3 rows and 1 column. So be creative, the sky is the limit.
Write the code necessary to:This week you learned how to handle events for JCheckBox, JRadioButtons, JTextfields, JTextArea, JComboBox, JListbox, JScrollBar and JSlider. How to handle the events for the first 3 classes was covered in an earlier assignment. So that should make life much easier. Created a class called Assign112 that has the main and does all the standard stuff (outlined in step 8 below), similar to the DrawingFrame main in assignment 7.2.
- Do the usually:
- Open Eclipse and create a new project named Assign112.
- Create one java file with a public class in it named Assign112.
- Put your name, date, course, and the assignment number in a comment at the top of the file.
- Create an Airline reservation class that extends JFrame with fields for:
- first name and last name, address, city, state and zip
- flight number
- date and time of flight
- starting city and ending city
- credit card number and type of card (MasterCard, Visa or Discover)
- Use labels and textfields for name, address, city, state and zip
- Use a label and combo box to select a list of flight numbers (include at least 5 flight numbers)
- Use a label and list for a list of dates (include at least 5 dates)
- Use a label and slider to select at least 5 different flight times (JSlider - another link to the Java trails which link back to Java classes, best of both worlds)
- SimpleSlideDemo.java (This simple slide demo program can be use to show you how to convert the slide time label to a string. It also uses an inner class for the output information, so if you want to go with that type of implementation, take a look.)
- SimpleSlideDemo.java (This simple slide demo program can be use to show you how to convert the slide time label to a string. It also uses an inner class for the output information, so if you want to go with that type of implementation, take a look.)
- There should be at least 3 buttons on form
- a submit button - when the user clicks submit, a new window should pop up using a text area to display all information in a nicely formated form.
- a clear button - use to clear all textfields and reset default values
- an exit button - to close the program
- The informational frame uses a text area to display all information and contains a close button to exit the frame and return to the main window when user is done viewing information.
- The main class, Assign112
- creates the ReservationFrame (or whatever you called your main frame class)
- sets the title for the frame
- sets the location of the frame
- assigns a default close operation
- sets visible to true
I suggest using one panel for textfields, another panel for combo box, list and slider, and a final panel for the three buttons. You will need to select the the best layout for each panel to make objects display as you like. Add those to the main frame using more than likely a BorderLayout.
Suggestion: You can use more panels to improve layout and place panels within other panels before adding to main frame. For example, if you have six JTextFields for first name, last name, address, city, state and zip, you could use three panels all with FlowLayout set to left. Add the first name label, first name textfield, last name label and last name textfield to the first FlowLayout panel, the address label and address textfield to the second FlowLayout panel, and add the labels and textfields for city state and zip to the third FlowLayout panel. Then, add all three panels to a grid layout panel using 3 rows and 1 column. So be creative, the sky is the limit.
Explanation / Answer
the code is somewhat incorrect.....
..u can go for some conceptual programs of java at java authorized site nd u will get an idea
if u need further help m there fr u :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.