Using JComboBox

  8 posts   Feedicon  
Replies: 7 - Last Post: November 06, 2009 16:34
by: antoniolucas
showing 1 - 8 of 8
 
Posted: October 11, 2009 13:41 by antoniolucas
Hi,

I am trying to use a JComboBox, but a I got stucked.

The way I tried:

create a list in the model, and tried to map to a property in the view(like I saw in the Hello World Tutorial).

Here is my code:




class GreeterModel
attr_accessor :message , :combo

def initialize
@message = 'Swing is ok ...'
@combo = [1,2,3,4,5,6,7,8,9]
end
end


class GreeterView < ApplicationView
set_java_class 'greeter.Greeter'

map :model => :message , :view => 'message.text'
map :model => :combo , :view => 'combo.dataModel'
# above here I tried model, data_model, and other property of the comboBox
end



Well, later I tried to do like in RssViewer Example(by the way, this example is not working now), to use a JList, but it does not work too.
 
Posted: October 12, 2009 16:26 by Logan Barnett

Create some :using directives in your mapping for the data model. You'll need to coerce the array of values into something the combo box expects for the dataModel property. :using is described here: http://monkeybars.rubyforge.org/api/classes/Monkeybars/View.html#M000091

 
Posted: October 12, 2009 17:52 by ac251404
I happened to be working on this today also. Just got it working... I think, haha. Took me a bit to see how to use ":using", had to look at the RSS and Flickr examples to put it together. Here is what I came up with: http://pastie.org/651777

I think that's right and it seems to work fine. Hope it helps.
 
Posted: October 14, 2009 01:58 by antoniolucas
hi,

thanks to both, it works very good Smile
 
Posted: October 14, 2009 15:55 by Logan Barnett

Do either of you mind posting a recipe to our wiki for others? Thanks in advance!

 
Posted: October 24, 2009 21:48 by antoniolucas
sorry, my english really sucks, so I do not understand what you said Smile.

Do you want to any of us put the content of this discussion on the wiki?

I can put if you want, just tell me where and how to do that Smile

 
Posted: November 06, 2009 00:59 by Logan Barnett

Thanks!

The wiki link is one of the small links on the left panel: http://kenai.com/projects/monkeybars/pages/Home

 
Posted: November 06, 2009 16:34 by antoniolucas
I put in the wiki, do not know if is clear enough, but I did it

I put it in :
[link] http://kenai.com/projects/monkeybars/pages/SamplesAndSnippets [/link]

I hope it helps more people Smile
showing 1 - 8 of 8
Replies: 7 - Last Post: November 06, 2009 16:34
by: antoniolucas
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close