jdk/src/java.desktop/share/classes/javax/swing/JComponent.java
changeset 26037 508779ce6619
parent 26001 991e1be0b235
parent 25859 3317bb8137f4
child 27055 57d7b3b1463b
equal deleted inserted replaced
25992:e9b05e933ddd 26037:508779ce6619
  1886      * @see #getAlignmentY
  1886      * @see #getAlignmentY
  1887      * @beaninfo
  1887      * @beaninfo
  1888      *   description: The preferred vertical alignment of the component.
  1888      *   description: The preferred vertical alignment of the component.
  1889      */
  1889      */
  1890     public void setAlignmentY(float alignmentY) {
  1890     public void setAlignmentY(float alignmentY) {
  1891         this.alignmentY = alignmentY > 1.0f ? 1.0f : alignmentY < 0.0f ? 0.0f : alignmentY;
  1891         this.alignmentY = validateAlignment(alignmentY);
  1892         isAlignmentYSet = true;
  1892         isAlignmentYSet = true;
  1893     }
  1893     }
  1894 
  1894 
  1895 
  1895 
  1896     /**
  1896     /**
  1915      * @see #getAlignmentX
  1915      * @see #getAlignmentX
  1916      * @beaninfo
  1916      * @beaninfo
  1917      *   description: The preferred horizontal alignment of the component.
  1917      *   description: The preferred horizontal alignment of the component.
  1918      */
  1918      */
  1919     public void setAlignmentX(float alignmentX) {
  1919     public void setAlignmentX(float alignmentX) {
  1920         this.alignmentX = alignmentX > 1.0f ? 1.0f : alignmentX < 0.0f ? 0.0f : alignmentX;
  1920         this.alignmentX = validateAlignment(alignmentX);
  1921         isAlignmentXSet = true;
  1921         isAlignmentXSet = true;
       
  1922     }
       
  1923 
       
  1924     private float validateAlignment(float alignment) {
       
  1925         return alignment > 1.0f ? 1.0f : alignment < 0.0f ? 0.0f : alignment;
  1922     }
  1926     }
  1923 
  1927 
  1924     /**
  1928     /**
  1925      * Sets the input verifier for this component.
  1929      * Sets the input verifier for this component.
  1926      *
  1930      *
  5512      * @param s  the <code>ObjectInputStream</code> from which to read
  5516      * @param s  the <code>ObjectInputStream</code> from which to read
  5513      */
  5517      */
  5514     private void readObject(ObjectInputStream s)
  5518     private void readObject(ObjectInputStream s)
  5515         throws IOException, ClassNotFoundException
  5519         throws IOException, ClassNotFoundException
  5516     {
  5520     {
  5517         s.defaultReadObject();
  5521         ObjectInputStream.GetField f = s.readFields();
       
  5522 
       
  5523         isAlignmentXSet = f.get("isAlignmentXSet", false);
       
  5524         alignmentX = validateAlignment(f.get("alignmentX", 0f));
       
  5525         isAlignmentYSet = f.get("isAlignmentYSet", false);
       
  5526         alignmentY = validateAlignment(f.get("alignmentY", 0f));
       
  5527         listenerList = (EventListenerList) f.get("listenerList", null);
       
  5528         vetoableChangeSupport = (VetoableChangeSupport) f.get("vetoableChangeSupport", null);
       
  5529         autoscrolls = f.get("autoscrolls", false);
       
  5530         border = (Border) f.get("border", null);
       
  5531         flags = f.get("flags", 0);
       
  5532         inputVerifier = (InputVerifier) f.get("inputVerifier", null);
       
  5533         verifyInputWhenFocusTarget = f.get("verifyInputWhenFocusTarget", false);
       
  5534         popupMenu = (JPopupMenu) f.get("popupMenu", null);
       
  5535         focusInputMap = (InputMap) f.get("focusInputMap", null);
       
  5536         ancestorInputMap = (InputMap) f.get("ancestorInputMap", null);
       
  5537         windowInputMap = (ComponentInputMap) f.get("windowInputMap", null);
       
  5538         actionMap = (ActionMap) f.get("actionMap", null);
  5518 
  5539 
  5519         /* If there's no ReadObjectCallback for this stream yet, that is, if
  5540         /* If there's no ReadObjectCallback for this stream yet, that is, if
  5520          * this is the first call to JComponent.readObject() for this
  5541          * this is the first call to JComponent.readObject() for this
  5521          * graph of objects, then create a callback and stash it
  5542          * graph of objects, then create a callback and stash it
  5522          * in the readObjectCallbacks table.  Note that the ReadObjectCallback
  5543          * in the readObjectCallbacks table.  Note that the ReadObjectCallback