I am about to start a project for fun and learning purposes in JAVA and ultimately when it is done I want to have a GUI. In all of my JAVA courses and the books I have read and followed along with you always start by writing programs that just input and output at the command line. Then as it progresses a GUI is created. Is this usually how a project is created or is the GUI created right away with all the functioning code that does the calculations?
I know I should just probably start coding but I seem to always be worried about doing things in the right order. When doing projects from books and tutorials it always seem like you write code that is not used once the GUI is created. I guess I am just wondering how things are done in the "real world" when not following along in a book.
When to create a GUI?
Page 1 of 18 Replies - 433 Views - Last Post: 30 April 2010 - 05:57 AM
Replies To: When to create a GUI?
#2
Re: When to create a GUI?
Posted 29 April 2010 - 01:44 PM
Start learning how to write a GUI if you are comfortable with the code that will function behind the GUI. Sometimes in the "real world" you have to learn as you go, which can be stressful/frustrating. If you are learning for fun, structure the project so you can build on your successes.
This post has been edited by molocules: 29 April 2010 - 01:45 PM
#3
Re: When to create a GUI?
Posted 29 April 2010 - 07:00 PM
If you want to use a JOptionPane, it is a very simple GUI window that is usually taught with console input using Scanner. However, if you want to work with more complex Swing GUIs, then you will need a very strong foundation in the Object-Oriented paradigm. You should have a solid understanding of concepts like class design, inheritance, polymorphism, abstraction, interfaces, and encapsulation, as you cannot write Swing GUIs of significant complexity and functionality without understanding these concepts, which are used constantly when designing your GUIs. For example, when I design GUIs, I subclass JFrame for my container and implement ActionListener for controlling JButton actions. If I am using CardLayout, I will subclass JPanel multiple times for different internal displays on the JFrame. All of these are related via classes and Objects.
If you have just started Java, GUIs beyond JOptionPane are probably not in your near future. However, after you finish with OOP, they shouldn't be too far off.
Good luck with your pursuits in programming! It sounds like you are off to a good start.
If you have just started Java, GUIs beyond JOptionPane are probably not in your near future. However, after you finish with OOP, they shouldn't be too far off.
Good luck with your pursuits in programming! It sounds like you are off to a good start.
#4
Re: When to create a GUI?
Posted 29 April 2010 - 07:57 PM
macosxnerd101, on 29 April 2010 - 06:00 PM, said:
If you want to use a JOptionPane, it is a very simple GUI window that is usually taught with console input using Scanner. However, if you want to work with more complex Swing GUIs, then you will need a very strong foundation in the Object-Oriented paradigm. You should have a solid understanding of concepts like class design, inheritance, polymorphism, abstraction, interfaces, and encapsulation, as you cannot write Swing GUIs of significant complexity and functionality without understanding these concepts, which are used constantly when designing your GUIs. For example, when I design GUIs, I subclass JFrame for my container and implement ActionListener for controlling JButton actions. If I am using CardLayout, I will subclass JPanel multiple times for different internal displays on the JFrame. All of these are related via classes and Objects.
If you have just started Java, GUIs beyond JOptionPane are probably not in your near future. However, after you finish with OOP, they shouldn't be too far off.
Good luck with your pursuits in programming! It sounds like you are off to a good start.
If you have just started Java, GUIs beyond JOptionPane are probably not in your near future. However, after you finish with OOP, they shouldn't be too far off.
Good luck with your pursuits in programming! It sounds like you are off to a good start.
Thanks, I have designed a few programs using swing and they turned out nicely but in all of those programs I started out with just the command line input and output and then having modify everything for the labels, buttons, actionlisteners, etc. Most of the concepts are finally starting to click and I am really stating to understand more with OOP. I am going to go ahead and make some flowcharts for my logic and write some psuedocode and get this project started using the command line for input and output and first and then do the GUI. This is my first real project that I am making that I will actually be able to use for something in the real world and not just to learn a concept of OOP. I will probably be asking more questions here soon and sharing code. Thanks again.
#5
Re: When to create a GUI?
Posted 29 April 2010 - 08:08 PM
The Event-Driven model used for GUIs is very different from a procedural model you are used to working with. The Event-Driven model relies on user input/interaction with the GUI and its components, with Event Listeners "listening" for these actions, and responding appropriately. So for example, if you have a demographics form for user to fill out, you don't need to prompt the user to fill out the information with Command Line. Instead, the user should understand what he or she needs to fill out. Then, when they hit submit, your program could (and possibly should) validate the information to make sure the user has filled out all the fields and entered valid data. If they have, then process the information accordingly. Otherwise, do not allow them to continue.
#6
Re: When to create a GUI?
Posted 29 April 2010 - 08:27 PM
Yeah, so see if I got this right, please? The program I am writing is going to be a bracket manager for a bowling league. So the user will have to enter the name of the person for the bracket, how many brackets they are in, there average, and what lane they are on. This will all be in one window and they will fill in the fields hit a submit button and then that information will be entered into variables and saved in an array. (I don't if an array is the best way to this, there will be multiple bowlers of course, but I will figure that out when I start doing this). So, I should start out writing this Input class as a GUI?
#7
Re: When to create a GUI?
Posted 29 April 2010 - 09:07 PM
Learning to program GUIs well is a project in of itself. I would say if you are just enjoying learning to program and doing your own projects stick with console programs until you are really comfortable with the language, then when you feel you are ready to learn to make GUIs it isn't a very large step to take.
#8
Re: When to create a GUI?
Posted 30 April 2010 - 03:26 AM
Apokio, on 29 April 2010 - 10:27 PM, said:
Yeah, so see if I got this right, please? The program I am writing is going to be a bracket manager for a bowling league. So the user will have to enter the name of the person for the bracket, how many brackets they are in, there average, and what lane they are on. This will all be in one window and they will fill in the fields hit a submit button and then that information will be entered into variables and saved in an array. (I don't if an array is the best way to this, there will be multiple bowlers of course, but I will figure that out when I start doing this). So, I should start out writing this Input class as a GUI?
I think what would be better is to have a List of Bowler objects and everytime that there is a valid submission, you use the submitted information and add a new Bowler to the ArrayList. However, you will need to pass all the info from the text fields to the Objects through the constructor. That's typically the better way to do this rather than just loading an array with information.
#9
Re: When to create a GUI?
Posted 30 April 2010 - 05:57 AM
Ok, I get what you are saying I am going to get started on this soon and I will share my progress. Thanks.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote








|