View generator.rb
require 'propane'
require 'fileutils'
require 'digest/sha1'
require 'active_support/all'
require 'erb'
require 'fileutils'
class Generator < Propane::App
def self.get_class_name
self.name.to_s
end
View class_instance_variable.rb
require 'propane'
class MyApp < Propane::App
def self.code
@code
end
def self.path
@path
end
View jtoy.rb
#!/usr/bin/env jruby
require 'propane'
class MyApp < Propane::App
def self.run code,path
@@code = code
@@path = path
MyApp.new
end
View grid_demo.rb
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'
class GridDemo < Propane::App
attr_reader :tile # attr_accessor is frowned on in ruby circles
def settings
size(700, 100)
end
View fred.rb
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'propane'
class Fred < Propane::App
attr_accessor :back # we can set this variable dynamically
def settings
size 300, 300
end
View lib_path.rb
# frozen_string_literal: true
module BuildPath
def library_path(base, name, ext)
File.join(base, 'library', name, "#{name}.#{ext}")
end
def processing_library_path(base, name, ext)
File.join(base, name, 'library', "#{name}.#{ext}")
end
end
View control_panel.md

Inspired by Nodebox, JRubyArt (copied from ruby-processing) provides a way to control the instance variables of your sketch with a control panel. You can create sliders, buttons, menus and checkboxes that set instance variables on your sketch. Since ruby-processing-2.0 you need to explicitly set the panel visible from the processing sketch (see included examples). Start by loading in the control_panel library, and then define your panel like so:

  load_library :control_panel
  attr_reader :panel, :hide

  def setup
    size(200, 200)
    @hide = false
View simple_capture.rb
load_library :glvideo
include_package 'gohai.glvideo'
attr_reader :video
def settings
size(320, 240, P2D)
end
def setup
View read_write_xml_processing.rb
#
# Loading XML Data
# by Daniel Shiffman.
#
# This example demonstrates how to use loadXML
# to retrieve data from an XML file and make objects
# from that data.
#
# Here is what the XML looks like:
#
View Palettes.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import processing.core.*;
import com.cage.colorharmony.*;