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

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

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

revision 1.12 by mkoch, Fri Oct 22 17:46:47 2004 UTC revision 1.13 by mkoch, Tue Dec 21 19:25:10 2004 UTC
# Line 62  public class JWindow extends Window impl Line 62  public class JWindow extends Window impl
62  {  {
63    private static final long serialVersionUID = 5420698392125238833L;    private static final long serialVersionUID = 5420698392125238833L;
64        
65    public static final int HIDE_ON_CLOSE = 0;    protected AccessibleContext accessibleContext;
   public static final int EXIT_ON_CLOSE = 1;  
   public static final int DISPOSE_ON_CLOSE = 2;  
   public static final int DO_NOTHING_ON_CLOSE  = 3;  
   
     protected  AccessibleContext accessibleContext;  
   
     private int close_action = EXIT_ON_CLOSE;      
       
       
     /***************************************************  
      *  
      *  
      *  constructors  
      *  
      *  
      *************/  
   
     public JWindow()  
     {        
       super(SwingUtilities.getOwnerFrame());  
     }  
   
     // huuu ?  
     public JWindow(Frame f)  
     {  
         super(f);  
     }  
       
     /***************************************************  
      *  
      *  
      *  methods, this part is shared with JDialog, JFrame  
      *  
      *  
      *************/  
66    
67        public JWindow()
68      private boolean checking;    {
69      protected  JRootPane         rootPane;      super(SwingUtilities.getOwnerFrame());
70      }
71    
72      public JWindow(Frame f)
73      {
74        super(f);
75      }
76    
77      private boolean checking;
78      protected JRootPane rootPane;
79    
80      protected void frameInit()
81      {
82        super.setLayout(new BorderLayout(1, 1));
83        getRootPane(); // will do set/create
84      }
85    
       
     protected  void frameInit()  
     {  
       super.setLayout(new BorderLayout(1, 1));  
       getRootPane(); // will do set/create  
     }  
     
86    public Dimension getPreferredSize()    public Dimension getPreferredSize()
87    {    {
88      Dimension d = super.getPreferredSize();      return super.getPreferredSize();
     return d;  
89    }    }
90    
91    public  void setLayout(LayoutManager manager)    public void setLayout(LayoutManager manager)
92    {    super.setLayout(manager);  }    {
93        super.setLayout(manager);
94      }
95    
96      public void setLayeredPane(JLayeredPane layeredPane)    public void setLayeredPane(JLayeredPane layeredPane)
97      {   getRootPane().setLayeredPane(layeredPane);   }    {
98          getRootPane().setLayeredPane(layeredPane);
99      public JLayeredPane getLayeredPane()    }
     {   return getRootPane().getLayeredPane();     }  
     
     public JRootPane getRootPane()  
     {  
         if (rootPane == null)  
             setRootPane(createRootPane());  
         return rootPane;            
     }  
   
     public void setRootPane(JRootPane root)  
     {  
         if (rootPane != null)  
             remove(rootPane);  
               
         rootPane = root;  
         add(rootPane, BorderLayout.CENTER);  
     }  
100    
101      public JRootPane createRootPane()    public JLayeredPane getLayeredPane()
102      {   return new JRootPane();    }    {
103        return getRootPane().getLayeredPane();
104      }
105    
106      public Container getContentPane()    public JRootPane getRootPane()
107      {    return getRootPane().getContentPane();     }    {
108        if (rootPane == null)
109          setRootPane(createRootPane());
110        return rootPane;
111      }
112    
113      public void setContentPane(Container contentPane)    public void setRootPane(JRootPane root)
114      {    getRootPane().setContentPane(contentPane);    }    {
115          if (rootPane != null)
116      public Component getGlassPane()        remove(rootPane);
     {    return getRootPane().getGlassPane();   }  
     
     public void setGlassPane(Component glassPane)  
     {   getRootPane().setGlassPane(glassPane);   }  
117    
118            rootPane = root;
119      protected  void addImpl(Component comp, Object constraints, int index)      add(rootPane, BorderLayout.CENTER);
120      {   super.addImpl(comp, constraints, index);    }    }
121    
122      public JRootPane createRootPane()
123      {
124        return new JRootPane();
125      }
126    
127      public void remove(Component comp)    public Container getContentPane()
128      {   getContentPane().remove(comp);  }    {
129          return getRootPane().getContentPane();
130      protected  boolean isRootPaneCheckingEnabled()    }
     {    return checking;        }  
131    
132      public void setContentPane(Container contentPane)
133      {
134        getRootPane().setContentPane(contentPane);
135      }
136    
137      protected  void setRootPaneCheckingEnabled(boolean enabled)    public Component getGlassPane()
138      { checking = enabled;  }    {
139        return getRootPane().getGlassPane();
140      }
141    
142      public void setGlassPane(Component glassPane)
143      {
144        getRootPane().setGlassPane(glassPane);
145      }
146    
147      public void update(Graphics g)    protected void addImpl(Component comp, Object constraints, int index)
148      {   paint(g);  }    {
149        super.addImpl(comp, constraints, index);
150      }
151    
152      protected  void processKeyEvent(KeyEvent e)    public void remove(Component comp)
153      {   super.processKeyEvent(e);    }    {
154        getContentPane().remove(comp);
155      }
156    
157      /////////////////////////////////////////////////////////////////////////////////    protected boolean isRootPaneCheckingEnabled()
158        {
159      public AccessibleContext getAccessibleContext()      return checking;
160      {    return null;  }    }
161      
162      int getDefaultCloseOperation()    protected void setRootPaneCheckingEnabled(boolean enabled)
163      {    return close_action;   }        {
164            checking = enabled;
165      protected  String paramString()    }
166      {   return "JWindow";     }  
167      public void update(Graphics g)
168      {
169      protected  void processWindowEvent(WindowEvent e)      paint(g);
170      {    }
         //      System.out.println("PROCESS_WIN_EV-1: " + e);  
         super.processWindowEvent(e);  
         //      System.out.println("PROCESS_WIN_EV-2: " + e);  
         switch (e.getID())  
             {  
             case WindowEvent.WINDOW_CLOSING:  
                 {  
                     switch(close_action)  
                         {  
                         case EXIT_ON_CLOSE:  
                             {  
                                 System.out.println("user requested exit on close");  
                                 System.exit(1);  
                                 break;  
                             }  
                         case DISPOSE_ON_CLOSE:  
                             {  
                                 System.out.println("user requested dispose on close");  
                                 dispose();  
                                 break;  
                             }  
                         case HIDE_ON_CLOSE:  
                             {  
                                 setVisible(false);  
                                 break;  
                             }  
                         case DO_NOTHING_ON_CLOSE:  
                             break;  
                         }  
                     break;  
                 }  
                   
             case WindowEvent.WINDOW_CLOSED:  
             case WindowEvent.WINDOW_OPENED:  
             case WindowEvent.WINDOW_ICONIFIED:  
             case WindowEvent.WINDOW_DEICONIFIED:  
             case WindowEvent.WINDOW_ACTIVATED:  
             case WindowEvent.WINDOW_DEACTIVATED:  
                 break;  
             }  
     }    
   
171    
172      void setDefaultCloseOperation(int operation)    protected void processKeyEvent(KeyEvent e)
173      {  close_action = operation;   }    {
174        super.processKeyEvent(e);
175      }
176    
177      public AccessibleContext getAccessibleContext()
178      {
179        return null;
180      }
181    
182      protected String paramString()
183      {
184        return "JWindow";
185      }
186  }  }

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

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