   [java] Game Tools in Java
  Hello!  I am a hobbist Java programmer.  My current goal is to develop a tile editor for a 2D action game I will be making later this year.  This is my current plan:1. Create a full screen JFrame (nothing fancy, just a frame maxmized in both directions).2. Divide the content pane into a grid that is 64x643. Use the right mouse-click to bring up a JColorChooser dialog box4. Use the left mouse click to fill in the square5. Enable F4 to bring up a JFileChooser and save the imageI am currently familiar with most Swing components and the fundamentals of Java.  My big concern is how to draw to the content pane in the way that I desire and then to be able to save the image in a proper format.Any advice would be apperciated. =)   
Quote:Original post by guyver23Hello!  I am a hobbist Java programmer.  My current goal is to develop a tile editor for a 2D action game I will be making later this year.  This is my current plan:1. Create a full screen JFrame (nothing fancy, just a frame maxmized in both directions).2. Divide the content pane into a grid that is 64x643. Use the right mouse-click to bring up a JColorChooser dialog box4. Use the left mouse click to fill in the square5. Enable F4 to bring up a JFileChooser and save the imageI am currently familiar with most Swing components and the fundamentals of Java.  My big concern is how to draw to the content pane in the way that I desire and then to be able to save the image in a proper format.Any advice would be apperciated. =)First thing I'd point out is: why build a tile editor when you can use any gfx pgm (ms paint on up) to create gfx?Otherwise, it's generally not a good idea to draw directly on a frame.  If you check the sun java tutorials there's one there somewhere about creating custom components.  For this type of thing (tile map editor) in the past I've extended a JPanel to hold a big-ass image of the tile map then used mouselisteners and mousemotionlisteners to give the ability to update the tile map data and redraw it etc... Then use a JScrollPane to hold the mapeditor/jpanel.  Add the JScrollPane to the Frame, plus a panel for the tool buttons (cut copy paste new open close etc...)I was going to write up a tutorial about it but never got around to it, unfortunately....;  I'll move this over to the Java forum where you're more likely to get the specific answers you need.   ;  Thanks guys...  I believe I see what you are saying, and it sounds quite sensible.  I am a tad confused on one point, though:  What classes do you use to freely draw on the JPanel that you place in the frame?  I know that you can use a Graphics object in an applet, but with that work here too?  Thanks! :)   ;  Yes, you can draw on the graphics by overiding the draw component method in a JPanel.  You should really be studying the swing tutorial.  Trust me, it has all the answers you need.  And now that I think about it, I think I just added my BufferedImage to the scroll pane and overroad the JScrollpane to update the tilemap model.This all falls into using the MVC (model view controller) pattern as well, but I don't know much about that....   ;  Thanks. :)   