jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java
changeset 30921 cb07b8856f61
parent 25859 3317bb8137f4
child 32669 8ff453aa551b
equal deleted inserted replaced
30920:3c35c680ec78 30921:cb07b8856f61
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 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
   230 
   230 
   231         editor.setOpaque(false);
   231         editor.setOpaque(false);
   232         editor.setInheritsPopupMenu(true);
   232         editor.setInheritsPopupMenu(true);
   233 
   233 
   234         if (editor.getFont() instanceof UIResource) {
   234         if (editor.getFont() instanceof UIResource) {
   235             editor.setFont(spinner.getFont());
   235             editor.setFont(new FontUIResource(spinner.getFont()));
   236         }
   236         }
   237 
   237 
   238         final JFormattedTextField editorTextField = ((DefaultEditor)editor).getTextField();
   238         final JFormattedTextField editorTextField = ((DefaultEditor)editor).getTextField();
   239         if (editorTextField.getFont() instanceof UIResource) {
   239         if (editorTextField.getFont() instanceof UIResource) {
   240             editorTextField.setFont(spinner.getFont());
   240             editorTextField.setFont(new FontUIResource(spinner.getFont()));
   241         }
   241         }
   242         final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
   242         final InputMap spinnerInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
   243         final InputMap editorInputMap = editorTextField.getInputMap();
   243         final InputMap editorInputMap = editorTextField.getInputMap();
   244         final KeyStroke[] keys = spinnerInputMap.keys();
   244         final KeyStroke[] keys = spinnerInputMap.keys();
   245         for (final KeyStroke k : keys) {
   245         for (final KeyStroke k : keys) {
   646                     ui.updateEnabledState();
   646                     ui.updateEnabledState();
   647                 } else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
   647                 } else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
   648                     ui.updateToolTipTextForChildren(spinner);
   648                     ui.updateToolTipTextForChildren(spinner);
   649                 } else if ("font".equals(propertyName)) {
   649                 } else if ("font".equals(propertyName)) {
   650                     JComponent editor = spinner.getEditor();
   650                     JComponent editor = spinner.getEditor();
   651                     if (editor != null && editor instanceof JSpinner.DefaultEditor) {
   651                     if (editor instanceof JSpinner.DefaultEditor) {
   652                         JTextField tf =
   652                         JTextField tf =
   653                                 ((JSpinner.DefaultEditor) editor).getTextField();
   653                                 ((JSpinner.DefaultEditor) editor).getTextField();
   654                         if (tf != null) {
   654                         if (tf != null) {
   655                             if (tf.getFont() instanceof UIResource) {
   655                             if (tf.getFont() instanceof UIResource) {
   656                                 tf.setFont(spinner.getFont());
   656                                 tf.setFont(new FontUIResource(spinner.getFont()));
   657                             }
   657                             }
   658                         }
   658                         }
   659                     }
   659                     }
   660                 }
   660                 }
   661             }
   661             }