Skip to content

Commit 37e561f

Browse files
hansonrhansonr
authored andcommitted
JSlider, Float, JRadioButton
JSlider and JSSliderUI replaced with Java8 originals, with just very minor changes. JSSliderUI block increment, not unit "Button" prefix for disabled text Float missing nonstatic isInfinite()
1 parent 7664c0f commit 37e561f

File tree

12 files changed

+15
-14
lines changed

12 files changed

+15
-14
lines changed
4.39 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190121071846
1+
20190121215259
4.39 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190121071846
1+
20190121215259
4.43 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ protected void restoreCellNodes(DOMNode td) {
317317
protected DOMNode actionNode;
318318

319319
/**
320-
* the "FOR" label for a radio button
320+
* the "FOR" label for a radio button; the Button element itself for simple buttons
321321
*
322322
*/
323323
protected DOMNode buttonNode;
@@ -2015,7 +2015,7 @@ protected void enableNode(DOMNode node, boolean b) {
20152015
return;
20162016
DOMNode.setAttr(node, "disabled", (b ? null : "TRUE"));
20172017
if (!b && inactiveForeground == colorUNKNOWN)
2018-
getDisabledColors(getPropertyPrefix());
2018+
getDisabledColors(buttonNode == null ? getPropertyPrefix() : "Button");
20192019
if (jc.isOpaque()) {
20202020
Color bg = c.getBackground();
20212021
setBackground(b || !(bg instanceof UIResource) || inactiveBackground == null ? bg : inactiveBackground);

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSSliderUI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public void scrollByBlock(int direction) {
466466
}
467467
}
468468

469-
int delta = blockIncrement * ((direction > 0) ? POSITIVE_SCROLL : NEGATIVE_SCROLL);
469+
int delta = blockIncrement * ((direction > 0) ? POSITIVE_SCROLL : direction == 0 ? 0 : NEGATIVE_SCROLL);
470470
slider.setValue(slider.getValue() + delta);
471471
}
472472
}

sources/net.sf.j2s.java.core/src/test/Test_Applet_2.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ private JComponent addButton(ButtonGroup bg, String text, boolean b) {
807807
bg.add(c = new JRadioButton(text, b));
808808
c.setName(text);
809809
add(c);
810+
c.setForeground(Color.BLACK);
810811
c.setOpaque(false);//c.setBackground(Color.blue);
811812
System.out.println("radio is opaque " + c.isOpaque());
812813
c.setEnabled(false);

sources/net.sf.j2s.java.core/src/test/Test_Applet_Scroll.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ public void stateChanged(ChangeEvent e) {
310310
});
311311

312312
JTextField field = ((JSpinner.DefaultEditor) spinner.getEditor()).getTextField();
313-
spinner.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 24));
314-
field.setEditable(false);
313+
//spinner.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 24));
314+
//field.setEditable(false);
315315
field.addActionListener(new ActionListener( ) {
316316

317317
@Override
@@ -335,7 +335,7 @@ public void actionPerformed(ActionEvent e) {
335335

336336
JSlider redSlider = new JSlider(JSlider.HORIZONTAL, 0, 255, 100);
337337
redSlider.setMajorTickSpacing( 85 );
338-
redSlider.setMinorTickSpacing( 17 );
338+
redSlider.setMinorTickSpacing( -90 );
339339
redSlider.setPaintTicks( true );
340340
redSlider.setPaintLabels( true );
341341

@@ -379,7 +379,7 @@ public void mouseWheelMoved(MouseWheelEvent e) {
379379
}
380380

381381
JSlider mkSlider(JPanel p, final JTextField tf, int orient, int x, int y) {
382-
final JSlider bar = new JSlider(orient, 300, 1000, 500);
382+
final JSlider bar = new JSlider(orient, -300, 1000, 500);
383383
bar.addChangeListener(new ChangeListener() {
384384
@Override
385385
public void stateChanged(ChangeEvent e) {

sources/net.sf.j2s.java.core/src/test/Test_Dialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public Test_Dialog() {
116116
public void actionPerformed(ActionEvent e) {
117117
Test_Dialog.this.onDialogReturn(JOptionPane.showConfirmDialog(
118118
Test_Dialog.this,
119-
"The frame is now " + (isResizable() ? "NOT " : "") + "resizable.",
119+
"<html>The frame is now " + (isResizable() ? "<b>NOT</b> " : "") + "resizable.</html>",
120120
"Testing JOptionPane", JOptionPane.OK_CANCEL_OPTION));
121121
setResizable(!isResizable());
122122
}

0 commit comments

Comments
 (0)