Question

Answers to Self-Review Exercises 625 14.3 d) In a BorderLayout, two buttons added to the NORTH region will be placed side by
626 Chapter 14 GUI Components: Part 1 d) Graphics method setFont is used to set the font for text fields e) A list displays a

i want answers please ???
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Only one question is allowed at a time, but as questions are small I have done most of them. Please comment for any problem. Please Uprate. Thanks. Rest you have to ask each question separately.

14.4

a) JTextComponent

b) add

c) mouseClicked

d) ButtonGroup

14.5

a) True

b) True

c) True

d) False, Component method setFont is used

e) False, a JList never provides a scrollbar

f) False, a Mouse object is not provided by Java

14.6

a) True

b) True

c) True

d) False, a JList is a JComponent

e) False, a JButton is an AbstractButton

f) True

g) False, ButtonGroup inherits from Object

14.7

a) semicolon is mised after the class name.

b) The GridLayout constructor cannot be used in this manner. The correct statement should be:

panelObject.getContentPane().setLayout( new GridLayout (8, 8));

c) Class FlowLayout does not contain static constant DEFAULT.

d) EAST should be BorderLayout.EAST

14.8

import javax.swing.*;

import java.awt.*;

public class Align extends JApplet {

   private JButton ok, cancel, help;

   private JTextField xValue, yValue;

   private JCheckBox snap, show;

   private JLabel xLabel, yLabel;

   private JPanel checkPanel, buttonPanel,

                  fieldPanel1, fieldPanel2,

                  fieldPanel;

   public void init()

   {

      // build checkPanel

      snap = new JCheckBox( "Snap to Grid" );

      show = new JCheckBox( "Show Grid" );

      checkPanel = new JPanel();

      checkPanel.setLayout( new GridLayout( 2 , 1 ) );

      checkPanel.add( snap );

      checkPanel.add( show );

      // build field panel1

      xLabel = new JLabel( "X: " );

      xValue = new JTextField( "8", 3 );

      fieldPanel1 = new JPanel();

      fieldPanel1.setLayout( new FlowLayout( FlowLayout.CENTER, 3, 5 ) );

      fieldPanel1.add( xLabel );

      fieldPanel1.add( xValue );

      yLabel = new JLabel( "Y: " );

      yValue = new JTextField( "8", 3 );

      fieldPanel2 = new JPanel();

      fieldPanel2.setLayout( new FlowLayout( FlowLayout.CENTER, 3, 5 ) );

      fieldPanel2.add( yLabel );

      fieldPanel2.add( yValue );

      fieldPanel = new JPanel();

      fieldPanel.setLayout( new BorderLayout() );

      fieldPanel.add( fieldPanel1, BorderLayout.NORTH );

      fieldPanel.add( fieldPanel2, BorderLayout.SOUTH );

     

      // build button panel

      ok = new JButton( "Ok" );

      cancel = new JButton( "Cancel" );

      help = new JButton( "Help" );

      buttonPanel = new JPanel();

      buttonPanel.setLayout( new GridLayout( 3, 1, 10, 5 ) );

      buttonPanel.add( ok );

      buttonPanel.add( cancel );

      buttonPanel.add( help );

      // set layout for applet

      getContentPane().setLayout(

            new FlowLayout( FlowLayout.CENTER, 10, 5 ) );

      getContentPane().add( checkPanel );

      getContentPane().add( fieldPanel );

      getContentPane().add( buttonPanel );

   }

}

Output:

- D X Applet Viewer: Ali... Applet Ok Snap to Grid Show Grid X: 8 Y: 8 Cancel Help

Add a comment
Know the answer?
Add Answer to:
i want answers please ??? Answers to Self-Review Exercises 625 14.3 d) In a BorderLayout, two...
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
  • please help me debug this Create a GUI for an application that lets the user calculate...

    please help me debug this Create a GUI for an application that lets the user calculate the hypotenuse of a right triangle. Use the Pythagorean Theorem to calculate the length of the third side. The Pythagorean Theorem states that the square of the hypotenuse of a right-triangle is equal to the sum of the squares of the opposite sides: alidate the user input so that the user must enter a double value for side A and B of the triangle....

  • Basic button tracking Deliverables Updated files for app6.java myJFrame6.java myJPanel6.java student.java Contents You can start with...

    Basic button tracking Deliverables Updated files for app6.java myJFrame6.java myJPanel6.java student.java Contents You can start with the files available here. public class app6 { public static void main(String args[]) {     myJFrame6 mjf = new myJFrame6(); } } import java.awt.*; import javax.swing.*; import java.awt.event.*; public class myJFrame6 extends JFrame {    myJPanel6 p6;    public myJFrame6 ()    {        super ("My First Frame"); //------------------------------------------------------ // Create components: Jpanel, JLabel and JTextField        p6 = new myJPanel6(); //------------------------------------------------------...

  • True/False Question 1. A Linked List will have no limited size. You may add or insert...

    True/False Question 1. A Linked List will have no limited size. You may add or insert as many elements as needed. True False 2. Linked List search is a linear search. Therefore it will be slow. True False 3. A JPanel can contain zero or more JPanels. True False 4. Users can interact with JLabel component. True False 5. This code is to add a panel to the south region of a JFrame JPanel panel = new JPanel (); frame.add...

  • Topic: JAVA 18) Abstract methods are used when defining A) interface classes B) derived classes C)...

    Topic: JAVA 18) Abstract methods are used when defining A) interface classes B) derived classes C) classes that have no constructor D) arrays E) classes that have no methods 32) Which of the following GUI classes requires that it have a LayoutManager before any GUI components are added to it? A) JButton B) JSlider C) JPanel D) JFrame E) both C and D but not A or B 33) In using the BoxLayout, adding space between components in a container...

  • How can i make the java class seperate into an MVC pattern? public class ChatView implements Acti...

    How can i make the java class seperate into an MVC pattern? public class ChatView implements ActionListener {    public static void main(String[] args)    {        JFrame chatFrame = new JFrame();        JFrame chatFrame1 = new JFrame();        JFrame chatFrame2 = new JFrame();               JPanel chatPanel = new JPanel();        JPanel chatPanel1 = new JPanel();        JPanel chatPanel2 = new JPanel();        chatFrame.setContentPane(chatPanel);        chatFrame1.setContentPane(chatPanel1);        chatFrame2.setContentPane(chatPanel2);        chatFrame.setLayout(new FlowLayout());        chatFrame1.setLayout(new FlowLayout());        chatFrame2.setLayout(new FlowLayout());        JTextField chatWrite = new JTextField();        JTextField chatWrite1 = new JTextField();        JTextField chatWrite2 = new JTextField();        JTextArea chatDisplay...

  • I want to make the JText area scrollable.. but my result doesn't work in that way....

    I want to make the JText area scrollable.. but my result doesn't work in that way. help me plz. package m5; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class TextAnalyzer extends JFrame implements ActionListener {    //Initializes component variables for the frame       //For text typing area    JLabel type = new JLabel("Type sentences in the box below.", JLabel.CENTER);    JTextArea txt = new JTextArea(10, 10);    JPanel txt1 = new JPanel();       //For Statistic data...

  • Any thoughts on this, i can get it to run but can't pass code around and...

    Any thoughts on this, i can get it to run but can't pass code around and the button doesnt move around. i didnt pass the student, or the app.java. What will you learn Combined use of Timer and the tracking of user interactions Deliverables app.java myJFrame.java myJPanel.java and other necessary Java files Contents The objective of the lab is to create a game in which the player has to click on a moving student-button to score. The student button has...

  • Please fix and test my code so that all the buttons and function are working in...

    Please fix and test my code so that all the buttons and function are working in the Sudoku. CODE: SudokuLayout.java: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; public class SudokuLayout extends JFrame{ JTextArea txtArea;//for output JPanel gridPanel,butPanel;//panels for sudoku bord and buttons JButton hint,reset,solve,newPuzzel;//declare buttons JComboBox difficultyBox; SudokuLayout() { setName("Sudoku Bord");//set name of frame // setTitle("Sudoku Bord");//set...

  • Please design a Java GUI application with two JTextField for user to enter the first name...

    Please design a Java GUI application with two JTextField for user to enter the first name and last name. Add two JButtons with action events so when user click on one button to generate a full name message from the user input and put it in a third JTextField which is not editable; and click on the other button to clear all three JTextField boxes. Please run the attached nameFrame.class file (Note: because there is an actionhandler inner class in...

  • 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");...

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