diff options
author | Phil Burk <[email protected]> | 2014-12-30 17:54:28 -0800 |
---|---|---|
committer | Phil Burk <[email protected]> | 2014-12-30 17:54:28 -0800 |
commit | 6bed96c300097e29760330afaafeba44bb943470 (patch) | |
tree | 4bee0dbd44087c5b88eaad251668a4e3f6350475 /src/com/jsyn/swing | |
parent | e4cb838aa8a9eff7332069c421001df37689af91 (diff) |
Remove obsolete com.softsynth.util package.
Fix a few warnings.
Diffstat (limited to 'src/com/jsyn/swing')
-rw-r--r-- | src/com/jsyn/swing/DoubleBoundedRangeSlider.java | 2 | ||||
-rw-r--r-- | src/com/jsyn/swing/DoubleBoundedTextField.java | 4 | ||||
-rw-r--r-- | src/com/jsyn/swing/EnvelopeEditorBox.java | 10 | ||||
-rw-r--r-- | src/com/jsyn/swing/XYController.java | 8 |
4 files changed, 10 insertions, 14 deletions
diff --git a/src/com/jsyn/swing/DoubleBoundedRangeSlider.java b/src/com/jsyn/swing/DoubleBoundedRangeSlider.java index c67a4cf..3642221 100644 --- a/src/com/jsyn/swing/DoubleBoundedRangeSlider.java +++ b/src/com/jsyn/swing/DoubleBoundedRangeSlider.java @@ -25,7 +25,7 @@ import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import com.softsynth.util.NumericOutput; +import com.jsyn.util.NumericOutput; /** * Slider that takes a DoubleBoundedRangeModel. It displays the current value in a titled border. diff --git a/src/com/jsyn/swing/DoubleBoundedTextField.java b/src/com/jsyn/swing/DoubleBoundedTextField.java index 9605ae1..3301bb1 100644 --- a/src/com/jsyn/swing/DoubleBoundedTextField.java +++ b/src/com/jsyn/swing/DoubleBoundedTextField.java @@ -25,8 +25,6 @@ import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import com.softsynth.util.NumericOutput; - /** * TextField that turns pink when modified, and white when the value is entered. * @@ -90,7 +88,7 @@ public class DoubleBoundedTextField extends JTextField { } private void setValue(double value) { - super.setText(NumericOutput.doubleToString(value, 1, 4)); + super.setText(String.format("%6.4f", value)); markClean(); } } diff --git a/src/com/jsyn/swing/EnvelopeEditorBox.java b/src/com/jsyn/swing/EnvelopeEditorBox.java index 6394fce..b7b224a 100644 --- a/src/com/jsyn/swing/EnvelopeEditorBox.java +++ b/src/com/jsyn/swing/EnvelopeEditorBox.java @@ -23,8 +23,6 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.ArrayList; -import com.softsynth.util.NumericOutput; - /** * Edit a list of ordered duration,value pairs suitable for use with a SegmentedEnvelope. * @@ -381,7 +379,7 @@ public class EnvelopeEditorBox extends XYController implements MouseListener, Mo */ private void drawRange(Graphics g) { if (rangeStart >= 0) { - int height = bounds().height; + int height = getHeight(); int gx0 = 0, gx1 = 0; if (rangeEnd < rangeStart) { @@ -559,11 +557,11 @@ public class EnvelopeEditorBox extends XYController implements MouseListener, Mo drawAllPoints(g); /* Show X,Y,TotalX as text. */ - g.drawString(points.getName() + ", len=" + NumericOutput.doubleToString(wx, 7, 3), 5, 15); + g.drawString(points.getName() + ", len=" + String.format("%7.3f", wx), 5, 15); if ((draggedPoint != null) && (dragIndex >= 0)) { String s = "i=" + dragIndex + ", dur=" - + NumericOutput.doubleToString(draggedPoint[0], 7, 3) + ", y = " - + NumericOutput.doubleToString(draggedPoint[1], 8, 4); + + String.format("%7.3f", draggedPoint[0]) + ", y = " + + String.format("%8.4f", draggedPoint[1]); g.drawString(s, 5, 30); } } diff --git a/src/com/jsyn/swing/XYController.java b/src/com/jsyn/swing/XYController.java index 49cb9fd..b9cf90a 100644 --- a/src/com/jsyn/swing/XYController.java +++ b/src/com/jsyn/swing/XYController.java @@ -91,23 +91,23 @@ public class XYController extends JPanel { /** Convert from graphics coordinates (pixels) to world coordinates. */ public double convertGXtoWX(int gx) { - int width = bounds().width; + int width = getWidth(); return minWorldX + ((maxWorldX - minWorldX) * gx) / width; } public double convertGYtoWY(int gy) { - int height = bounds().height; + int height = getHeight(); return minWorldY + ((maxWorldY - minWorldY) * (height - gy)) / height; } /** Convert from world coordinates to graphics coordinates (pixels). */ public int convertWXtoGX(double wx) { - int width = bounds().width; + int width = getWidth(); return (int) (((wx - minWorldX) * width) / (maxWorldX - minWorldX)); } public int convertWYtoGY(double wy) { - int height = bounds().height; + int height = getHeight(); return height - (int) (((wy - minWorldY) * height) / (maxWorldY - minWorldY)); } |