Results 1 to 5 of 5
  1. #1
    deadman_uk is offline Member
    Join Date
    Nov 2007
    Posts
    3
    Rep Power
    0

    Question Object locations via grid coordinates HELP.

    Hi all, I am new here and I use BlueJ as my complier. I am completely new to java and I have ran into a problem. I need to make a program but I am stuck at the very first step (the interface).

    I have made my interface with JframeBuilder and it has 10 objects. I have told the program ROUGHLY where I want the objects to go via grid coordinates. All is fine until I try and set the form background to a jpg image. The program ignores the grid coordinates and sets all objects to the top of the form.

    I can get around this by using the north, east, south, west, center method but that doesn't give me the flexibility I want. I would like to set the object location via grid coordinates like JframeBuilder has done.

    My Program

    The link to my program is above. I would really appreciate it if someone could take a quick look and tell me why the program ignores the grid coordinates I have made when I set the form background to a jpg.

    Thanks all

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Set the layout manager of the JPanel to null for absolute positioning:
    Java Code:
    panel = new JPanel(null)

  3. #3
    deadman_uk is offline Member
    Join Date
    Nov 2007
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by hardwired View Post
    Set the layout manager of the JPanel to null for absolute positioning:
    Java Code:
    panel = new JPanel(null)
    Wow it works!!! thanks so much. If I run into any problems in the future, can I rely on you hardwired?

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    I'll do what I can.

  5. #5
    deadman_uk is offline Member
    Join Date
    Nov 2007
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by hardwired View Post
    I'll do what I can.
    Thanks I can handle the interface from here, the next step is the code but if I run into any problems, I will post back here.

    Thanks :)

Similar Threads

  1. Replies: 0
    Last Post: 01-22-2008, 11:05 AM
  2. Java3D: Clicking and getting coordinates?
    By seabhcan in forum Advanced Java
    Replies: 0
    Last Post: 01-11-2008, 02:46 PM
  3. Arc2D.Double coordinates
    By alley in forum Java 2D
    Replies: 2
    Last Post: 11-07-2007, 10:27 PM
  4. Help creating a changing grid
    By adlb1300 in forum New To Java
    Replies: 11
    Last Post: 10-24-2007, 01:41 PM
  5. Help with Grid Layout
    By coco in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 08:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •