Changeset 38922


Ignore:
Timestamp:
2024-04-09T19:46:25+12:00 (8 weeks ago)
Author:
anupama
Message:

Status bar is not used and hiding it produces the strange effect where space for the bar is sometimes allocated and sometimes not. So I'm removing the statusbar again by setting it to null, not just hiding it after creating and setting it up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/applet/GsdlCollageApplet/GsdlCollageApplet.java

    r38908 r38922  
    144144    //setLayout(new BorderLayout());
    145145    //if(!isRunAsApplet) {
    146     statusBar = new JLabel();   
     146    statusBar = null; //new JLabel();
     147   
    147148    //this.add(statusBar, BorderLayout.SOUTH);
    148     /*
    149     Window win = SwingUtilities.getWindowAncestor(this);
    150     if(win instanceof JFrame) {
    151         JFrame topFrame = (JFrame)win;
    152         topFrame.add(statusBar, BorderLayout.SOUTH);
    153     } else { //AppletViewer or browser
    154         this.add(statusBar, BorderLayout.SOUTH);
    155     }*/
     149   
     150    ///Window win = SwingUtilities.getWindowAncestor(this);
     151    ///if(win instanceof JFrame) {
     152    ///    JFrame topFrame = (JFrame)win;
     153    ///    topFrame.add(statusBar, BorderLayout.SOUTH);
     154    ///} else { //AppletViewer or browser
     155    ///    this.add(statusBar, BorderLayout.SOUTH);
     156    ///}
    156157   
    157158    //Dimension d = statusBar.getSize();
     
    273274    // we'll now always show and print to our manually added statusBar now
    274275    // not only if(!isRunAsApplet) when we needed to manually create a statusBar.
    275     this.statusBar.setText(msg);
     276    if(this.statusBar != null) {
     277        this.statusBar.setText(msg);
     278    }
    276279    if(isRunAsApplet) {
    277280        super.showStatus(msg);
     
    287290    // gets the parameters specified
    288291    String showStatusBar        = getParameter("statusbar");
    289     if(showStatusBar == null || showStatusBar.equals("0")) {
    290         System.err.println("### Hiding status bar (default)");
    291         statusBar.setVisible(false);
    292     }   
     292    if(statusBar == null) {
     293        System.err.println("### Status bar code turned off. Ignoring statusbar settings.");
     294    } else {
     295        if(showStatusBar == null || showStatusBar.equals("0")) {
     296        System.err.println("### Hiding status bar (default)");
     297        statusBar.setVisible(false);
     298        }
     299    }
    293300    String verbosity_param      = getParameter("verbosity");
    294301    String is_java2_param       = getParameter("isJava2");
     
    708715       
    709716        // status bar code. Not ideal, but had to add it here to get relative dimensions right
    710         collageApp.setLayout(new BorderLayout());
    711717        JLabel statusBar = collageApp.getStatusBar();
    712         frame.add(statusBar, BorderLayout.SOUTH);
    713         Dimension d = statusBar.getSize();
    714         d.height = EXTRA_HEIGHT;
    715         d.width = collageApp.getWidth();
    716         statusBar.setPreferredSize(d);
    717         //statusBar.setPreferredSize(new Dimension(collageApp.getWidth(), EXTRA_HEIGHT));   
     718        if(statusBar != null) {
     719        collageApp.setLayout(new BorderLayout());
     720       
     721        frame.add(statusBar, BorderLayout.SOUTH);
     722        Dimension d = statusBar.getSize();
     723        d.height = EXTRA_HEIGHT;
     724        d.width = collageApp.getWidth();
     725        statusBar.setPreferredSize(d);
     726        //statusBar.setPreferredSize(new Dimension(collageApp.getWidth(), EXTRA_HEIGHT));   
     727        }
    718728       
    719729        // Run it at last: manually calling (J)Applet methods init() and start()
Note: See TracChangeset for help on using the changeset viewer.