This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

creating a program  RSS feed

 
Geoff Vurel
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to create a program that includes several of the topics I have learned so far in my class. My program has to include:
Perform at least one meaningful calculation based on values entered by the user.
Use at least two different layout managers.
Provide an attractive blend of colors and fonts.
Use several (three or more) different types of Swing components.
Have inner class listeners for events fired by input components.
Use the Graphics class to draw on one or more components or containers.

I know how to do each of these individually. My question is how do I combine them into one program? Can I take what I have for each one and then list them one after another? Or do I need to somehow combine them together?
 
Campbell Ritchie
Marshal
Posts: 55681
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds like your previous query, which I moved. Make sure not to ask the same question twice.

I would suggest you start adding listeners to buttons. I don't like the addActionListener(this) form of Listener; I have fulminated about it in the past. For example here. Look at the old links I posted from that thread, too. There is an example of a Listener which changes the colour of something.

Create a frame, with some buttons on.
Add a panel and set its colour.
Add colour listeners to the buttons, so as to change the colour of the panel.
Do it in tiny little stages; it's much easier like that.
Find the Java Tutorials, which have hundreds of pages about Swing GUIs. Remember to look in the API at the details of the Listeners, if only so you can tell which package to import them from.

And you are off to Swing again!

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!