Java

Write a GUI application that prompts the user for a number between 1 and 5. Be sure to include error checking so that the program continues to prompt the user for a number until the user's entry is between 1 and 5, inclusive.

Once a valid number is entered, the program should display a grid of horizontal and vertical lines inside the frame.
These lines should be drawn such that:

• The lines create x number of horizontal and x number of vertical boxes, where x is the number entered by the user.

• Each box should be 100 pixels by 100 pixels.

• The grid is spaced inside the frame such that it is perfectly centered both horizontally and vertically, with a 10-pixel border between the edge of the frame and the grid.

I cannot figure out how to make a border with the gridlayout. Please help!

  1. 👍 0
  2. 👎 0
  3. 👁 171
  1. Have you decided what makes the grid, JButtons, JPanels, etc.?

    If you use a JPanel as a container for the grid made up of buttons, or other panels, you can use the BevelBorder to make borders by adding it onto the panel.

    and it is not difficult to use. For a JPanel named p, you can do this with a single statement:

    p.setBorder(new javax.swing.border.BevelBorder(1));

    Read up the API for more details:
    javax.swing.border.BevelBorder

    1. 👍 0
    2. 👎 0
  2. Write a GUI application that prompts the user for a number between 1 and 5. Be sure to include error checking so that the program continues to prompt the user for a number until the user's entry is between 1 and 5, inclusive.

    Once a valid number is entered, the program should display a grid of horizontal and vertical lines inside the frame.
    These lines should be drawn such that:

    • The lines create x number of horizontal and x number of vertical boxes, where x is the number entered by the user.

    • Each box should be 100 pixels by 100 pixels.

    • The grid is spaced inside the frame such that it is perfectly centered both horizontally and vertically, with a 10-pixel border between the edge of the frame and the grid.

    I cannot figure out how to make a border with the gridlayout. Please help!

    1. 👍 0
    2. 👎 0
  3. I cannot figure out how to make a border with the gridlayout. Please help!

    1. 👍 0
    2. 👎 0
  4. Write a GUI application that prompts the user for a number between 1 and 5. Be sure to include error checking so that the program continues to prompt the user for a number until the user's entry is between 1 and 5, inclusive.

    Once a valid number is entered, the program should display a grid of horizontal and vertical lines inside the frame.
    These lines should be drawn such that:

    • The lines create x number of horizontal and x number of vertical boxes, where x is the number entered by the user.

    • Each box should be 100 pixels by 100 pixels.

    • The grid is spaced inside the frame such that it is perfectly centered both horizontally and vertically, with a 10-pixel border between the edge of the frame and the grid

    1. 👍 0
    2. 👎 0
  5. Each box should be 100 pixels by 100 pixels.

    • The grid is spaced inside the frame such that it is perfectly centered both horizontally and vertically, with a 10-pixel border between the edge of the frame and the grid

    1. 👍 0
    2. 👎 0
  6. Write me java code for a GUI application that prompts the user for a number between 1 and 5. Be sure to include error checking so that the program continues to prompt the user for a number until the user's entry is between 1 and 5, inclusive.

    Once a valid number is entered, the program should display a grid of horizontal and vertical lines inside the frame.
    These lines should be drawn such that:

    • The lines create x number of horizontal and x number of vertical boxes, where x is the number entered by the user.

    • Each box should be 100 pixels by 100 pixels.

    • The grid is spaced inside the frame such that it is perfectly centered both horizontally and vertically, with a 10-pixel border between the edge of the frame and the grid.

    I cannot figure out how to make a border with the gridlayout. Please help!

    Java - MathMate, Tuesday, December 15, 2009 at 2:45pm
    Have you decided what makes the grid, JButtons, JPanels, etc.?

    If you use a JPanel as a container for the grid made up of buttons, or other panels, you can use the BevelBorder to make borders by adding it onto the panel.

    and it is not difficult to use. For a JPanel named p, you can do this with a single statement:

    p.setBorder(new javax.swing.border.BevelBorder(1));

    Read up the API for more details:
    javax.swing.border.BevelBorder

    Java - jeam, Tuesday, July 13, 2010 at 3:36pm

    Write a GUI application that prompts the user for a number between 1 and 5. Be sure to include error checking so that the program continues to prompt the user for a number until the user's entry is between 1 and 5, inclusive.

    Once a valid number is entered, the program should display a grid of horizontal and vertical lines inside the frame.
    These lines should be drawn such that:

    • The lines create x number of horizontal and x number of vertical boxes, where x is the number entered by the user.

    • Each box should be 100 pixels by 100 pixels.

    • The grid is spaced inside the frame such that it is perfectly centered both horizontally and vertically, with a 10-pixel border between the edge of the frame and the grid.

    I cannot figure out how to make a border with the gridlayout. Please help!


    Java - jeam, Tuesday, July 13, 2010 at 4:06pm
    I cannot figure out how to make a border with the gridlayout. Please help!


    Java - jeam, Thursday, July 15, 2010 at 12:45am
    Write a GUI application that prompts the user for a number between 1 and 5. Be sure to include error checking so that the program continues to prompt the user for a number until the user's entry is between 1 and 5, inclusive.

    Once a valid number is entered, the program should display a grid of horizontal and vertical lines inside the frame.
    These lines should be drawn such that:

    • The lines create x number of horizontal and x number of vertical boxes, where x is the number entered by the user.

    • Each box should be 100 pixels by 100 pixels.

    • The grid is spaced inside the frame such that it is perfectly centered both horizontally and vertically, with a 10-pixel border between the edge of the frame and the grid

    Java - jeam, Thursday, July 15, 2010 at 12:36pm
    Each box should be 100 pixels by 100 pixels.

    • The grid is spaced inside the frame such that it is perfectly centered both horizontally and vertically, with a 10-pixel border between the edge of the frame and the grid

    1. 👍 0
    2. 👎 0

Respond to this Question

First Name

Your Response

Similar Questions

  1. java programming

    1. Time Calculator Write a program that asks the user to enter a number of seconds. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the

    asked by ignatius on April 28, 2016
  2. programming

    1. Write a structured algorithm that prompts the user to input two numbers. The algorithm should calculate and print the sum & product of the two numbers [21/2]

    asked by alethia benney on October 16, 2012
  3. programming

    3. Write a structured algorithm that prompts the user to input the name and the price of an item and the quantity purchased. It should print the name, price, quantity and amount due with appropriate labels.

    asked by alethia benney on October 16, 2012
  4. gtuc

    1. WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. 2. CALCULATE THE PRICE OF AN ITEM COSTING 100 GHANA CEDIS AFTER A DISCOUNT OF 10% IS APPLIED TO IT. 3. WRITE A PROGRAM TO CALCULATE THE

    asked by jojo on February 26, 2016
  5. Programming Logic and Design (help?)

    Design a retirement planning calculator for Skulling Fincancial Services. Allo a user to enter a number of working years remaining in the user's career and the annual amount of money the user can save. Assume that the user earns

    asked by Aubrey on March 1, 2018
  1. Information technology

    Write a structured algorithm that prompts the user to input the number of days in a month. Calculate and print the number of hours in the month appropriately labelled.

    asked by Amanda Sinclair on February 1, 2017
  2. intro to computer programming

    Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount. Your program should use a

    asked by Anonymous on October 26, 2015
  3. Computer Science

    Write a program that Will prompt a user to enter his/her name and number.use a while loop that will display the user name times the entered number

    asked by Tom on October 27, 2016
  4. writting a program

    Speed of Sound. Sound travels through air as a result of collisions between the molecules in the air. The temperature of the air affects the speed of the molecules, which in turn affects the speed of sound. The velocity of sound

    asked by sarah on February 23, 2012
  5. Programming and Design

    Draw the hierarchy chart and design the logic for a program that calculates the projected cost of an automobile trip. Assume that the user's car travels 20 miles per gallon of gas. Design a program that prompts the user for a

    asked by Matt on April 3, 2013
  6. programming logic and design

    I need help writing pseudocode for this problem: Design a retirement planning calculator for skulling financial services • Allow a user enter a number of working years remaining in the user career and the annual amount of money

    asked by Corey on July 21, 2014

You can view more similar questions or ask a new question.