Results 1 to 1 of 1
- 03-22-2010, 12:22 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 1
- Rep Power
- 0
Create Map, Problem with showing places
I have some probling displaying my map.
When running station.getStops() I get an array with x-coordinates in stops[][1] and y-coordinates in [][2].
I want to learn how to do this with awt.Graphic and fillRect, but now i just want this to work so that I can see if I got the Class Station (gets coordinates from Internet and formats these for my program) and if my vision of the program right.
If you have any thoughts about this strange program :), just ask...
Java Code:import javax.swing.*; import java.awt.*; import java.util.*; import java.text.*; public class Map extends JPanel { private int[][] stops; private JLabel[] pixel; public Map() { setLayout(new GridLayout(2000, 2000)); setBackground(Color.YELLOW); setSize(1550,850); setVisible(true); pixel = new JLabel[4000]; Station stations = new Station(); stations.downloadStops(); stops = stations.getStops(); int[] outData = new int[40000]; int cordX1, cordY1; int cordX2, cordY2; for(int k=0;k<stops.length;k++) { cordX1 = stops[k][1]; cordY1 = stops[k][2]; cordX2 = (cordX1-6300000)/10000; cordY2 = (cordY1-1100000)/10000; outData[cordX2 * 1000 + cordY2] = 1; }//for for (int i=0; i<4000; i++) { add(pixel[i] = new JLabel()); if(outData[i] == 1) { setBackground(Color.RED); setVisible(true); setOpaque(true); }//if }//for }//konstruktor }//Map
Similar Threads
-
round to two decimal places
By javaMike in forum New To JavaReplies: 3Last Post: 12-24-2011, 02:01 AM -
[SOLVED] Decimal Places - Is this possible?
By dbashby in forum New To JavaReplies: 4Last Post: 04-08-2009, 07:49 PM -
Weird problem: Terms and Conditions keep showing up, can't use Java at all
By Czar of Fishies in forum New To JavaReplies: 9Last Post: 09-30-2008, 07:30 AM -
numbers with two decimal places
By little_polarbear in forum New To JavaReplies: 8Last Post: 08-27-2008, 11:04 PM -
Capping decimal places
By Rageagainst20 in forum New To JavaReplies: 1Last Post: 12-20-2007, 09:28 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks