I'd like someone to help me create a simple GUI program and then add logic to it.
Basically, I was thinking of a simple program that displays a circular shape with the colors representing traffic signal lights. They change when a user clicks on the JButton named "Change Signal". So, if you click on the button, the circular shape will change colors to 1:red, 2:yellow, or 3: green.
Things I'll need:
A JFrame to hold everything
A Jbutton - Once clicked on, the shape changes colors
A listener that listens for the buttons being pressed
A JPanel
3 Shapes aligned vertically on top of each other - The light activated will have a brighter color than the rest
A layout - WimDC says use GridLayout.
Light Class for creating a Light component. Extending JComponent and overriding the paint(Graphics g) method.
That's all I know. This is a basic list of things I have identified to get started. I know I've probably missed a lot of things, so before I begin, I want you guys to help me complete the list of things I'll need. Then, once we get everything down, we can start the actual coding.
Edited by An Alien, 02 November 2011 - 05:56 AM.


Sign In
Create Account


Back to top









