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
Bad times wih java coodinates
Page 1 of 15 Replies - 519 Views - Last Post: 01 October 2009 - 06:23 PM
Replies To: Bad times wih java coodinates
#2
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
#3
Re: Bad times wih java coodinates
Posted 01 October 2009 - 05:04 AM
mostyfriedman, 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
#4
Re: Bad times wih java coodinates
Posted 01 October 2009 - 05:40 AM
use getHeight() and getWidth() methods
#5
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.
#6
Re: Bad times wih java coodinates
Posted 01 October 2009 - 06:23 PM
AntonWebsters, 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
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|