We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpProcessing Implementations › RP5: embeded app does not draw properly
Page Index Toggle Pages: 1
RP5: embeded app does not draw properly (Read 7407 times)
RP5: embeded app does not draw properly
Mar 24th, 2010, 2:59pm
 
Heyhey rubysiastics  Cheesy

I'm stuck with this glee:
Code:
require 'jruby'
require 'my-fancy-swing.jar'
require 'ruby-processing'
import 'my-fancy-swing.My_Frame'

class EmbedTest < Processing::PApplet
  def draw
   background 261,211,211
   rect mouseX,mouseY,10,11
   redraw
 end
 def mouse_pressed
   redraw #nope,never got this far
 end
end
et = EmbedTest.new
win = My_Frame.new
win.set_visible(true)
win.jInternalFrame1.add(et)
et.init


This doesn't behave like expected:
My rectangle isn't updated in the frame.
But another window pops up with the same sketch (which maybe could be turned off?).
Analysing the issue confused me a little because it is indeed calling the draw method, but my rectangle isn't visibly moving..

Maybe somebody could give me a hint how to solve that?Jashkenas  Grin?

Thx in advance for your effort.
br pla
Re: RP5: embeded app does not draw properly
Reply #1 - Mar 24th, 2010, 10:34pm
 
I'm not sure what you are trying to do here, but you don't need to require 'jruby' or 'ruby-processing' when running applets "rp5 run applet.rb". Nor do you need to explicitly, init your applet. So when you call rp5 run embed_test.rb you've got the applet running, and now it appears you are trying to embed that applet in a window created by the running applet wierd!!!! Cheesy
Re: RP5: embeded app does not draw properly
Reply #2 - Mar 24th, 2010, 11:17pm
 
trying to translate that example in the docs...
I thought it was because i've used a swing compnent but it's the same  behaviour when using -just like they did in the example- the awt frame.does somebody ever got that running in ruby ?
Re: RP5: embeded app does not draw properly
Reply #3 - Mar 25th, 2010, 4:18am
 
I've dismissed the fact that the examples stick to the core library, ups Cheesy

Re: RP5: embeded app does not draw properly
Reply #4 - Apr 8th, 2010, 6:04am
 
Try this?
Code:

class Win < Processing::App
def setup
set_size(100, 100)
background(255, 0, 0)
win = javax.swing.JFrame.new("Window on JRuby")
win.set_location(screen.width/2, screen.height/2)
win.set_size(java.awt.Dimension.new(400, 200))
win.set_visible true
end

def draw

end

end

Win.new :title => "Win"
 Wink
Re: RP5: embeded app does not draw properly
Reply #5 - Jun 17th, 2010, 8:44am
 
thx for your reply
Page Index Toggle Pages: 1