5 Replies - 654 Views - Last Post: 01 October 2009 - 06:23 PM Rate Topic: -----

#1 islam-morad  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 11-September 09

Bad times wih java coodinates

Post icon  Posted 01 October 2009 - 04:54 AM

Hi guys
i have troubles dealing with Java coordinates i know that x is the distance from the left top of the window and y is the distance from top to down but i dont know how to use them if i want some object to appear in the bottom of the page or if i want it to appear in the center of the window
i want a description of how to use these coordinates the right use
Is This A Good Question/Topic? 0
  • +

Replies To: Bad times wih java coodinates

#2 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: Bad times wih java coodinates

Posted 01 October 2009 - 04:58 AM

first you have to choose the appropriate layout manager, some layout managers will make some tasks easy. i usually like to set the layout to null and position the components by the y and x coordinates which isnt hard in this case, just takes a little time..anyway post the code that you're having trouble with and we'll have a look at it
Was This Post Helpful? 0
  • +
  • -

#3 islam-morad  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 11-September 09

Re: Bad times wih java coodinates

Posted 01 October 2009 - 05:04 AM

View Postmostyfriedman, on 1 Oct, 2009 - 03:58 AM, said:

first you have to choose the appropriate layout manager, some layout managers will make some tasks easy. i usually like to set the layout to null and position the components by the y and x coordinates which isnt hard in this case, just takes a little time..anyway post the code that you're having trouble with and we'll have a look at it


i didn't write the code yet because i have to know about the coordinates first

the assignment am doing is building a pyramid the base of that pyramid consists of 14 bricks and while u go up you subtract one for the 14 bricks so it will give u the pyramid the brick is 30 pixels width and 12 pixels height
Was This Post Helpful? 0
  • +
  • -

#4 greenDevil  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 14-September 09

Re: Bad times wih java coodinates

Posted 01 October 2009 - 05:40 AM

use getHeight() and getWidth() methods
Was This Post Helpful? 0
  • +
  • -

#5 AntonWebsters  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 88
  • View blog
  • Posts: 428
  • Joined: 15-August 09

Re: Bad times wih java coodinates

Posted 01 October 2009 - 06:54 AM

Use GridBagLayout. =) I'm pretty sure you can easily put objects on the center or corner of the frame using that layout.
Was This Post Helpful? 1

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8346
  • View blog
  • Posts: 31,910
  • Joined: 06-March 08

Re: Bad times wih java coodinates

Posted 01 October 2009 - 06:23 PM

View PostAntonWebsters, on 1 Oct, 2009 - 05:54 AM, said:

Use GridBagLayout. =) I'm pretty sure you can easily put objects on the center or corner of the frame using that layout.

If you really want to use predefined X,Y use a null layout and do all the stuff by hand
or a GridLayout that would consist of all possible bricks (even if you use 3 boxes for a brick) that can be easily manage with JLabel
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1