• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Graphics2D please help JAVA GUI

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can someone please help me to add horizontal line(nose) (just search baymax at google) because can't find the right coordinate , please use only g2d.drawline
thanks !

feel free to edit my code if you want to make baymax's body, really really really do appreciate that . super thanks




 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Why do you have the three rotate(...) calls? Those do not seem to do anything and applying an affine transform to a Graphics object may distort the Graphics object in such a way that you can never quite undo it. Why do you not remove them?
For drawing a line, you need to work out the coordinates. Look at the documentation for Graphics#drawLine, and work out what the four arguments mean. By passing 0, 0 you are telling it to start at the very top left. By passing 100, 150, you are telling it to finish 100px to the right and 150px down. You want to have the same y for the start as the finish. You want somewhere down and right of the top left of the oval and a bit to the right. If your oval starts at 145, 145, the first two arguments should be more than 145. Then the 4th argument should be the same as the second. The third argument should be more than the first.
You will have to try different numbers until your line is in the place you want.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic