• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Learning Java Swing

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I am new in this forum. I am learning java since 5 months. I want to develop some GUI projects. So I decided to learn java swing. But it seemed me complex.

What is the best way to learn this type of libraries. To improve myself I want to learn to read documentations.

To learn this are you using this type of documentation : https://docs.oracle.com/javase/8/docs/api/index.html?javax/swing/package-summary.html
or https://docs.oracle.com/javase/tutorial/uiswing/index.html this type of tutorial?

I am asking this because not all of libraries have tutorials. Which way is the best for improving document reading skills and also coding skills. Sorry if my english is bad
 
Ranch Hand
Posts: 180
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I hope you doing well, I recommend learning Java FX, however, it is widely used nowadays, and it could fulfill your needs.
Here is a book named Mastering JavaFX ® 8 Controls by Hendrik Ebbers, it gives concise insight into JavaFX and explains it in-depth


 
Saloon Keeper
Posts: 27819
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fix your display name and you'll get more answers.

And I'm not one who foams at the mouth about "cultural appropriation", but really, the odds of anyone actually being Iroquois and not knowing English are very small.
 
Houssam El
Ranch Hand
Posts: 180
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Houssam El wrote:Hello,
I hope you doing well, I recommend learning Java FX, although, it is widely used nowadays, and it could fulfill your needs.
Here is a book named Mastering JavaFX ® 8 Controls by Hendrik Ebbers, it gives concise insight into JavaFX and explains it in-depth


 
Tim Holloway
Saloon Keeper
Posts: 27819
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.

The Oracle/Sun Swing tutorials are pretty decent and there are a few good books on Swing, although some of them are pretty old. Swing isn't quite dead but it's not exactly hot technology. The again, desktop Java is almost extinct regardless of whether you use AWT, Swing, SWT, or JavaFX. More and more GUI apps are web-based, since the web doesn't have installation and update issues and in an enterprise setting it's easier to back up data from a webapp.

I'll skip over another GUI platform (Android), since we've enough to talk about already.

On the other hand, I don't think desktop GUI apps are likely to completely disappear. Eclipse is written using the SWT GUI framework. IntelliJ's IDE is written in Java. I've got some favorite tools for video editing, Gantt charting, UML, mindmapping, and more all written using one of the Java desktop GUI frameworks.

The #1 thing to be a master of regardless of what GUI framework you use (and that includes many of the web-based GUI frameworks) is the Model/View/Controller paradigm. Under MVC, all of the major components are either Models (holding data), Views (the actual graphical interface) or Controllers (transfers data values back and forth between Model and View). Views are typically made up of a hierarchy (a Directed Acyclic Graph) of GUI components - for example, a Window anchoring Menus and content controls, with each non-static sub-component linking via a corresponding sub-controller to a View.

Many actions on the GUI fire Events, so you'll also have Event Listeners that dispatch actions. Often the same action can be initiated via multiple means (for example, menu selection, hotkey, function key. mouse click and so forth). So Swing allows those GUI components to register for that action.

I think that those are the core concepts you need to understand. While there are many types of GUI controls and so forth, they all operate according to the same overall architecture, so learning new ones is usually pretty simple.
 
Marshal
Posts: 28244
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Refik Neaber wrote:To learn this are you using this type of documentation : https://docs.oracle.com/javase/8/docs/api/index.html?javax/swing/package-summary.html
or https://docs.oracle.com/javase/tutorial/uiswing/index.html this type of tutorial?

I am asking this because not all of libraries have tutorials. Which way is the best for improving document reading skills and also coding skills. Sorry if my english is bad



Trying to learn a Java topic by reading its API documentation (your first link there) is like trying to learn English by reading a dictionary. Definitely not the best strategy.

The Oracle tutorials for Swing (your second link) is a much better way to learn Swing. You'll notice that there is a large number of tutorials which that index page points to, which is because Swing has a large number of features. And (in my opinion) the Oracle Swing tutorials are rather old-fashioned, not having been updated since Java 8 (2014). However Swing itself is rather old-fashioned and it hasn't changed since them. Other Java tutorial sites will have newer examples but they are less comprehensive.

My advice is to download the code examples from the Oracle tutorials and mess around with them. First get them running unchanged and then do something like this: Focus on one behaviour and propose to yourself a small change to it. Then try to change the code to implement that small change. Repeat until you are confident that you understand the features covered by that code example.
 
Tim Holloway
Saloon Keeper
Posts: 27819
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Trying to learn a Java topic by reading its API documentation (your first link there) is like trying to learn English by reading a dictionary. Definitely not the best strategy.



Ironically, that is exactly how I tried to learn Swing originally. It was a complete disaster. I ended up getting a big fat O'Reilly book on Swing and discovering the Sun Swing tutorials. Hopefully the book has been updated, since I just checked and it's for Java version 1.2!
 
Houssam El
Ranch Hand
Posts: 180
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

Paul Clapham wrote:Trying to learn a Java topic by reading its API documentation (your first link there) is like trying to learn English by reading a dictionary. Definitely not the best strategy.



Ironically, that is exactly how I tried to learn Swing originally. It was a complete disaster. I ended up getting a big fat O'Reilly book on Swing and discovering the Sun Swing tutorials. Hopefully the book has been updated, since I just checked and it's for Java version 1.2!



I think that Swing is outdated
 
Saloon Keeper
Posts: 10750
86
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Houssam El wrote:I think that Swing is outdated

FX was supposed to be the new improved GUI for Java but it's development efforts were side-lined before the goal was fully realized. Swing is still considered the mature go-to for GUI.

(I have heard this corroborated by many trusted resources over many years.)
 
Marshal
Posts: 79272
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:. . . the Oracle Swing tutorials are rather old-fashioned . . .

If only they would bring the Java™ Tutorials into the 2020s, all of them.
 
Bartender
Posts: 1737
63
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

Paul Clapham wrote:. . . the Oracle Swing tutorials are rather old-fashioned . . .

If only they would bring the Java™ Tutorials into the 2020s, all of them.



Or would open source them like the .Net documentations, which if you needed to, you can legally fork and maintain on your own...or just issue pull requests with the changes you'd like to see that they acknowledged 18 years ago and never got around to fixing...
 
Tim Holloway
Saloon Keeper
Posts: 27819
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesse Silverman wrote:

Campbell Ritchie wrote:

Paul Clapham wrote:. . . the Oracle Swing tutorials are rather old-fashioned . . .

If only they would bring the Java™ Tutorials into the 2020s, all of them.



Or would open source them like the .Net documentations, which if you needed to, you can legally fork and maintain on your own...or just issue pull requests with the changes you'd like to see that they acknowledged 18 years ago and never got around to fixing...



That's a little sticky. The tutorials were proprietary Sun documents, since purchased by Oracle. Swing itself is part of the core JVM, and so the Swing source is available in existing open-source spin-offs such as OpenJDK, which does run the Autodoc process on it, but as we've said, the API docs are a horrible way to learn Swing.

Thus your best best is to see if there's a recent book or look for someone's blog.
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:I ended up getting a big fat O'Reilly book on Swing and discovering the Sun Swing tutorials. Hopefully the book has been updated, since I just checked and it's for Java version 1.2!



I'm waking a zombie to mention that the big fat O'Reilly "Java Swing" book was updated in 2002 for JDK 1.4. Even though that was 20 years ago, it's not terribly out of date. Obviously it doesn't use lambdas for event listeners and such, since the book predates Java lambdas.

The older edition that you have is more severely out of date. Neither edition was intended as a tutorial, though they do develop some examples one could learn from.

disclaimer: I'm one of the authors of the 2002 edition.
 
Paul Clapham
Marshal
Posts: 28244
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brian Cole wrote:disclaimer: I'm one of the authors of the 2002 edition.



I remember that book! It's probably still around here somewhere.
 
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic