jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
changeset 30921 cb07b8856f61
parent 25859 3317bb8137f4
child 38411 39056b8055ca
equal deleted inserted replaced
30920:3c35c680ec78 30921:cb07b8856f61
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   987                         if (newEditor instanceof JSpinner.DefaultEditor) {
   987                         if (newEditor instanceof JSpinner.DefaultEditor) {
   988                             JTextField tf =
   988                             JTextField tf =
   989                                 ((JSpinner.DefaultEditor)newEditor).getTextField();
   989                                 ((JSpinner.DefaultEditor)newEditor).getTextField();
   990                             if (tf != null) {
   990                             if (tf != null) {
   991                                 if (tf.getFont() instanceof UIResource) {
   991                                 if (tf.getFont() instanceof UIResource) {
   992                                     tf.setFont(spinner.getFont());
   992                                     tf.setFont(new FontUIResource(spinner.getFont()));
   993                                 }
   993                                 }
   994                                 tf.addFocusListener(nextButtonHandler);
   994                                 tf.addFocusListener(nextButtonHandler);
   995                                 tf.addFocusListener(previousButtonHandler);
   995                                 tf.addFocusListener(previousButtonHandler);
   996                             }
   996                             }
   997                         }
   997                         }
  1000                              "model".equals(propertyName)) {
  1000                              "model".equals(propertyName)) {
  1001                         ui.updateEnabledState();
  1001                         ui.updateEnabledState();
  1002                     }
  1002                     }
  1003                     else if ("font".equals(propertyName)) {
  1003                     else if ("font".equals(propertyName)) {
  1004                         JComponent editor = spinner.getEditor();
  1004                         JComponent editor = spinner.getEditor();
  1005                         if (editor!=null && editor instanceof JSpinner.DefaultEditor) {
  1005                         if (editor instanceof JSpinner.DefaultEditor) {
  1006                             JTextField tf =
  1006                             JTextField tf =
  1007                                 ((JSpinner.DefaultEditor)editor).getTextField();
  1007                                 ((JSpinner.DefaultEditor)editor).getTextField();
  1008                             if (tf != null) {
  1008                             if (tf != null) {
  1009                                 if (tf.getFont() instanceof UIResource) {
  1009                                 if (tf.getFont() instanceof UIResource) {
  1010                                     tf.setFont(spinner.getFont());
  1010                                     tf.setFont(new FontUIResource(spinner.getFont()));
  1011                                 }
  1011                                 }
  1012                             }
  1012                             }
  1013                         }
  1013                         }
  1014                     }
  1014                     }
  1015                     else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
  1015                     else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {