All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Ask a Question
Search
Search
Sign In
Register
study help
computer science
java programming 8th
Questions and Answers of
Java Programming 8th
Which statements about modifiers are true?Select the two correct answers.(a) Abstract classes can declare final methods.(b) Fields can be declared as native.(c) Non-abstract methods can be declared
Which statement is true?Select the one correct answer.(a) The values of transient fields will not be saved during serialization.(b) Constructors can be declared as abstract.(c) The initial state of
A gradient fill is a gradual change in ______________.a. Colorb. Font sizec. Drawing styled. Line thickness
Event handlers are ___________.a. Abstract classesb. Concrete classesc. Listenersd. Methods
When you resize a Container that uses BorderLayout, _______________.a. The Container and the regions both change in sizeb. The Container changes in size, but the regions retain their original sizesc.
Write an application that extends JPanel and displays 15 nested circles, like those in the center panel in Figure 16-43. You may use only one drawOval() statement in the program. Save the file as
With 2D methods, the drawing line is known as a _____.a. Brushb. Strokec. Beltd. Draw
The process of drawing with Java 2D objects includes ______________.a. Specifying the rendering attributesb. Setting a drawing strokec. Both of the aboved. None of the above
A Graphics2D object can be produced by ______________.a. Calling setGraphics2D()b. Calling getGraphics2D()c. Casting a Graphics2D objectd. Casting a Graphics object
The data types returned by the getScreenResolution() and getScreenSize() methods are ______________.a. Both intsb. An int and an object of type Dimensionc. Both objects of type Dimensiond. Both
You can discover which fonts are available on your system by using the ______________.a. GetAvailableFontFamilyNames() method of the GraphicsEnvironment classb. GetFonts() method of the Graphics
To be certain that a vertical series of Strings drawn with object g has enough room to appear on a JPanel, which of the following expressions should you use for the vertical coordinate?a. Y +=
The measurement of an uppercase character from the baseline to the top of the character is its ______________.a. Ascentb. Descentc. Leadingd. Height
You use the ______________ method to copy any rectangular area to a new location.a. CopyRect()b. CopyArea()c. RepeatRect()d. RepeatArea()
The method you use to create a solid arc is ______________.a. SolidArc()b. FillArc()c. ArcSolid()d. ArcFill()
The zero-degree position for any arc is at the ______________ o’clock position.a. Threeb. Sixc. Nined. Twelve
If you draw an oval with the same value for width and height, you draw a(n) ______________.a. Circleb. Squarec. Rounded squared. Ellipsis
The statement g.drawRoundRect(100, 100, 100, 100, 0, 0); draws a shape that looks most like a ______________.a. Squareb. Round-edged rectanglec. Circled. Straight line
If you use the setColor() method to change a Graphics object’s color to yellow, ______________.a. Only the next output from the object appears in yellowb. All output from the object for the
The statement g.drawString(someString, 50, 100); places someString’s ______________ corner at position 50, 100.a. Upper-leftb. Lower-leftc. Upper-rightd. Lower-right
The three arguments to the drawString() method represent _____.a. A String and horizontal and vertical positionsb. A String, a Color, and a Fontc. A Graphics object, a String, and a Point positiond.
The method where you should place drawing code for Swing objects is ______________.a. CallPaint()b. Paint()c. RequestPaint()d. PaintComponent()
In Java, repainting of a visible surface is triggered by _____.a. The operating systemb. The applicationc. Either of thesed. None of these
You can use the ___________ method to determine the Object in which an ActionEvent originates.a. GetObject()b. GetEvent()c. GetOrigin()d. GetSource()
The MouseEvent method that allows you to identify double-clicks is ___________.a. GetDouble()b. IsClickDouble()c. GetDoubleClick()d. GetClickCount()
The KeyEvent method getKeyChar() returns a(n) ___________.a. Intb. Charc. KeyEventd. AWTEvent
The return type of getComponent() is ___________.a. Objectb. Componentc. Intd. Void
A JPanel is a ___________.a. Windowb. Containerc. Both of the aboved. None of the above
As you add new components to a GridLayout, ___________.a. They are positioned from left to right across each row in sequenceb. You can specify exact positions by skipping some positionsc. Both of the
The statement setLayout(new GridLayout(2,7)); establishes a GridLayout with ___________ horizontal row(s).a. Zerob. Onec. Twod. Seven
The GridBagLayout class allows you to ___________.a. Add components to precise locations within the gridb. Indicate that specific components should span multiple rows or columns within the gridc.
The statement ___________ ensures that components are placed from left to right across a JApplet surface until the first row is full, at which point a second row is started at the applet surface’s
Which of the following is the correct syntax for adding a JButton named b1 to a Container named con when using CardLayout?a. Con.add(b1);b. Con.add("b1");c. Con.add("Options", b1);d. None of the above
When you create a JFrame named myFrame, you can set its layout manager to BorderLayout with the statement _______________.a. MyFrame.setLayout = new BorderLayout();b. MyFrame.setLayout(new
If you add fewer than five components to a BorderLayout, _______________.a. Any empty component regions disappearb. The remaining components expand to fill the available spacec. Both a and bd. None
A file channel .a. Can be read fromb. Can be written toc. Is seekabled. All of the above are true.
The Path class getFileName() method returns .a. The String representation of a Pathb. An absolute Pathc. The first item in a Path’s list of name elementsd. The last item in a Path’s list of name
Which methods can throw an Exception?a. Methods with a throws clauseb. Methods with a catch blockc. Methods with both a throws clause and a catch blockd. Any method
A ____ array has rows of different lengths.a. Raggedb. Jaggedc. Haggardd. Tattered
The following defines a _____________ array:int[][] nums={ {1, 2}, {3, 4}, {5, 6} };a. One-dimensionalb. Two-dimensionalc. Three-dimensionald. Six-dimensional
Using a bubble sort involves _____________.a. Comparing parallel arraysb. Comparing each array element to the averagec. Comparing each array element to the adjacent array elementd. Swapping every
When you place objects in order beginning with the object with the highest value, you are sorting in _____________ order.a. Acquiescingb. Ascendingc. Demeaningd. Descending
Array names represent _____________.a. Valuesb. Functionsc. Referencesd. Allusions
The prefix ++ is a ___________ operator.a. Unaryb. Binaryc. Tertiaryd. Postfix
What is the output of the following code segment?t = 7;if(t > 7){ System.out.print("AAA"); System.out.print("BBB");}a. AAAb. BBBc. AAABBBd. Nothing
In Java, the value of (14 > 7) is ____________.a. Trueb. Falsec. 4d. 7
Which of the following is not a type of if statement?a. Single-alternativeb. Dual-alternativec. Reversed. Nested
Suppose that you have created a program with only the following variables.int a = 5;int b = 6;Suppose that you also have a method with the following header:public static void mathMethod(int a)Which
Write an application that extends JPanel and uses the Graphics2D environment to create a GeneralPath object. Use the GeneralPath object to create the outline of your favorite state. Display the
a. Write an application that extends JPanel and displays your name. Place boxes of different colors around your name at intervals of 10, 20, 30, and 40 pixels. Save the file as JBorderPanel.java.b.
Use polygons and lines to create a graphics image that looks like a fireworks display. Write an application that extends JPanel and displays the fireworks. Save the file as JFireworksPanel.java.
a. Write an application that extends JPanel and displays a yellow smiling face on the screen. Save the file as JSmileFacePanel.java.b. Add a JButton to the JSmileFacePanel program so the smile
In the statement x.drawString greeting("Hi ", 10, 10);, x is a ______________ object.a. Graphicsb. Stringc. JPaneld. Font
Write an application that extends JPanel and displays diagonal lines in a square, like those in the last panel in Figure 16-43. Save the file as JDiagonalLinesPanel.java. Figure 16-43 Output of the
Write an application that extends JPanel and displays eight nested rectangles, like those in the first panel in Figure 16-43. You may use only one drawRect() statement in the program. (Hint: Use it
a. In Chapters 7 and 8, you created a game named Secret Phrase in which the user guesses a randomly selected secret phrase by entering one letter at a time. Now create a GUI application that plays
Write an application that extends JPanel and displays a phrase. Each time the user clicks a button, alternate between displaying the phrase upside down and right-side up. Save the application as
The paintComponent() method header requires a(n) ______________ argument.a. Graphicsb. intc. Stringd. Color
You developed an interactive GUI application for Sammy’s Seashore Rentals. Now, design a JPanel that uses graphics to display a logo for the company, and modify the GUI application to include it.
Create an application that plays a card game named Lucky Seven. In real life, the game can be played with seven cards, each containing a number from 1 through 7. The cards are shuffled and dealt
a. Write an application that extends JPanel and displays a phrase in a large font. Each time the user clicks a JButton, display the same phrase in a different color, a little further to the right,
You developed an interactive GUI application for Carly’s Catering. Now, design a JPanel that uses graphics to display a logo for the company, and modify the GUI application to include it. Save the
a. In Chapter 9, you created a Tic Tac Toe game in which you used a 2D array of characters to hold Xs and Os for a player and the computer. Now create a JPanel that uses an array of nine JButtons to
Write an application that extends JPanel and displays a phrase in every font size from 6 through 20. Save the file as JFontSizesPanel.java.
Which of the following is true in a standard menu application?a. A JMenuItem holds a JMenu.b. A JMenuItem holds a JMenuBar.c. A JMenuBar holds a JMenu.d. A JMenu holds a JMenuBar
When a user clicks a JPanel or JFrame, the action generates a(n) ___________.a. ActionEventb. MouseEventc. PanelEventd. KeyboardEvent
AWTEvent is the child class of ___________.a. EventObjectb. Eventc. ComponentEventd. ItemEvent
The ___________ class allows you to arrange components as if they are stacked like index or playing cards.a. GameLayoutb. CardLayoutc. BoxLayoutd. GridBagLayout
Create a JFrame for Java Junior College. Use menus to allow the user to access information about different campuses, major fields of study offered, and activities. Include at least two options in
a. Create an application that uses a graphic interface to capture employee data and writes that data to a random access output file. The data required for each employee includes an employee ID number
The game StopGate is played on a checkerboard with a set of dominoes; each domino is large enough to cover two checkerboard squares. One player places a domino horizontally on the checkerboard,
a. Search the Java Web site for information on how to use a JTextArea. Write an application for the WebBuy Company that allows a user to compose the three parts of a complete e-mail message: the
Create the game Lights Out using a BorderLayout. Place a five-by-five grid of panels in one region, and reserve another region for a congratulatory message. Randomly set each panel in the grid to a
Write an application that lets you determine the integer value returned by the InputEvent method getModifiers() when you click your left, right, or—if you have one—middle mouse button on a
Create aMine Sweeper game by setting up a grid of rows and columns in which “bombs” are randomly hidden. You choose the size and difficulty of the game; for example, you might choose to create a
When you use ___________, the components you add fill their region; they do not retain their default size.a. FlowLayoutb. BorderLayoutc. FixedLayoutd. RegionLayout
You set up the card game Concentration by placing pairs of cards face down in a grid. The player turns up two cards at a time, exposing their values. If the cards match, they are removed from the
Create a JFrame with JPanels, a JButton, and a JLabel. When the user clicks the JButton, reposition the JLabel to a new location in a different JPanel. Save the file as JMovingFrame.java.
You can use the ___________ class to arrange components in a single row or column of a container.a. FlowLayoutb. BorderLayoutc. CardLayoutd. BoxLayout
Create a target practice game that allows the user to click moving targets and displays the number of hits in a 10-second period. (In Chapter 4, you learned how to use the LocalDateTime class to
Create a JFrame that uses BorderLayout. Place a JButton in the center region. Each time the user clicks the JButton, change the background color in one of the other regions. Save the file as
The game Corner the King is played on a checkerboard. To begin, a checker is randomly placed in the bottom row. The player can move one or two squares to the left or upwards, and then the computer
Create a JFrame that holds five buttons with the names of five different fonts. Include a sixth button that the user can click to make a font larger or smaller. Display a demonstration JLabel using
You created an interactive GUI application for Sammy’s Seashore Rentals that allows the user to enter a rental time in hours, an equipment type, and a lesson option. Then, the application displays
a. Create a game that helps new mouse users improve their hand-eye coordination. Within a JFrame, display an array of 48 JPanels in a GridLayout using eight rows and six columns. Randomly display an
Create an educational program for children that distinguishes between vowels and consonants as the user clicks buttons. Create 26 JButtons, each labeled with a different letter of the alphabet.
You created an interactive GUI application for Carly’s Catering that allows the user to enter a number of guests for an event and to choose an entrée, two side dishes, and a dessert from groups of
a. Create aMine Field game in which the user attempts to click 10 panels of a grid before hitting the “bomb.” Set up a JFrame using BorderLayout, use the NORTH region for a congratulatory
Create a JFrame and set the layout to BorderLayout. In each region, place a JButton that displays the name of a classic movie that has the region name in its title. For example, the east button might
__________ are popup windows that appear when a user hovers the mouse pointer over a component.a. Navigation notesb. Tool tipsc. Help iconsd. Graphic suggestions
Design an application for a pizzeria. The user makes pizza order choices from list boxes, and the application displays the price. The user can choose a pizza size of small ($7), medium ($9), large
Create an application that accepts employee data interactively. Users might make any of the following errors as they enter data:The employee number is not numeric, less than 1000, or more than
Create a UsedCarException class that extends Exception; its constructor receives a value for a vehicle identification number (VIN) that is passed to the parent constructor so it can be used in a
Create an ApartmentException class whose constructor receives a String that holds a street address, an apartment number, a number of bedrooms, and a rent value for an apartment. Save the file as
You wrote an application named DistanceFromAverage that allows a user to enter up to 20 double values and then displays each entered value and its distance fromthe average. Now,modify that programto
Write an application named BadSubscriptCaught in which you declare an array of 10 first names. Write a try block in which you prompt the user for an integer and display the name in the requested
Create a Building class and two subclasses, House and School. The Building class contains fields for square footage and stories. The House class contains additional fields for number of bedrooms and
The Cullerton Park District holds a mini-Olympics each summer. Create a class named Participant with fields for a name, age, and street address. Include a constructor that assigns parameter values to
Which of the following choices is the best example of a parent class/child class relationship?a. Rose/Flowerb. Present/Giftc. Dog/Poodled. Sparrow/Bird
Create an ItemSold class for Francis Pet Supply. Fields include an invoice number, description, and price. Create get and set methods for each field. Create a subclass named PetSold that descends
Showing 200 - 300
of 332
1
2
3
4