2 Replies - 199 Views - Last Post: 04 October 2012 - 08:30 PM Rate Topic: -----

#1 Sir Papsby  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-October 12

Shifting Grid

Posted 04 October 2012 - 06:00 PM

Hey guys I have a 500x500 grid that I am using to act as a graphing calculator. I have got my points plotted and the line is right the only problem is that my line is starting from the top left corner of the graph and not the middle of the x and y axis? Any ideas of how I could shift it to the middle of the grid and flip it across the y axis?
Is This A Good Question/Topic? 0
  • +

Replies To: Shifting Grid

#2 pbl  Icon User is offline

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

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Shifting Grid

Posted 04 October 2012 - 08:14 PM

You are preaching in the desert
Are you in a GUI environment ?
Grid of which type of Object ?
points ? Graphic points ? Java awt.Point ?
letf top corner of the graph ... Graph ? What is a graph ? JPanel ? Canvas ? JFrame ? ...
x and y axis ? Which type of coordinates ?
...

We cannot guess your environment, that is why we ask to post code when possible
Was This Post Helpful? 0
  • +
  • -

#3 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 822
  • View blog
  • Posts: 2,529
  • Joined: 29-July 11

Re: Shifting Grid

Posted 04 October 2012 - 08:30 PM

pbl is correct in that we don't have much to go on.

If I assume you're drawing to a JPanel, I'd tell you but Java's Graphics matrix plots 0,0 as the top left, and you could change that with the AffineTransform class translate() method.

This post has been edited by farrell2k: 04 October 2012 - 08:30 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1