From: Logan Barnett Date: 2008-09-11T02:07:34+09:00 Subject: Re: Is Ruby good at GUI develop? --Apple-Mail-124-93985466 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable On Sep 10, 2008, at 7:02 AM, Jason Cameron wrote: > Wow. Quite the storm! Oh well. > > I guess I should clarify a bit. > > I _am_ using monkeybars (and therefore NetBeans) to create my GUI. =20= > It's > pretty good. My second choice would be Glade(Is there a way for =20 > Glade 3 > to be used?). It's still a little hit or miss though in NetBeans. I > put some controls down and the rest _move_ ... even after I put a =20 > panel > in. Of course it could be that I'm an idiot and I don't know how to > make a GUI with it. :p The more I use it the more I'll get used to > those quirks. > By default in Netbeans, all panels, frames, dialogs, and other =20 containers are set to "Free Design", which is the GroupLayout. =20 GroupLayout is very quirky, and takes some time to learn. For forms of =20= any complexity, you may want to use a different layout (right click on =20= the container in question, and you can set the new layout). If you're =20= looking for something akin to Visual Studio's absolute layout, you can =20= set the layout to null (Null Layout). This isn't cross-platform =20 friendly, and the form won't move/stretch when the user goes to resize =20= it, but at least it'll get you going. You can also isolate some =20 components by putting them in another panel, and different panels, =20 even if nested, can have their own layout. Netbeans also has a handy =20 feature where you can select one or more components, and right click, =20= and select "Enclose In..." and select a JPanel. GroupLayout does some really cool things, but sometimes it's like =20 working with a mule. It's very tricky. > I also don't care if the GUI itself is written in Ruby. The GUI =20 > could > be written in LOGO for all I care. I just want to write an app, =20 > click a > button and have some Ruby code execute behind it. > > Q: If I write a swing GUI in NetBeans can I then copy that somehow =20 > to a > ruby project(using Monkeybars somehow)? Or do I have to start from > scratch every time. I=92m also not entirely sure how to create a =20 > project > with _two_ or more forms. > We've got a whole more than two forms going in some of our projects: http://www.happycamperstudios.com/monkeybars/charlotte%20interface.png I'm not exactly sure what's going on here, but I'd gather that you =20 created a Ruby project. Unfortunately, Netbeans doesn't support a true =20= JRuby project, where you can freely dance between JRuby and Java. The =20= next best thing is to make your project a Java project. Here you can =20 have Ruby files but also Java files and forms. You'll need a =20 Main.java, which kicks off JRuby, as well as the JRuby complete jar. =20 We've got a tutorial on setting a lot of this stuff up in our =20 tutorials section: http://monkeybars.rubyforge.org/tutorials.html > My GUI first app is either going to be a pared down media library/grep > tool for people who like to download (open source of course!) shows =20= > and > ask themselves, =93Do I download that show? Or do I have it already?=94 = =20 > I'm > using JRuby, Monkeybars, NetBeans and Postgres. I'm not too sure =20 > about > Activerecord yet and I find SQL rather trivial so I'm accessing the db > directly. > We have a couple of internal Monkeybars project that need their own =20 local database. We used Derby + ActiveRecord for this. While I didn't =20= work a ton on these projects myself, I know we'd be more than happy to =20= share what we did to get it working. Derby is SQLite in Java, so it's =20= just a file that you can load as your database, and there's no need =20 for anyone to set up a full on database server on their machine. > My first Ruby script (which made me fall in love with Ruby) transcoded > all of the avi files in a directory to 320x200 in _1_ line of code. > > I'm just trying to have fun. :p > M > =3D:) > --=20 > Posted via http://www.ruby-forum.com/. > --Apple-Mail-124-93985466--