Question
Java Help

References Mailings Review View No Spacing Heading 1 Heading 2 Normal For following questions, please provided your solutions
rences Mailings Review View Normal No Spacing Heading 1 Heading 2 Using the code for the GUI you build in question 1, complet
Documentl eferences MailingsReviewView No Normal Spacing Heading1 Heading 2 The dialogue box should have the following text
ces Mailings Review View AaBbCcDdEe AaBbCcDdEe AaBbCcD AaBbCcDdE Normal No SpacingHeading 1Heading 2 Bonus Question s. Comple
References Mailings Review View No Spacing Heading 1 Heading 2 Normal For following questions, please provided your solutions for each of the questions in a separate Word document to include screenshots of execution of the code. Using IntellJ IDE, which can be downloaded at the following address https://www.jetbrains.com/idea/downloadf#eection windows. Be sure to select the Community version. Create a project using the proper naming convention a. b. Create the code to build a GUI and should have the following characteristics i. Should be a JFrame that is 700 by 900. ii. The title of the JFrame should be My First GUL ii. Should have the ability to close the GUI when clicking on the X at the top. Should include one button and one JText field. The button should have text "Next iv. Provide a screenshot of the code and a screenshot of the GUL c. d. Do not use the GUI builder for this assignment. ted States) Focus
rences Mailings Review View Normal No Spacing Heading 1 Heading 2 Using the code for the GUI you build in question 1, complete the following items. For the button, use the border layout to place it in the NORTH quadrant of the JFrame. For the JText Field, use the border layout to place it in the SOUTH quadrant of the JFrame. e. f. Create a second button and place it using the border layout in the EAST g. quadrant of the JFrame. The second button should have the text "OK h. Provide a screenshot of your code and a screenshot of the GUL The first button you created should have a dialogue box associated with it, which can be accomplished by the following i. Create a dialogue box using JOption Pane ates)
Documentl eferences MailingsReviewView No Normal Spacing Heading1 Heading 2 The dialogue box should have the following text "Click OK to Continue" j. k. Provide a screenshot of your code and a screenshot of the GUI For the JFrame that was used the previous questions, you need to make the following changes: 1. Change the background color to RED. Provide a screenshot of the code and the GUI m. Change the background color to BLUE. Provide a sereenshot of the code and the GUI Change title of JFrame from My First GUI to My Color Changing GUL n. In question 2, you used the border layout to position your buttons and JText Field. For this question, complete the following. o. For the buttons and JText Field, use the Box Layout with PAGE AXIS p. Provide a screenshot of the code and screenshot of the GUI q. For the buttons and JText Field, modify your current code to use Box Layout with LINE AXIS Provide a screenshot of the code and screenshot of the GUI r.
ces Mailings Review View AaBbCcDdEe AaBbCcDdEe AaBbCcD AaBbCcDdE Normal No SpacingHeading 1Heading 2 Bonus Question s. Complete question 1 using the GUI builder in IntelliJ. For an additional 5 points, create tool tips for both the button and the t. JText Field. u. Provide a screenshot of the code and screenshot of the GUI
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program:

---------------------------------------------------------------------------------------------------------------------------------

import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.*;

public class Message {
JFrame dialBox;
Message(){
dialBox=new JFrame();
JOptionPane.showMessageDialog(dialBox,"Click OK to continue");
}
}

public class Example {

static JTextField textField;
static JButton nextB,okB;

public static void main(String[] args) {
  
JFrame f = new JFrame("My First GUI");
f.setSize(700, 900);
f.setDefaultCloseOperation(EXIT_ON_CLOSE);
nextB=new JButton("Next");
f.add(nextB, BorderLayout.NORTH);
textfield = new JTextField("Text field");
f.add(textField, BorderLayout.SOUTH);
okB=new JButton("Ok");
f.add(okB, BorderLayout.EAST);
nextB.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new Message();
}
});
  
f.setVisible(true);
}
}

---------------------------------------------------------------------------------------------------------

Explanation:

First of all we have imported the packages that we needed in our program.

After that come directly to the Example class where our main function is present. Here we have declared two buttons and one text field which we want in our frame.

And then we start our main function. First of all we have created a JFrame having name f and we have passed the name in the constructor (whatever name we send in the constructor, it is showed on the top bar of the frame).

Then we fixed the size of frame 700*900 pixels by using setSize() function.

By default the frame will show the cross button but it does not work. So we used the setDefaultCloseOperation(EXIT_ON_CLOSE) to make it functionable.

Then we have taken taken instances of buttons okB, nextB by passing the names of Buttons which we want to show on the buttons (Ok, Next), then we attached the buttons to the frame with f.add() where 1st argument is button variable name and 2nd argument to position the buttons like NORT,SOUTH,EAST,WEST, CENTRE: there are five positions we can set.

Then we took the instance of text field and positioned it as same steps as of buttons.

Then we had to show a dialog box on clicking the next button. For that, we have attached an actionListener with the button which will execute the steps defined in it, every time it gets clicked. For the dialog box we have taken another class Message to open the dialog box where we used predefined function showMessageDialog() of JOptionPane Class( where 1st argument is the variable name of frame and 2nd is the message we want to show) to open the dialog box.

And the frame will not appear until we set its visibility as true by setVisible(true).

Add a comment
Know the answer?
Add Answer to:
Java Help References Mailings Review View No Spacing Heading 1 Heading 2 Normal For following questions, please provided your solutions for each of the questions in a separate Word document to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Mailings Review View AaBbccodte A aBbCcD AaBbceDdE Aal Normal No Spacing Heading 1 Heading 2 Tit...

    Mailings Review View AaBbccodte A aBbCcD AaBbceDdE Aal Normal No Spacing Heading 1 Heading 2 Tit #C Trump corporate tax; health insurance; luncheon club dilemma 1. computation of shareholder's tax rate when corporate tax rate is 35% and the dividend tax is 15% la, how does this change when corporate tax rate changes into 15%? 2. Consider an insurance policy of full coverage (all expenses covered). When a person is hospitalized, the patient bears no financial cost if her stay...

  • i want answers please ??? Answers to Self-Review Exercises 625 14.3 d) In a BorderLayout, two...

    i want answers please ??? Answers to Self-Review Exercises 625 14.3 d) In a BorderLayout, two buttons added to the NORTH region will be placed side by side. e) A maximum of five components can be added to a BorderLayout ) Inner classes are not allowed to access the members of the enclosing class. B) A TextArea's text is always read-only. h) Class TextArea is a direct subclass of class Component. Find the error(s) in each of the following statements,...

  • Document Layout References Mailings Review View AS MADAM ABCD ABCD AaBb CODE Heading * 1) ITV...

    Document Layout References Mailings Review View AS MADAM ABCD ABCD AaBb CODE Heading * 1) ITV Company received $36,000 cash on March 1, 2019, from XYZ Company as an advance payment for services ITV promised to perform for XYZ over the next three years on a continuous basis. Assume that ITV Company's year-end is December 31. On its 2020 income statement, ITV would report revenue of 2) On October 1, Year 1, Senegal Company paid $1,200 in advance for rent...

  • Project overview: Create a java graphics program that displays an order menu and bill from a...

    Project overview: Create a java graphics program that displays an order menu and bill from a Sandwich shop, or any other establishment you prefer. In this program the design is left up to the programmer however good object oriented design is required. Below are two images that should be used to assist in development of your program. Items are selected on the Order Calculator and the Message window that displays the Subtotal, Tax and Total is displayed when the Calculate...

  • Flooding activity online Compatibility Mode Saved Picture Tools joykaffenber Design Layout References Mailings Review View Help...

    Flooding activity online Compatibility Mode Saved Picture Tools joykaffenber Design Layout References Mailings Review View Help Format AaBbCel AaBbC AaBbCcl AaBbCcl Aa Heading 1 Paragraph Font Styles GLY 120This Dangerous Earth Flooding Activity The Corps of Engineers Presents: H:0 Overload Assignment: Floodplain Management Details: You are the developer of a new community and must decide where to construct the following: a city park, a hospital, and a self storage business. The locations chosen for each construction site should correspond with...

  • need answers to questions 1-4 Me 9Search ACC111 GroupProjectilnstructions_V1a.docx - Saved Help View Review Mailings References...

    need answers to questions 1-4 Me 9Search ACC111 GroupProjectilnstructions_V1a.docx - Saved Help View Review Mailings References Layout AaBbCcD AaBbCcDx AaBbi AaBbCcC AaB A 1 Normal 1 No Spac. Heading 1 Heading 2 A A Aa- Ap Title A-D- A- Styles Paragraph Group Project 1 Let's examine a case using Sal's Silly Song Corporation and Greg's Tunes Corporation. It is now the end of the first year of operations and both company's want to know how well they came out at...

  • Java Painter Class This is the class that will contain main. Main will create a new...

    Java Painter Class This is the class that will contain main. Main will create a new Painter object - and this is the only thing it will do. Most of the work is done in Painter’s constructor. The Painter class should extend JFrame in its constructor.  Recall that you will want to set its size and the default close operation. You will also want to create an overall holder JPanel to add the various components to. It is this JPanel that...

  • please help me. thank you in advance. Assignment%20#%204%20Case%20Study(11.doalCompatibility Medel-word EVIEW VIEW 1 Normal No Spacing Heading...

    please help me. thank you in advance. Assignment%20#%204%20Case%20Study(11.doalCompatibility Medel-word EVIEW VIEW 1 Normal No Spacing Heading 1 Heading2 Te Subiale Sulbtle Em.. Eemphasis Intense E. S Styles Assignment # 4-Case Study-second assignmnt-using MSDS in urgent situations Must use MSDS!! You are walking down the hallway of your facility, and you see a housekeeper frantically signaling fo You approach the housekeeper and notice that her eyes are red, watery, and they are itchy. She is rubbing her hands on her face,...

  • JAVA Hello I am trying to add a menu to my Java code if someone can...

    JAVA Hello I am trying to add a menu to my Java code if someone can help me I would really appreacite it thank you. I found a java menu code but I dont know how to incorporate it to my code this is the java menu code that i found. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; public class MenuExp extends JFrame { public MenuExp() { setTitle("Menu Example");...

  • the first question java code eclipse app the second question is java fx gui caculator please...

    the first question java code eclipse app the second question is java fx gui caculator please fast 1. Create project called "YourFirstName_QUID'. Eg. Aliomar_202002345 2. Create two package Q1 and Q2. 3. Add your name and studentID as comments on the top of each Java source file you submit. Question 1. Bookings APP [80 Points-six parts] Implement the following hotel booking system. Use the following class diagram to understand the structure of the system's classes, their attributes operations (or methods),...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT