Skip to content

Commit 65baa00

Browse files
committed
integrate core fix slider for jdk9+
1 parent a906a1f commit 65baa00

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
**v2.8.0** Integrated processing core, fix for control panel, drop set initial value for slider (default to mid range)
2+
13
**v2.7.0** Now using custom icons, nice blue ruby image
24

35
**v2.6.6** Using a modified processing-core to support jdk9 (NB FX2D and sketches with control_panel using sliders are still expected to fail with jdk9). Jdk8 users should not notice any change.

library/control_panel/control_panel.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
module ControlPanel
99
# class used to create slider elements for control_panel
1010
class Slider < javax.swing.JSlider
11-
def initialize(control_panel, name, range, initial_value, proc = nil)
11+
def initialize(control_panel, name, range, proc = nil)
1212
min = range.begin * 100
1313
max = (
1414
(range.exclude_end? && range.begin.respond_to?(:succ)) ?
@@ -21,11 +21,15 @@ def initialize(control_panel, name, range, initial_value, proc = nil)
2121
label = control_panel.add_element(self, name)
2222
add_change_listener do
2323
update_label(label, name, value)
24-
Propane.app.instance_variable_set("@#{name}", value) unless value.nil?
24+
app_value(name, value)
2525
proc.call(value) if proc
2626
end
27-
set_value(initial_value ? initial_value * 100 : min)
28-
fire_state_changed
27+
val = (range.first + range.last) / 2
28+
app_value(name, val * 100)
29+
end
30+
31+
def app_value(name, val)
32+
Propane.app.instance_variable_set("@#{name}", val)
2933
end
3034

3135
def value
@@ -130,8 +134,8 @@ def title(name)
130134
set_title(name)
131135
end
132136

133-
def slider(name, range = 0..100, initial_value = nil, &block)
134-
Slider.new(self, name, range, initial_value, block || nil)
137+
def slider(name, range = 0..100, &block)
138+
Slider.new(self, name, range, block || nil)
135139
end
136140

137141
def menu(name, elements, initial_value = nil, &block)

src/main/java/processing/core/PApplet.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,34 +73,34 @@
7373

7474
/**
7575
* Base class for all sketches that use processing.core.
76-
* <p/>
76+
* <p>
7777
* The <A HREF="https://github.com/processing/processing/wiki/Window-Size-and-Full-Screen">
7878
* Window Size and Full Screen</A> page on the Wiki has useful information
7979
* about sizing, multiple displays, full screen, etc.
80-
* <p/>
80+
* <p>
8181
* Processing uses active mode rendering. All animation tasks happen on the
8282
* "Processing Animation Thread". The setup() and draw() methods are handled
8383
* by that thread, and events (like mouse movement and key presses, which are
8484
* fired by the event dispatch thread or EDT) are queued to be safely handled
8585
* at the end of draw().
86-
* <p/>
86+
* <p>
8787
* Starting with 3.0a6, blit operations are on the EDT, so as not to cause
8888
* GUI problems with Swing and AWT. In the case of the default renderer, the
8989
* sketch renders to an offscreen image, then the EDT is asked to bring that
9090
* image to the screen.
91-
* <p/>
91+
* <p>
9292
* For code that needs to run on the EDT, use EventQueue.invokeLater(). When
9393
* doing so, be careful to synchronize between that code and the Processing
9494
* animation thread. That is, you can't call Processing methods from the EDT
9595
* or at any random time from another thread. Use of a callback function or
9696
* the registerXxx() methods in PApplet can help ensure that your code doesn't
9797
* do something naughty.
98-
* <p/>
98+
* <p>
9999
* As of Processing 3.0, we have removed Applet as the base class for PApplet.
100100
* This means that we can remove lots of legacy code, however one downside is
101101
* that it's no longer possible (without extra code) to embed a PApplet into
102102
* another Java application.
103-
* <p/>
103+
* <p>
104104
* As of Processing 3.0, we have discontinued support for versions of Java
105105
* prior to 1.8. We don't have enough people to support it, and for a
106106
* project of our (tiny) size, we should be focusing on the future, rather
@@ -1289,7 +1289,7 @@ public void orientation(int which) {
12891289
* Called by the browser or applet viewer to inform this applet that it
12901290
* should start its execution. It is called after the init method and
12911291
* each time the applet is revisited in a Web page.
1292-
* <p/>
1292+
* <p>
12931293
* Called explicitly via the first call to PApplet.paint(), because
12941294
* PAppletGL needs to have a usable screen before getting things rolling.
12951295
*/
@@ -1305,7 +1305,7 @@ public void start() {
13051305
/**
13061306
* Called by the browser or applet viewer to inform
13071307
* this applet that it should stop its execution.
1308-
* <p/>
1308+
* <p>
13091309
* Unfortunately, there are no guarantees from the Java spec
13101310
* when or if stop() will be called (i.e. on browser quit,
13111311
* or when moving between web pages), and it's not always called.
@@ -1364,7 +1364,7 @@ public void resume() { }
13641364
// * Called by the browser or applet viewer to inform this applet
13651365
// * that it is being reclaimed and that it should destroy
13661366
// * any resources that it has allocated.
1367-
// * <p/>
1367+
// * <p>
13681368
// * destroy() supposedly gets called as the applet viewer
13691369
// * is shutting down the applet. stop() is called
13701370
// * first, and then destroy() to really get rid of things.
@@ -3719,7 +3719,7 @@ public void dispose() {
37193719

37203720
/**
37213721
* Call a method in the current class based on its name.
3722-
* <p/>
3722+
* <p>
37233723
* Note that the function being called must be public. Inside the PDE,
37243724
* 'public' is automatically added, but when used without the preprocessor,
37253725
* (like from Eclipse) you'll have to do it yourself.
@@ -3748,7 +3748,7 @@ public void method(String name) {
37483748
* Launch a new thread and call the specified function from that new thread.
37493749
* This is a very simple way to do a thread without needing to get into
37503750
* classes, runnables, etc.
3751-
* <p/>
3751+
* <p>
37523752
* Note that the function being called must be public. Inside the PDE,
37533753
* 'public' is automatically added, but when used without the preprocessor,
37543754
* (like from Eclipse) you'll have to do it yourself.
@@ -7598,7 +7598,7 @@ public boolean saveStream(String target, String source) {
75987598
/**
75997599
* Identical to the other saveStream(), but writes to a File
76007600
* object, for greater control over the file location.
7601-
* <p/>
7601+
* <p>
76027602
* Note that unlike other api methods, this will not automatically
76037603
* compress or uncompress gzip files.
76047604
*/
@@ -7881,11 +7881,11 @@ public String sketchPath() {
78817881
* Prepend the sketch folder path to the filename (or path) that is
78827882
* passed in. External libraries should use this function to save to
78837883
* the sketch folder.
7884-
* <p/>
7884+
* <p>
78857885
* Note that when running as an applet inside a web browser,
78867886
* the sketchPath will be set to null, because security restrictions
78877887
* prevent applets from accessing that information.
7888-
* <p/>
7888+
* <p>
78897889
* This will also cause an error if the sketch is not inited properly,
78907890
* meaning that init() was never called on the PApplet when hosted
78917891
* my some other main() or by other code. For proper use of init(),
@@ -7914,7 +7914,7 @@ public File sketchFile(String where) {
79147914
/**
79157915
* Returns a path inside the applet folder to save to. Like sketchPath(),
79167916
* but creates any in-between folders so that things save properly.
7917-
* <p/>
7917+
* <p>
79187918
* All saveXxxx() functions use the path to the sketch folder, rather than
79197919
* its data folder. Once exported, the data folder will be found inside the
79207920
* jar file of the exported application or applet. In this case, it's not

0 commit comments

Comments
 (0)