Ignore:
Timestamp:
05/01/08 12:26:53 (16 years ago)
Author:
ra33
Message:

New expeditee version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Browser.java

    r4 r7  
    3737        // private static final JScrollPane scrollPane = new JScrollPane();
    3838
     39        public static Browser _theBrowser;
     40       
    3941        /**
    4042         * Constructs a new Browser object, then launches it
     
    4345         */
    4446        public static void main(String[] args) {
    45                 Browser b = new Browser();
     47                _theBrowser = new Browser();
    4648                // Why do we want to ignore repaint?
    4749                // b.setIgnoreRepaint(true);
    48                 b.requestFocus();
     50                _theBrowser.requestFocus();
    4951                // FrameGraphics.ForceRepaint();
    5052        }
    51 
     53       
    5254        public void setSizes(Dimension size) {
    5355                setSize(size);
     
    6365                                .getHeight() / 2)));
    6466
    65                 FrameGraphics.setMaxSize(size);
     67                FrameGraphics.setMaxSize(this.getContentPane().getSize());
    6668        }
    6769
     
    7577                Frame profile = FrameIO.LoadProfile(UserSettings.Username);
    7678                if (profile == null) {
     79                        try{
    7780                        profile = FrameIO.CreateNewProfile(UserSettings.Username);
     81                        }catch(Exception e){
     82                                //TODO fix this later
     83                        }
    7884                }
    7985                FrameUtils.ParseProfile(profile);
     
    110116                setVisible(true);
    111117
    112                 g = (Graphics2D) getGraphics();
     118                setupGraphics();
     119
     120                // required to accept TAB key
     121                setFocusTraversalKeysEnabled(false);
     122
     123                assert (UserSettings.FirstFrame != null);
     124                Frame firstFrame = FrameIO.LoadFrame(UserSettings.FirstFrame);
     125
     126                DisplayIO.setCurrentFrame(firstFrame);
     127
     128                // Create the action handler for the
     129                FrameMouseActions mouse = new FrameMouseActions();
     130               
     131                this.getContentPane().addMouseListener(mouse);
     132                this.getContentPane().addMouseMotionListener(mouse);
     133                this.addKeyListener(new FrameKeyboardActions());
     134                this.getContentPane().addMouseWheelListener(mouse);
     135        }
     136
     137        private void setupGraphics() {
     138                g = (Graphics2D) this.getContentPane().getGraphics();
    113139                assert g != null;
    114140                g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
    115141                                RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    116142                g.setFont(g.getFont().deriveFont(40f));
    117 
    118                 FrameGraphics.setDisplayGraphics((Graphics2D) getGraphics());
    119 
    120                 // required to accept TAB key
    121                 setFocusTraversalKeysEnabled(false);
    122 
    123                 assert (UserSettings.FirstFrame != null);
    124                 Frame firstFrame = FrameIO.LoadFrame(UserSettings.FirstFrame);
    125 
    126                 DisplayIO.setCurrentFrame(firstFrame);
    127 
    128                 // Create the action handler for the
    129                 FrameMouseActions mouse = new FrameMouseActions();
    130 
    131                 this.addMouseListener(mouse);
    132                 this.addMouseMotionListener(mouse);
    133                 this.addKeyListener(new FrameKeyboardActions());
    134                 this.addMouseWheelListener(mouse);
    135 
    136                 // Rob: Why is all this being done????
    137                 g.dispose();
    138                 g = null;
     143                FrameGraphics.setDisplayGraphics(g);
    139144        }
    140145
     
    158163         */
    159164        public void componentResized(ComponentEvent e) {
    160                 FrameGraphics.setMaxSize(this.getSize());
    161                 // FrameGraphics.Repaint();
     165                setSizes(this.getSize());
     166                setupGraphics();
    162167                repaint();
    163168                //System.out.println("Resize");
     
    181186         */
    182187        public void componentHidden(ComponentEvent e) {
    183         }
    184 
    185         public int getTitleBarHeight() {
    186                 Rectangle contentbounds = getContentPane().getBounds();
    187                 contentbounds = this.getGlassPane().getBounds();
    188                 // contentbounds = this.getRootPane().getBounds();
    189                 int titleheight = getSize().height - contentbounds.height;
    190 
    191                 return titleheight;
    192188        }
    193189
Note: See TracChangeset for help on using the changeset viewer.