diff options
author | Sven Göthel <[email protected]> | 2024-01-15 04:48:48 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-15 04:48:48 +0100 |
commit | 7f91a60a0f5d7043d44fd22639d27aaefa1dc1a4 (patch) | |
tree | 0ec84e77e13122358decafdfcaa9d0dd32d937cf /src/demos/com | |
parent | d7cb4a77b71cb3703ff7ac0667c5a97f29a5bdb4 (diff) |
GraphUI RangeSlider: Add SliderAdapter (convenience) and use a listener-array (was 1 instance)
Diffstat (limited to 'src/demos/com')
-rw-r--r-- | src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java index 01a4b1824..b7088a1a8 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java @@ -53,6 +53,7 @@ import com.jogamp.graph.ui.shapes.GlyphShape; import com.jogamp.graph.ui.shapes.Label; import com.jogamp.graph.ui.shapes.Rectangle; import com.jogamp.graph.ui.widgets.RangeSlider; +import com.jogamp.graph.ui.widgets.RangeSlider.SliderAdapter; import com.jogamp.graph.ui.widgets.RangeSlider.SliderListener; import com.jogamp.math.Vec2f; import com.jogamp.math.Vec2i; @@ -287,13 +288,7 @@ public class FontView01 { new Vec2f((GlyphGridWidth/gridDim.totalSize.x())/5f, glyphGrid.getBounds().getHeight()), 2, new Vec2f(0, gridDim.contourChars.size()/gridDim.columns), 1, 0).setInverted(sliderInverted); rs2.setColor(0.3f, 0.3f, 0.3f, 0.7f); - final SliderListener sliderListener = new SliderListener() { - @Override - public void clicked(final RangeSlider w, final MouseEvent e) { } - @Override - public void pressed(final RangeSlider w, final MouseEvent e) { } - @Override - public void released(final RangeSlider w, final MouseEvent e) { } + final SliderListener sliderListener = new SliderAdapter() { @Override public void dragged(final RangeSlider w, final float old_val, final float val, final float old_val_pct, final float val_pct) { final int totalRows = gridDim.contourChars.size() / gridDim.columns; @@ -318,8 +313,8 @@ public class FontView01 { }); } }; - rs1.onSlider( sliderListener ); - rs2.onSlider( sliderListener ); + rs1.addListener( sliderListener ); + rs2.addListener( sliderListener ); glyphInfoGrid.addShape(rs1); glyphInfoGrid.addShape(rs2); glyphInfoGrid.addShape(infoGrid); |