Changeset 67 for trunk/src/org/expeditee/gui/Browser.java
- Timestamp:
- 05/19/08 12:03:18 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Browser.java
r50 r67 31 31 public class Browser extends JFrame implements ComponentListener, 32 32 WindowListener, WindowStateListener { 33 33 34 34 /** 35 35 * Default version - just to stop eclipse from complaining about it. … … 40 40 41 41 public static Browser _theBrowser; 42 42 43 43 /** 44 44 * Constructs a new Browser object, then launches it … … 49 49 _theBrowser = new Browser(); 50 50 // Why do we want to ignore repaint? 51 // b.setIgnoreRepaint(true);51 //_theBrowser.setIgnoreRepaint(true); 52 52 _theBrowser.requestFocus(); 53 53 // FrameGraphics.ForceRepaint(); 54 54 } 55 55 56 56 public void setSizes(Dimension size) { 57 57 setSize(size); 58 58 setPreferredSize(size); 59 addWindowListener(this); 60 addWindowStateListener(this); 61 59 60 FrameGraphics.setMaxSize(this.getContentPane().getSize()); 61 } 62 63 public Browser() { 64 // Use the default values initially so we can load the profile frame 65 setSizes(new Dimension(UserSettings.InitialWidth, 66 UserSettings.InitialHeight)); 62 67 // center the frame on the screen 63 68 Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); 64 69 double xpos = screen.getWidth() / 2; 65 70 double ypos = screen.getHeight() / 2; 66 setLocation((int) (xpos - (size.getWidth() / 2)), (int) (ypos - (size 67 .getHeight() / 2))); 68 69 FrameGraphics.setMaxSize(this.getContentPane().getSize()); 70 } 71 72 public Browser() { 73 // Use the default values initially so we can load the profile frame 74 setSizes(new Dimension(UserSettings.InitialWidth, 75 UserSettings.InitialHeight)); 71 setLocation((int) (xpos - (UserSettings.InitialWidth / 2)), 72 (int) (ypos - (UserSettings.InitialHeight / 2))); 73 74 addWindowListener(this); 75 addWindowStateListener(this); 76 76 77 77 UserSettings.Init(); 78 UserSettings.Username = FrameIO.ConvertToValidFramesetName(System.getProperty("user.name")); 78 UserSettings.Username = FrameIO.ConvertToValidFramesetName(System 79 .getProperty("user.name")); 79 80 String userName = UserSettings.Username; 80 81 Frame profile = FrameIO.LoadProfile(userName); … … 83 84 profile = FrameIO.CreateNewProfile(userName); 84 85 } catch (Exception e) { 85 //TODO tell the user that there was a problem creating the profile frame and close nicely 86 // TODO tell the user that there was a problem creating the 87 // profile frame and close nicely 86 88 e.printStackTrace(); 87 assert (false);89 assert (false); 88 90 } 89 91 } … … 95 97 UserSettings.InitialHeight)); 96 98 97 // set the layout to absolute layout for widgets99 // set the layout to absolute layout for widgets 98 100 this.getContentPane().setLayout(new AbsoluteLayout()); 99 //enable the glasspane-for capturing all mouse events 100 this.setGlassPane(new MouseEventRouter(getJMenuBar(), getContentPane())); 101 // enable the glasspane-for capturing all mouse events 102 this 103 .setGlassPane(new MouseEventRouter(getJMenuBar(), 104 getContentPane())); 101 105 this.getGlassPane().setVisible(true); 102 106 this.getContentPane().setBackground(Color.white); 103 107 this.getContentPane().setFocusTraversalKeysEnabled(false); 104 108 105 109 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 106 110 … … 147 151 private void setupGraphics() { 148 152 g = (Graphics2D) this.getContentPane().getGraphics(); 149 assert g != null;153 assert (g != null); 150 154 g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, 151 155 RenderingHints.VALUE_TEXT_ANTIALIAS_ON); … … 154 158 } 155 159 160 // private int count = 0; 156 161 @Override 157 162 public void paint(Graphics g) { 163 // All this does is make sure the screen is repainted when the browser 164 // is moved so that some of the window is off the edge of the display 165 // then moved back into view 158 166 super.paint(g); 159 167 FrameGraphics.Repaint(); 168 //System.out.println("Paint " + count++); 160 169 } 161 170 … … 166 175 setSizes(this.getSize()); 167 176 setupGraphics(); 168 repaint(); 177 FrameIO.RefreshCasheImages(); 178 FrameGraphics.Repaint(); 169 179 } 170 180 … … 211 221 } 212 222 213 /*214 * public void windowGainedFocus(WindowEvent e) { FrameGraphics.Repaint(); }215 *216 * public void windowLostFocus(WindowEvent e) { //FrameGraphics.Repaint(); }217 */218 223 public void windowStateChanged(WindowEvent e) { 219 // FrameGraphics.Repaint();220 // System.out.println('C');224 // FrameGraphics.Repaint(); 225 // System.out.println('C'); 221 226 } 222 227
Note:
See TracChangeset
for help on using the changeset viewer.