aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes GUI building Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GUI building" Watch "GUI building" New topic
Author

GUI building

m dawg
Greenhorn

Joined: Nov 05, 2001
Posts: 7
Hey,
I am creating a GUI, ok it is a JFrame that has a gamePanel that keeps all the object drawn on the screen like a drawing panel. Now i want to have a build mode and a run mode. when clicked on the build mode it draws a grid over the game panel and also it has buttons that you can click on to place the objects on the screen(square, circle...ect) in run mode the grid will go away and you can animate the ball. Im just looking for help and some code on how i would have this set up. if anyone can help i would really appreciate it. THANKS!!!
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
You already posted this once. How about showing what you have and we can give pointers.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Ok, I have a few questions and then I may be able to help you.
1. Why do you need a grid?
2. Why are you placing shapes on the grid?
3. What will the ball do when it is animated?

------------------
Happy Coding,
Gregg Bolinger


GenRocket - A Test Data Generation Platform
m dawg
Greenhorn

Joined: Nov 05, 2001
Posts: 7
Gregg,
I am doing it for fun. I want to learn java and how to make games. Thanks. I am trying to click on a button that is when i click on it and you can point and click on the grided screen and it paints that shape. How would i do that. Thanks
mdawg
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Again, why do you need a grid? And what does the ball have to do with anything. You aren't being very desriptive in your design goals.
If all you need is to place shapes on a screen, then I suggest using JLabels for you shapes. SWING does not support painting quite like AWT and you don't want to mix components. Just create a panel and add a mouselistener so when you click on the panel it adds a JLabel with an ImageIcon of your shape selected onto the panel.
I know this isn't very CODE descriptive. Let me see the code you have so far for this, and I will try and adjust it as necessary.
------------------
Happy Coding,
Gregg Bolinger
m dawg
Greenhorn

Joined: Nov 05, 2001
Posts: 7
I really don't have anything just trying to get started. There doesn't need to be a ball. I just want to be able to: Here is what i need, i need to have a frame, that has a few buttons on it like two, square and circle. There will be a grid on the board where there images will click into place. They can be 10 across and 10 down 0-9 and each grided box is 30x30. So, when the user clicks on the button that has an imageIcon on it it paints that same imageIcon onto the gird. If you can help me out and get me started i would really appreciate it. Thank you so much. So, when the user clicks on the screen it will do nothing untill he click the button with the shape he wants to place on the grid. It needs to be a point then just click on the grid and panel and it will place that imageIcon, a gif or something. Thanks to all and Gregg
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GUI building
 
Similar Threads
GUI building help please!!!!!!!
Questions regarding to using applets and JComponents
Java GUI - AWT (Window, Panel, Frame) When do you use what?
what layouts to use
Switching between panels in a GUI