Post a New Question

Java

posted by on .

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

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question