Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 12, Problem 1MC
With Swing, you use this class to create a frame.
- a. Frame
- b. SwingFrame
- c. JFrame
- d. JavaFrame
Expert Solution & Answer
Program Description Answer
To create a frame with the use of “Swing”, the programmer should use the “JFrame” class for the application.
Hence, correct answer is option “C”.
Explanation of Solution
“JFrame” class:
- The basic window of the swing application is known as frame.
- To create a frame, the programmer should create an object for the “JFrame” class in a Swing application.
- The package of “import javax.swing.JFrame*” should import in the program before using the “JFrame” class.
Syntax:
JFrame object_name=new JFrame();
Here,
- “JFrame” is the class name.
- “object_name” is the object name of the frame.
The programmer can use the object name of “JFrame” class to insert components in the window.
Want to see more full solutions like this?
Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
In java pls
How to create a program that does this in Jcreator / javafx
package colordialog;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.GradientPaint;
import javax.swing.JButton;
class ColorButton extends JButton implements ActionListener
{
int indexColor;
ColorLabel currColor;
ColorLabel [] colorArray;
ColorButton()
{
colorArray=new ColorLabel[7];
colorArray[0]=new ColorLabel("RED" ,new Color(255, 0, 0));//RED
colorArray[1]=new ColorLabel("ORANGE",new Color(255,128, 0));//ORANGE
colorArray[2]=new ColorLabel("YELLOW",new Color(255,255, 0));//YELLOW
colorArray[3]=new ColorLabel("GREEN" ,new Color( 0,255, 0));//GREEN
colorArray[4]=new ColorLabel("BLUE" ,new Color( 0, 0,255));//Blue
colorArray[5]=new ColorLabel("INDIGO",new Color(128, 0,255));//INDIGO
colorArray[6]=new ColorLabel("VIOLET",new Color(192, 0,192));//PURPLE
indexColor=0;…
Chapter 12 Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Ch. 12.2 - Prob. 12.1CPCh. 12.2 - Prob. 12.2CPCh. 12.2 - Prob. 12.3CPCh. 12.2 - Prob. 12.4CPCh. 12.2 - Prob. 12.5CPCh. 12.2 - Prob. 12.6CPCh. 12.2 - If you are writing an event listener class for a...Ch. 12.2 - Prob. 12.8CPCh. 12.2 - Prob. 12.9CPCh. 12.3 - Prob. 12.10CP
Ch. 12.3 - Prob. 12.11CPCh. 12.3 - Which layout manager arranges components in a row,...Ch. 12.3 - Prob. 12.13CPCh. 12.3 - Prob. 12.14CPCh. 12.3 - Prob. 12.15CPCh. 12.3 - Prob. 12.16CPCh. 12.3 - Prob. 12.17CPCh. 12.4 - Prob. 12.18CPCh. 12.4 - Prob. 12.19CPCh. 12.4 - Prob. 12.20CPCh. 12.4 - Prob. 12.21CPCh. 12.4 - Prob. 12.22CPCh. 12.4 - Prob. 12.23CPCh. 12.4 - Prob. 12.24CPCh. 12.4 - Prob. 12.25CPCh. 12.5 - Prob. 12.26CPCh. 12.5 - Prob. 12.27CPCh. 12 - With Swing, you use this class to create a frame....Ch. 12 - Prob. 2MCCh. 12 - Prob. 3MCCh. 12 - Prob. 4MCCh. 12 - Prob. 5MCCh. 12 - Prob. 6MCCh. 12 - Prob. 7MCCh. 12 - Prob. 8MCCh. 12 - Prob. 9MCCh. 12 - Prob. 10MCCh. 12 - Prob. 11MCCh. 12 - Prob. 12TFCh. 12 - Prob. 13TFCh. 12 - Prob. 14TFCh. 12 - Prob. 15TFCh. 12 - Prob. 16TFCh. 12 - Prob. 17TFCh. 12 - Prob. 18TFCh. 12 - Prob. 19TFCh. 12 - Prob. 20TFCh. 12 - The following statement is in a class that uses...Ch. 12 - Prob. 2FTECh. 12 - Prob. 3FTECh. 12 - Prob. 4FTECh. 12 - Prob. 5FTECh. 12 - Prob. 1AWCh. 12 - Prob. 2AWCh. 12 - The variable myWindow references a JFrame object....Ch. 12 - Prob. 4AWCh. 12 - Prob. 5AWCh. 12 - Prob. 6AWCh. 12 - Prob. 7AWCh. 12 - Prob. 8AWCh. 12 - Prob. 9AWCh. 12 - Prob. 1SACh. 12 - Prob. 2SACh. 12 - Prob. 3SACh. 12 - Prob. 4SACh. 12 - Retail Price Calculator Create a GUI application...Ch. 12 - Prob. 2PCCh. 12 - Prob. 3PCCh. 12 - Travel Expenses Create a GUI application that...Ch. 12 - Prob. 5PCCh. 12 - Joes Automotive Joes Automotive performs the...Ch. 12 - Prob. 8PC
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Create a simple program that includes JFrame, JPanel, JLabel, JFields, JTextArea, and JButton. The program should ask the user for the following input: First name • Last name Middle name • Mobile number E-mail address. Two (2) frames will be used in this program: OUTPUT and INPUT. The following conditions must be satisfied by the program. Input Frame: Set the window name to INPUT. • The input frame should collect all the details listed on Step 2. It should contain Submit and Clear All buttons. • When the Submit button is clicked, it should generate the output frame and disable the Submit button. • When the Clear All button is clicked, it should clear all the content that were entered by the user in the input frame, and close the output frame if it is open. Output Frame: • Set the window name to OUTPUT. • The output frame should display all the details that were entered by the user with the corresponding label. The output frame should contain an Okay button. When the Okay button is…arrow_forwardCreate a GUI with 2 frames. Top frame should have a label with a nice welcome message. Bottom frame should have a button called "try me" When button is clicked, it should generate a message in the box that says "How are you doing today?" Please post answer in Python with screenshots, full solution and comments. Thanks!arrow_forward2. Write a Java Code for a simple GUI program that creates a frame and changes the background to green. Examiner's Name: George Kodjo Anniarrow_forward
- Exercise 3: Write a Java program which creates two frames, each containing one button. When you execute the program only one JFrame will appear and when you click on its button it will disappear and the other JFrame will appear. If you click on the button of the second frame it will make it disappear and let the first frame appear. And so on... MyFrame 1 MyFrame 2 Button click clickarrow_forwardWhat happens when you open a picture and then change the frame size? What happens if you open a picture after resizing the frame to the desired dimensions?arrow_forward#create a duplicate of the image for y in range (image.getHeight()-1): for x in range (1, image.getWidth () -1): #Row major traversal of each pixel #display in the image oldPixel=image.getPixel(x,y) #Get the pixel present at current place leftPixel=image.getPixel(x-1,y) #Get left pixel. bottomPixel=image.getPixel (x, y+1) #Get bottom pixel oldLum-average (oldPixel) #calcule luminance of current pixel leftLum-average (leftPixel) #calculate luminance of left pixel bottomLum=average (bottomPixel) #calculate luminance of right pixel if abs (oldLum-leftLum) >threshold or\ abs (oldLum-bottomLum) >threshold: new.setPixel (x,y, sharpen (old, degree)) return new #3main function def main (): #Input image image=Image ("testImage.gif") image.draw () #Call the method, edge detection out=edge_detection (image, 80,10) out.draw () if main () name main ": ==arrow_forward
- The parameter is wrong. The size of the image is not supported. Each picture must have a resolution of between 40 and 2600 pixels.arrow_forwardCreate a window and add a canvas to it. Now draw an arc, a polygon and an oval within this canvas. You can place them at random positions within the screen as long as they are visible and can be seen when executing the program. Example image attachedarrow_forwardStep 1: Code in Java and name the java class file Artwork.javaStep 2: Have your JavaFx program set the Stage title to be your first and last name in the start method.Step 3: For this assignment, you are to create some simple JavaFx “generative art” Step 4: Your program must use one or more of the shape classes like Rectangle, Text, Circle, Arc, etc. (Refer to Javadoc page for ideas)Step 5: Your program must use one or more colors. (Refer to Javadoc page for ideas)Step 6: Your program must use java.util.Random to make the output change each time your program is run (for example, the colors, locations, and size of the shapes).Step 7: Describe the program and its behavior in a couple sentences. Note: Make sure to include the used javafx import statements in the solution box.arrow_forward
- What is a container object in GUI programming? A container is another name for an array or vector. A container is any class that is made up of other classes. A container is a primitive variable that contains the actual data. A container is an object like a Frame that has other GUI components placed inside of it.arrow_forwardChapter 18 Problem 38.PE Textbook: Introduction to Java programming and datastructure. 11th Edition Y. Daniel Liang Publisher: PEARSON ISBN: 9780134670942 This code is taken from your website does not work. package e38; import javafx.application.Application;import javafx.event.ActionEvent;import javafx.event.EventHandler;import javafx.scene.Scene;import javafx.scene.control.Button; import javafx.stage.Stage;import javafx.geometry.Pos;import javafx.scene.control.Label;import javafx.scene.control.TextField;import javafx.scene.control.Textfield;import javafx.scene.layout.BorderPane;import javafx.scene.layout.HBox;import javafx.scene.layout.Pane;import javafx.scene.shape.Line;import javafx.stage.Stage; public class E38 extends Application { @Override public void start(Stage primaryStage) { // Create a pane TreePane tp = new TreePane(); // Create a textfield TextField tfOrder = new TextField(); // Set the Depth…arrow_forwardWrite a code interface for the SWING in java, which includes five buttons on the lower right-wide area and a list of names on the left and on the right side put image with information to display and in top put menu includes file and close .arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Time Complexity Analysis - How To Calculate Running Time | InterviewBit; Author: InterviewBit;https://www.youtube.com/watch?v=--oxG4Q1PA0;License: Standard YouTube License, CC-BY