home *** CD-ROM | disk | FTP | other *** search
/ Popular Software (Premium Edition) / mycd.iso / INTERNET / NETSCAP4.06 / CP32E406.EXE / nav40.z / java40.jar / sun / awt / motif / MDialogPeer.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-08-13  |  3.5 KB  |  129 lines

  1. package sun.awt.motif;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Dialog;
  6. import java.awt.Font;
  7. import java.awt.Insets;
  8. import java.awt.Window;
  9. import java.awt.event.ComponentEvent;
  10. import java.awt.event.WindowEvent;
  11. import java.awt.peer.DialogPeer;
  12. import java.util.Vector;
  13. import sun.awt.Modality;
  14.  
  15. class MDialogPeer extends MPanelPeer implements DialogPeer {
  16.    Insets insets;
  17.    static Vector allDialogs = new Vector();
  18.    Modality m_modality;
  19.  
  20.    native void create(MComponentPeer var1, Object var2);
  21.  
  22.    native void pSetTitle(String var1);
  23.  
  24.    native void pShow();
  25.  
  26.    native void pHide();
  27.  
  28.    native void pReshape(int var1, int var2, int var3, int var4);
  29.  
  30.    native void pDispose();
  31.  
  32.    public native void setResizable(boolean var1);
  33.  
  34.    native void addTextComponent();
  35.  
  36.    MDialogPeer(Dialog var1) {
  37.       super(var1, new Insets(Integer.getInteger("awt.frame.topInset", 25), Integer.getInteger("awt.frame.leftInset", 5), Integer.getInteger("awt.frame.bottomInset", 5), Integer.getInteger("awt.frame.rightInset", 5)));
  38.       allDialogs.addElement(this);
  39.       if (var1.getTitle() != null) {
  40.          this.pSetTitle(var1.getTitle());
  41.       }
  42.  
  43.       Font var2 = ((Component)var1).getFont();
  44.       if (var2 == null) {
  45.          var2 = new Font("Dialog", 0, 12);
  46.          ((Component)var1).setFont(var2);
  47.          ((MComponentPeer)this).setFont(var2);
  48.       }
  49.  
  50.       Color var3 = ((Component)var1).getBackground();
  51.       if (var3 == null) {
  52.          ((Component)var1).setBackground(Color.lightGray);
  53.          ((MComponentPeer)this).setBackground(Color.lightGray);
  54.       }
  55.  
  56.       var3 = ((Component)var1).getForeground();
  57.       if (var3 == null) {
  58.          ((Component)var1).setForeground(Color.black);
  59.          ((MComponentPeer)this).setForeground(Color.black);
  60.       }
  61.  
  62.       this.setResizable(var1.isResizable());
  63.    }
  64.  
  65.    public void setTitle(String var1) {
  66.       this.pSetTitle(var1);
  67.    }
  68.  
  69.    public void dispose() {
  70.       allDialogs.removeElement(this);
  71.       super.dispose();
  72.    }
  73.  
  74.    public synchronized void handleMoved(int var1, int var2) {
  75.       ((MComponentPeer)this).postEvent(new ComponentEvent(super.target, 100));
  76.    }
  77.  
  78.    public void handleActivate() {
  79.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 205));
  80.    }
  81.  
  82.    public void handleDeactivate() {
  83.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 206));
  84.    }
  85.  
  86.    public void handleQuit() {
  87.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 201));
  88.    }
  89.  
  90.    public void show() {
  91.       super.show();
  92.       ((MComponentPeer)this).postEvent(new WindowEvent((Window)super.target, 200));
  93.       if (((Dialog)super.target).isModal()) {
  94.          try {
  95.             this.m_modality = new Modality();
  96.             this.m_modality.enter();
  97.          } catch (InterruptedException var2) {
  98.             ((Dialog)super.target).hide();
  99.          } catch (ThreadDeath var3) {
  100.             ((Dialog)super.target).hide();
  101.             ((Dialog)super.target).removeNotify();
  102.             throw (ThreadDeath)((Throwable)var3).fillInStackTrace();
  103.          }
  104.       }
  105.    }
  106.  
  107.    public void hide() {
  108.       super.hide();
  109.       if (((Dialog)super.target).isModal() && this.m_modality != null) {
  110.          this.m_modality.exit();
  111.       }
  112.  
  113.    }
  114.  
  115.    public void toFront() {
  116.       this.pShow();
  117.    }
  118.  
  119.    public native void toBack();
  120.  
  121.    public Insets insets() {
  122.       return this.insets;
  123.    }
  124.  
  125.    public synchronized void handleResize(int var1, int var2) {
  126.       ((MComponentPeer)this).postEvent(new ComponentEvent(super.target, 101));
  127.    }
  128. }
  129.