• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Drawing a figure on Java

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guy I am learning to create shapes and such using Drawable frame on java. I am trying to draw a yellow diamond shaped sign that inside of it has a drawing of a traffic light.

Here's my code.



I keep getting an error on lines 22. int[] xCoordinates(25, 100, 100, 165);

Can anyone tell me what I am doing wrong? I've searched everywhere on my book and I don't understand what's causing the problem.
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not how you initialize an array, this is the correct way:

 
Ice Brazuca
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a test run I am only trying to draw the yellow triangle. Here is what I have.


I keep getting the error SignalAhead.java uses or overrides a deprecated API.
Recomplie with -Xlint:deprecation for details.

Can anyone tell me what I might be doing wrong?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As the message indicates, you are using some method call which is now deprecated.

Recomplie with -Xlint:deprecation for details.


If you do this, it will tell you which method.
 
Bartender
Posts: 1849
15
Eclipse IDE Spring VI Editor Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some class or method from the API you're using is old and the compiler is mad.

Recompile with the switch and it'll probably give you a clue which it is.
 
Ice Brazuca
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok guys here is currently my new code.



I have to ignore the -Xlint error, because I need to make this program using the AWT.

Anyways I need for a black line going throught the diamond and the line has to fill in 5 pixels. I can't seem to be able to do this. And the current line I have only fills in 1 pixel and it only works on the right side of the diamond.
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic