Java

posted by .

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 -

    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 -

    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 -

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

  • 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

  • Java -

    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 -

    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

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. java

    Write a java application that finds the smallest of several integers. Prompt the user for the number of integers that will be input, then prompt the user for that number of integers. Evaluate the integers to determine the smallest …
  2. Programming in c++

    Write a program in c++ that inputs a number [1-12] from the user and displays the month. it also asks the user whether he wants to input another number or not, if the user inputs 1 then it again inputs number, if user inputs 0 then …
  3. programming

    Pseudocode - Create the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number and to a method that cubes the number. …
  4. programming

    Create the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number and to a method that cubes the number. The program …
  5. programming pseudocode

    Create the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number and to a method that cubes the number. The program …
  6. java.please help

    Write a Java program that prompts the user for a string. If the string entered by the user does not start with Hello and does not end with a digit, print incorrect and re-prompt the user. Otherwise, print Thank you.
  7. Multimedia

    Not sure if you will get this right away.. but here is the question... Prompt the user for their name and then prompt the user for a number between 1 and 12. After getting the input, you will display the user’s name and then display …
  8. java programming

    the learner is asked to write a program using java with user input that caculate and displays, the number of months it will take the user to save an amount of money. the user must enter the
  9. Computer Science/Pseudo Code Python

    Hi, I'm confused about an assignment. I'm not sure what to do and would like some help. An example: Write a program that obtains two integer numbers from the user. It will print out the sum of those numbers. Pseudo code: Prompt user …
  10. Ic

    Write an application that prompts the user for two integers and then prompts the user to enter an option as follows: 1 to add the two integers, 2 to subtract the second integer from the first, 3 to multiply the integers, and 4 to divide …

More Similar Questions