Java GUI for project

amdskip

Lifer
Jan 6, 2001
22,530
13
81
Basically our group project is to develop a GUI for an exercise bike computer. We are to pretend it will be setup in a mall kiosk as a display. I was selected to program the display monitor. I have never done a GUI before but I do know that Java Swing might be something I would use.

Anyone have some suggestions on what I could use for this project?
 

Hersh

Senior member
Oct 14, 1999
331
0
0
There are three different types of GUI toolkits for Java that I worked with slightly before: AWT, Swing, and SWT. It's a matter of personal preference. I've had the most experience with Swing so if I had to do it, I'd use Swing but this is only because I've had the most experience with Swing.

Take a look at the following article if you need help deciding, it basically says SWT takes the advantages of both AWT and Swing without its disadvantages so it might be the best choice if you have not done any java gui toolkit work before:
http://www-128.ibm.com/developerworks/java/library/os-swingswt/index.html
 

clamum

Lifer
Feb 13, 2003
26,252
403
126
I'd suggest going the Swing route. That's what I've used in the past and it's fairly easy to do. The hardest thing is selecting the right layout managers and getting components to be where you want them.

Here's a link to Swing tutorials
 

lozina

Lifer
Sep 10, 2001
11,711
8
81
it would be easier to avoid layoutmanagers with a static display like in an excersize bike. Just set layoutmanager to null and use setBounds to position components exactly where you want without any fuss. You wont have to worry about resizing windows if your display is static
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
You can rellay mix and match AWT and Swing components if you want to. It should be pretty easy to make a GUI for a bike computer, it's just a couple numbers and one button you push to cycle between them.
 

statik213

Golden Member
Oct 31, 2004
1,654
0
0
Originally posted by: notfred
You can rellay mix and match AWT and Swing components if you want to. It should be pretty easy to make a GUI for a bike computer, it's just a couple numbers and one button you push to cycle between them.


Why would you need to mix and match? For practically every AWT component there's a Swing equivalent.... you'll use imports from AWT for events and layouts and such.
I suggest you use Swing 'cos it'll be easier to setup than SWT (unless you use eclipse or some IDE that has built int support for SWT).

Also, about the setbounds thing..... it's easier to get what you want using set bounds if you don't know how to use the layout managers, but taking the time to learn the layout managers will really pay off (esp GridBagLayout) and make your UI a bit more friendly as it will automatically adjust to resizes.

 

itachi

Senior member
Aug 17, 2004
390
0
0
Originally posted by: notfred
You can rellay mix and match AWT and Swing components if you want to. It should be pretty easy to make a GUI for a bike computer, it's just a couple numbers and one button you push to cycle between them.
technically, you could.. but that'll bring in a whole world of trouble if you don't know what you're doing.. you can't simply just add an awt component to a swing container and expect it to work properly.. you won't get any errors, but you'll find that the awt component is nowhere to be seen. swing still uses some components from the awt framework.. such as the layout and event handling.. but anything other than that will have undefined behavior.