Reputation: 6126
I'm trying to create a windows desktop application in jruby but I have no idea what I'm doing. So far I've installed jruby 1.7.3 and JetBrains RubyMine. I created a new project and then a new file called window.rb
but I have no sense of how to structure this program or how to go about this the right way.
Can someone point me to the right jruby tutorial for desktop graphics application development? I've tried this but it fails to talk about the programming design structure and just jumps into the code.
Upvotes: 1
Views: 189
Reputation: 11638
The Swing UI library is pretty complicated to dive into off the bat since you need to understand the Java event model and layouts etc.
I suggest the first thing you do is read through some of the early links here:
http://docs.oracle.com/javase/tutorial/uiswing/
Another potential set of documentation is this
http://www.javabeginner.com/java-swing/java-swing-tutorial
Ultimately, googling for 'Java Swing Tutorial' should return lots of information.
Then, you need to layer JRuby on top of that, which will be additional complexity.
With regards to structure, typically Swing applications encourage you to follow a MVC structure. The UI object is really an amalgamation of the view and controller since the view (a table or panel) is encapsulated in the controller logic (event handlers in the buttons, scrollbars etc).
Were I to approach this I'd definitely separate the representation of your data into a model class ( you could event use an ActiveRecord object to do this ) and a UI class, based on JDialog or JFrame.
So folders would be:
/myapp
/myapp/ui
/myapp/model
/myapp/util
etc. /ui would hold UI-related components, /model would contain models, /util would contain anything shared or not strictly related to either UI or models.
Upvotes: 3