/[classpath]/classpath/javax/swing/SwingUtilities.java
ViewVC logotype

Diff of /classpath/javax/swing/SwingUtilities.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by mark, Sat Jun 26 16:07:01 2004 UTC revision 1.14 by mark, Thu Jul 22 19:45:39 2004 UTC
# Line 65  import java.lang.reflect.InvocationTarge Line 65  import java.lang.reflect.InvocationTarge
65   */   */
66  public class SwingUtilities implements SwingConstants  public class SwingUtilities implements SwingConstants
67  {  {
68      /**
69    private static Frame ownerFrame;     * This frame should be used as parent for JWindow or JDialog
70       * that doesn't an owner
71       */
72      private static OwnerFrame ownerFrame;
73    
74    /**    /**
75     * Calculates the portion of the base rectangle which is inside the     * Calculates the portion of the base rectangle which is inside the
# Line 197  public class SwingUtilities implements S Line 200  public class SwingUtilities implements S
200     *     *
201     * @see #getAncestorOfClass     * @see #getAncestorOfClass
202     * @see #windowForComponent     * @see #windowForComponent
    * @see  
    *  
203     */     */
204    public static Container getAncestorOfClass(Class c, Component comp)    public static Container getAncestorOfClass(Class c, Component comp)
205    {    {
# Line 711  public class SwingUtilities implements S Line 712  public class SwingUtilities implements S
712        {        {
713        case TOP:        case TOP:
714          textR.y = 0;          textR.y = 0;
715          iconR.y = textR.height + textIconGap;          iconR.y = (horizontalTextPosition == CENTER
716                       ? textR.height + textIconGap : 0);
717          break;          break;
718        case BOTTOM:        case BOTTOM:
719          iconR.y = 0;          iconR.y = 0;
720          textR.y = iconR.height + textIconGap;          textR.y = (horizontalTextPosition == CENTER
721                       ? iconR.height + textIconGap
722                       : iconR.height - textR.height);
723          break;          break;
724        case CENTER:        case CENTER:
725          int centerLine = Math.max(textR.height, iconR.height) / 2;          int centerLine = Math.max(textR.height, iconR.height) / 2;
# Line 838  public class SwingUtilities implements S Line 842  public class SwingUtilities implements S
842    }    }
843        
844    /**    /**
845     * This method returns the common Frame owner used in JDialogs     * This method returns the common Frame owner used in JDialogs or
846     * when no owner is provided.     * JWindow when no owner is provided.
847     *     *
848     * @return The common Frame     * @return The common Frame
849     */     */
850    static Frame getOwnerFrame()    static Frame getOwnerFrame()
851    {    {
852      if (ownerFrame == null)      if (ownerFrame == null)
853        ownerFrame = new Frame();        ownerFrame = new OwnerFrame();
854      return ownerFrame;      return ownerFrame;
855    }    }
856    
# Line 888  public class SwingUtilities implements S Line 892  public class SwingUtilities implements S
892      return ((event.getModifiers() & InputEvent.BUTTON3_DOWN_MASK)      return ((event.getModifiers() & InputEvent.BUTTON3_DOWN_MASK)
893               == InputEvent.BUTTON3_DOWN_MASK);               == InputEvent.BUTTON3_DOWN_MASK);
894    }    }
895      
896      /**
897       * This frame should be used when constructing a Window/JDialog without
898       * a parent. In this case, we are forced to use this frame as a window's
899       * parent, because we simply cannot pass null instead of parent to Window
900       * constructor, since doing it will result in NullPointerException.
901       */
902      private static class OwnerFrame extends Frame
903      {
904        public void setVisible(boolean b)
905        {
906          // Do nothing here.
907        }
908        
909        public boolean isShowing()
910        {
911          return true;
912        }
913      }
914  }  }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26