Skip to content

Commit ded742d

Browse files
committed
title input
1 parent adf3c18 commit ded742d

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

lib/jruby_art/app.rb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ module Render
3434
}.freeze
3535
# All sketches extend this class
3636
class App < PApplet
37-
include HelperMethods, Math, MathTool, Render
37+
include HelperMethods
38+
include Math
39+
include MathTool
40+
include Render
3841
# Alias some methods for familiarity for Shoes coders.
3942
# surface replaces :frame, but needs field_reader for access
4043
alias oval ellipse
@@ -181,9 +184,9 @@ def mix_proxy_into_inner_classes
181184

182185
def import_opengl
183186
# Include processing opengl classes that we'd like to use:
184-
%w(FontTexture FrameBuffer LinePath LineStroker PGL
187+
%w[FontTexture FrameBuffer LinePath LineStroker PGL
185188
PGraphics2D PGraphics3D PGraphicsOpenGL PShader
186-
PShapeOpenGL Texture).each do |klass|
189+
PShapeOpenGL Texture].each do |klass|
187190
java_import format('processing.opengl.%s', klass)
188191
end
189192
end
@@ -192,14 +195,16 @@ def import_opengl
192195
# @HACK purists may prefer 'forwardable' to the use of Proxy
193196
# Importing PConstants here to access the processing constants
194197
module Proxy
195-
include Math, HelperMethods, Java::ProcessingCore::PConstants
198+
include Math
199+
include HelperMethods
200+
include Java::ProcessingCore::PConstants
196201

197-
def respond_to_missing?(name, include_private = false)
198-
$app.respond_to?(name) || super
202+
def respond_to_missing?(symbol, include_priv = false)
203+
$app.respond_to?(symbol, include_priv) || super
199204
end
200205

201-
def method_missing(name, *args)
202-
return $app.send(name, *args) if $app && $app.respond_to?(name)
206+
def method_missing(name, *args, &block)
207+
return $app.send(name, *args) if $app.respond_to? name
203208
super
204209
end
205210
end # Processing::Proxy

library/control_panel/control_panel.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def initialize(control_panel, name, proc = nil)
6565
set_horizontal_alignment javax.swing.SwingConstants::CENTER
6666
control_panel.add_element(self, name, false)
6767
add_action_listener do
68-
$app.instance_variable_set("@#{name}", value) unless value.nil?
68+
$app.instance_variable_set("@#{name}", value)
6969
proc.call(value) if proc
7070
end
7171
end
@@ -101,6 +101,10 @@ def initialize
101101
set_feel
102102
end
103103

104+
def title(name)
105+
set_title(name)
106+
end
107+
104108
def display
105109
add panel
106110
set_size 200, 30 + (64 * elements.size)
@@ -133,7 +137,7 @@ def menu(name, elements, initial_value = nil, &block)
133137
Menu.new(self, name, elements, initial_value, block || nil)
134138
end
135139

136-
def checkbox(name, initial_value = nil, &block)
140+
def checkbox(name, initial_value = false, &block)
137141
checkbox = Checkbox.new(self, name, block || nil)
138142
checkbox.do_click if initial_value == true
139143
end

0 commit comments

Comments
 (0)