Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java GUI programming tutorial  (Read 2931 times)
0 Members and 1 Guest are viewing this topic.
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Posted 2012-07-22 14:31:26 »

I am starting to write a tutorial on GUI programming in Java. It's going to start pretty simple and work into more complicated areas. All of them will be linked from http://markbernard.wordpress.com/2012/07/22/java-programming-tutorials/. The first part of the first tutorial is at http://markbernard.wordpress.com/2012/07/22/java-gui-made-easy-part-1/.

These are not directly related to making games but could help people that want to use Java GUI components around a game.

Please feel free to leave any comments over there or here on whether things are clear or not or if you just don't agree with the way I did something.

Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #1 - Posted 2012-07-22 14:57:25 »

I don't know what's behind those links, but I surely hope that it covers how to integrate functionality into a GUI.
Because that has been like a secret for years... It's the holy grail.  persecutioncomplex

Edit: I went through it quickly on my crappy phone. I see you're using swing. Are youmgoing to continue to use swing?
I like swing, don't get me wrong.. I just think that.. I'm about the only one. Maybe I don't know any better Tongue

Offline davedes
« Reply #2 - Posted 2012-07-22 16:13:52 »

Swing is terrible for games... Sad JavaFX would be better, although in reality neither are great since most games will require an OpenGL-based UI.

Quote
6. Is JavaFX replacing Swing as the new client UI library for Java SE?
Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and is included in the JRE. On one hand, Swing is widely used in existing Java desktop applications, but relies on an old architecture, which requires a certain level of expertise and specialization. On the other hand, JavaFX features a set of modern UI controls that can be skinned using standard CSS techniques. While we recommend developers to leverage JavaFX APIs as much as possible when building new applications, it is possible to use JavaFX within a Swing application, allowing developers to extend existing Swing applications.
http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #3 - Posted 2012-07-22 17:10:32 »

I don't know what's behind those links, but I surely hope that it covers how to integrate functionality into a GUI.
Because that has been like a secret for years... It's the holy grail.  persecutioncomplex
What kind of functionality are you haveing problems with? I can take note of it and make a tutorial after this one.
Edit: I went through it quickly on my crappy phone. I see you're using swing. Are youmgoing to continue to use swing?
I like swing, don't get me wrong.. I just think that.. I'm about the only one. Maybe I don't know any better Tongue
Your not the only one. Smiley I have tried some of the other GUI kits around and while the others may have better performance, none of them are as easy to use as Swing. I find a lot of people they have problems with Swing and it usually stems from LayoutManager problems. I also plan to write a tutorial on LayoutManagers too.

Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #4 - Posted 2012-07-22 17:13:11 »

Swing is terrible for games... Sad JavaFX would be better, although in reality neither are great since most games will require an OpenGL-based UI.
Yes, Swing is terrible for most games. Hoever even if you are writing a 3D game you could still surround your game screen with a Swing interface. Or if you are doing a game that does not require high performance you could also use Swing.

Thanks for the link on JavaFX replaceing Swing. I haven't had a chance to check out JavaFX yet. I will definitely check it out soon.

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #5 - Posted 2012-07-23 11:23:48 »

JavaFx is pretty nice actually.
It's quite helpful with not making a hideously tangled mess of things, where in Swing it's really easy to create such a mess and very laborious to keep things clean.

Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #6 - Posted 2012-07-23 22:43:44 »

JavaFx is pretty nice actually.
It's quite helpful with not making a hideously tangled mess of things, where in Swing it's really easy to create such a mess and very laborious to keep things clean.
Thanks erikd. Makes we want to check out JavaFX even more. Gives me an idea to finish the Swing one and then convert it to JavaFX and make a comparison.

Offline gimbal

JGO Knight


Medals: 25



« Reply #7 - Posted 2012-07-24 12:13:17 »

where in Swing it's really easy to create such a mess and very laborious to keep things clean.

To be fair - it takes lots of practice but eventually you'll learn to design your code such that it stays clean and readable by applying certain conventions. But I must admit - Swing doesn't make it easy in the slightest. I'll look forward to see how such things are dealt with in JavaFX 2 when I get around to it. So much other stuff to look into... Can you ever be up to speed in the world of Java development I wonder?

Side note: this blog is all about Swing programming and has some incredibly useful additions to existing components and completely new ones too, among other useful tools such as more flexible layout managers.

http://tips4java.wordpress.com/
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (14 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!