-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModalWindow.java
135 lines (117 loc) · 3.34 KB
/
ModalWindow.java
1
import java.awt.*;import java.awt.image.*;import java.applet.*;import java.util.*;public class ModalWindow extends NewWindow{ public ModalWindow() { super(); highlighted = true; drag = false; zoombox = false; modal = true; } protected void CreatePorts(int theWidth,int theHeight) { graphicsPort = theApplet.createImage(theWidth-16,theHeight-16); graphicsPortGC = graphicsPort.getGraphics(); graphicsPortGC.setFont(helvFont); } protected void Redraw() { if (visible) { if (highlighted) { theDesktop.offScreenImageGC.setColor(lightGray); theDesktop.offScreenImageGC.drawRect(xPos+2,yPos+2,width-5,height-5); theDesktop.offScreenImageGC.setColor(darkBlue); theDesktop.offScreenImageGC.drawLine(xPos+3,yPos+3,xPos+width-4,yPos+3); theDesktop.offScreenImageGC.drawLine(xPos+3,yPos+4,xPos+3,yPos+height-4); theDesktop.offScreenImageGC.drawLine(xPos+1,yPos+height-2,xPos+width-2,yPos+height-2); theDesktop.offScreenImageGC.drawLine(xPos+width-2,yPos+1,xPos+width-2,yPos+height-3); theDesktop.offScreenImageGC.setColor(lightBlue); theDesktop.offScreenImageGC.drawLine(xPos+1,yPos+1,xPos+width-3,yPos+1); theDesktop.offScreenImageGC.drawLine(xPos+1,yPos+2,xPos+1,yPos+height-3); theDesktop.offScreenImageGC.drawLine(xPos+4,yPos+height-4,xPos+width-4,yPos+height-4); theDesktop.offScreenImageGC.drawLine(xPos+width-4,yPos+4,xPos+width-4,yPos+height-5); theDesktop.offScreenImageGC.setColor(Color.black); theDesktop.offScreenImageGC.drawRect(xPos,yPos,width-1,height-1); theDesktop.offScreenImageGC.drawRect(xPos+4,yPos+4,width-9,height-9); } else { theDesktop.offScreenImageGC.setColor(midGray); theDesktop.offScreenImageGC.drawRect(xPos+3,yPos+3,width-7,height-7); theDesktop.offScreenImageGC.drawRect(xPos+4,yPos+4,width-9,height-9); theDesktop.offScreenImageGC.setColor(borderGray); theDesktop.offScreenImageGC.drawRect(xPos,yPos,width-1,height-1); theDesktop.offScreenImageGC.setColor(Color.white); theDesktop.offScreenImageGC.drawRect(xPos+1,yPos+1,width-3,height-3); theDesktop.offScreenImageGC.drawRect(xPos+2,yPos+2,width-5,height-5); } theDesktop.offScreenImageGC.setColor(Color.white); theDesktop.offScreenImageGC.fillRect(xPos+5,yPos+5,width-10,height-10); theDesktop.offScreenImageGC.drawImage(graphicsPort,xPos+8,yPos+8,null); } } protected void DrawGraphicsPort() { theDesktop.offScreenImageGC.drawImage(graphicsPort,xPos+8,yPos+8,null); } protected void DrawFrame() { } protected void DrawTitle() { } public void Init() { } public void DrawGrowIcon() { } public void Draw() { } public void Activate() { theApplet.theMenuBar.DisableMenuBar(); userActivate(); } public void userActivate() { } public void Deactivate() { Enumeration e; Control TempControl; e = theControls.elements(); while (e.hasMoreElements()) { TempControl = (Control)e.nextElement(); TempControl.hiliteState = 0; TempControl.Draw(); } userDeactivate(); } public void userDeactivate() { } public void Close() { theApplet.theMenuBar.EnableMenuBar(); } public Point GlobalToLocal(Point thePoint) { return new Point(thePoint.x - xPos - 8, thePoint.y - yPos - 8); } protected void DisposePorts() { graphicsPort.flush(); graphicsPort = null; graphicsPortGC.dispose(); graphicsPortGC = null; }}