View Javadoc
1 /* 2 * Created on Oct 22, 2003 3 * 4 * To change the template for this generated file go to 5 * Window>Preferences>Java>Code Generation>Code and Comments 6 */ 7 package portaview; 8 9 import java.awt.BorderLayout; 10 import java.awt.GraphicsDevice; 11 import java.awt.GraphicsEnvironment; 12 import java.awt.Window; 13 import java.util.Observable; 14 15 import javax.swing.JFrame; 16 17 import portaview.model.PortaViewModel; 18 import portaview.view.DisplayerView; 19 20 /*** 21 * Represents a displayer frame and controller that shows the full-screen 22 * view of the picture. 23 * 24 * @author William Lee 25 */ 26 public class Displayer extends AbstractViewer 27 { 28 private JFrame frame = null; 29 private Window win = null; 30 31 /*** 32 * Constructs a Displayer that observes on the PortaViewModel. 33 * @param model the PortaViewModel associated with this Displayer 34 */ 35 public Displayer(PortaViewModel model) 36 { 37 super(model); 38 // this is experimental implementation of the display panel. 39 setView(new DisplayerView(model, this)); 40 41 // Determine if full-screen mode is supported directly 42 GraphicsDevice gs = getGraphicsDevice(); 43 if (!gs.isFullScreenSupported()) 44 { 45 frame = new JFrame(); 46 //TODO simulate full screen; 47 } 48 else 49 { 50 frame = new JFrame(gs.getDefaultConfiguration()); 51 } 52 // Enter full-screen mode 53 win = new Window(frame); 54 win.add(view, BorderLayout.CENTER); 55 56 } 57 58 /*** 59 * Returns the frame of this displayer. 60 * @return 61 */ 62 public JFrame getFrame() 63 { 64 return frame; 65 } 66 67 /*** 68 * Shows or hides the displayer. 69 * @param v show this frame if true, hide otherwise. 70 */ 71 public void setVisible(boolean v) 72 { 73 if (v) 74 { 75 getGraphicsDevice().setFullScreenWindow(win); 76 frame.setVisible(true); 77 win.validate(); 78 } 79 else 80 { 81 getGraphicsDevice().setFullScreenWindow(null); 82 } 83 } 84 85 86 /*** 87 * Returns the graphics device. 88 * @return the graphic deivce used in the full screen view. 89 */ 90 private GraphicsDevice getGraphicsDevice() 91 { 92 GraphicsEnvironment ge = 93 GraphicsEnvironment.getLocalGraphicsEnvironment(); 94 return (ge.getDefaultScreenDevice()); 95 } 96 97 /*** 98 * Does nothing, for the internals will update themselves. 99 * @see java.util.Observer#update(java.util.Observable, java.lang.Object) 100 */ 101 public void update(Observable o, Object arg) 102 { 103 } 104 105 }

This page was automatically generated by Maven