• Post Reply Bookmark Topic Watch Topic
  • New Topic

Drawing a figure on Java  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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: 1812
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!