• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can knowledge of Java Swing be helpful in non-java things ?  RSS feed

 
Pamela Hendersen
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example, if you know C++, learning Java becomes a little bit easier. If you know java, learning dot net becomes very easy. So, your knowledge of
one thing can be useful in another. So, its not a complete waste of time.

In the same way, can the knowledge of Swing be useful elsewhere ?

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many GUI frameworks work with the same principles as Swing, for example in the way that events such as button clicks or other interactions with the GUI are handled: you have some object that represents a button, and you can set an event handler on it which is called when the button is clicked. So if you've seen how Swing works, that may help in understanding how other GUI frameworks in Java or even in other languages work. On the other hand, the same concepts might be implemented in a different way in other GUI frameworks, so you'll have to be aware of the differences too.
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems like a mixed bag, to me. The more you know about anything, the greater your knowledge-base with which to approach something new. But, broad experience can breed false expectations. Just because another library resembles Swing in some ways, doesn't mean it will resemble it in others and, if you unconsciously start to expect similarities that don't exist, your prior knowlege may lead you into frustrating conflicts between what you expect and what you have.

I've been doing some work at a very entry level with VB.NET. Like Swing, VB.NET doesn't want you to make calls to its GUI objects from foreign threads. Now, if you know why Swing objects ought not to be called from off the EDT, when you run into that aspect of VB.NET, you say, "Oh, sure, that makes sense." Further, you discover that, unlike Java, VB.NET is so intertwined with its GUI objects that it actually detects and prevents foreign threads from making these illegal calls. Tracking down the error messages, you find that something akin to "InvokeLater" is part of the solution. But (and this is where I have already hit my limit in VB.NET, for the moment), the prohibition is not against calls to GUI objects from off the "main" thread (the EDT, in the case of Swing), but against calls to GUI objects from outside the thread that created them. The implication, I believe, is that a worker thread can, in fact, create its own GUI objects and update them safely. I've never tried that in Swing (someone who has, please tell us if it's safe), but, right away, I see that practices I have developed while using Swing might not be fully applicable to VB.NET's GUI tools.

I guess my short answer would be: Yes, knowlege of Java Swing can be helpful in non-java things, but keep your eyes open and don't presume anything.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!