Changeset 38889 for main/trunk/greenstone3/src/java/org/greenstone/applet/GsdlCollageApplet/GsdlCollageApplet.java
- Timestamp:
- 2024-03-28T22:04:59+13:00 (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/applet/GsdlCollageApplet/GsdlCollageApplet.java
r38888 r38889 30 30 public class GsdlCollageApplet extends JApplet { 31 31 static final int EXTRA_HEIGHT = 30; // for status bar or any extra elements 32 static final int X_DIM = 600; 33 static final int Y_DIM = 300; 34 32 private int X_DIM = 600; 33 private int Y_DIM = 300; 34 35 public int X_DIM() { 36 return X_DIM; 37 } 38 public int Y_DIM() { 39 return Y_DIM; 40 } 41 35 42 // To run this GsdlCollageApplet as Application instead of as Applet 36 43 boolean isWebswingApplication = false; // if run as webswing *and* application (not applet) … … 195 202 196 203 isWebswingApplication = appParams.getOrDefault("webswing", "0").equals("1") ? true : false; 204 // Need these parameters set before init(), so that the display works 205 int w = this.getWidth(); 206 if(appParams.get("width") != null) { 207 w = Integer.parseInt(appParams.get("width")); 208 } 209 int h = this.getHeight(); 210 if(appParams.get("height") != null) { 211 h = Integer.parseInt(appParams.get("height")); 212 } 213 // For applet, w and h may now be set to a positive value. But if GsdlCollageApplet 214 // is run as an application, it won't yet be visible and not have a non-zero dimension. 215 // So use defaults here: 216 this.X_DIM = (w <= 0) ? X_DIM : w; 217 this.Y_DIM = (h <= 0) ? Y_DIM : h; 218 197 219 try { 198 220 this.docBaseURL = new URL(appParams.get("baseurl")); … … 619 641 /** 620 642 * After building the GS3 Multimedia collection, try running this Application as: 621 java -cp ./web/applet/GsdlCollageApplet.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet --statusbar 1 --baseurl "http://localhost:8383/greenstone3/" --library library --collection smallbea --gsdlversion 3 --hrefMustHave "library/sites/localsite/collect/smallbea" --documentroot greenstone3 --verbosity 3 --imageType ".jpg%.png" --imageMustNotHave "interfaces/" --classifier "CL2.3" --maxDepth 500 --maxDisplay 25 --refreshDelay 1500 --isJava2 auto --bgcolor "#96c29a"643 java -cp ./web/applet/GsdlCollageApplet.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.applet.GsdlCollageApplet.GsdlCollageApplet --statusbar 0 --baseurl "http://localhost:8383/greenstone3/" --library library --collection smallbea --gsdlversion 3 --hrefMustHave "library/sites/localsite/collect/smallbea" --documentroot greenstone3 --verbosity 3 --imageType ".jpg%.png" --imageMustNotHave "interfaces/" --classifier "CL2.3" --maxDepth 500 --maxDisplay 25 --refreshDelay 1500 --isJava2 auto --bgcolor "#96c29a" --width 645 --height 780 622 644 */ 623 645 public static void main(String[] args) { … … 630 652 GsdlCollageApplet collageApp = new GsdlCollageApplet(); 631 653 frame.getContentPane().add(collageApp, BorderLayout.CENTER); 632 frame.setSize(X_DIM, Y_DIM); //Y_DIM+EXTRA_HEIGHT);654 //frame.setSize(X_DIM, Y_DIM); //Y_DIM+EXTRA_HEIGHT); 633 655 frame.setVisible(true); 634 656 // https://stackoverflow.com/questions/19433358/difference-between-dispose-and-exit-on-close-in-java … … 638 660 // prepare to run the collage applet as an application 639 661 collageApp.applicationPreInit(args); 640 662 // It's now figured out the dimensions based on anything specified, so set frame size 663 frame.setSize(collageApp.X_DIM(), collageApp.Y_DIM()); //Y_DIM+EXTRA_HEIGHT); 641 664 // status bar code. Not ideal, but had to add it here to get relative dimensions right 642 665 collageApp.setLayout(new BorderLayout());
Note:
See TracChangeset
for help on using the changeset viewer.