JAL-3626 reconciled Platform
[jalview.git] / src / jalview / gui / AppJmol.java
index 16c6d8a..1698bf8 100644 (file)
@@ -238,6 +238,8 @@ public class AppJmol extends StructureViewerBase
     // TODO: consider waiting until the structure/view is fully loaded before
     // displaying
     this.getContentPane().add(renderPanel, java.awt.BorderLayout.CENTER);
+    this.invalidate();
+    this.pack();
     jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle(),
             getBounds().width, getBounds().height);
     if (scriptWindow == null)
@@ -328,7 +330,7 @@ public class AppJmol extends StructureViewerBase
     for (String s : files)
     {
       fileList.append(SPACE).append(QUOTE)
-              .append(Platform.escapeString(s)).append(QUOTE);
+              .append(Platform.escapeBackslashes(s)).append(QUOTE);
     }
     String filesString = fileList.toString();
 
@@ -344,6 +346,8 @@ public class AppJmol extends StructureViewerBase
       } catch (Exception ex)
       {
         Cache.log.error("Couldn't open Jmol viewer!", ex);
+        ex.printStackTrace();
+        return;
       }
     }
     else
@@ -363,9 +367,12 @@ public class AppJmol extends StructureViewerBase
         new OOMWarning("When trying to add structures to the Jmol viewer!",
                 oomerror);
         Cache.log.debug("File locations are " + filesString);
+        return;
       } catch (Exception ex)
       {
         Cache.log.error("Couldn't add files to Jmol viewer!", ex);
+        ex.printStackTrace();
+        return;
       }
     }
 
@@ -517,7 +524,7 @@ public class AppJmol extends StructureViewerBase
             addingStructures = true; // already files loaded.
             for (int c = 0; c < filesInViewer.length; c++)
             {
-              if (filesInViewer[c].equals(file))
+              if (Platform.pathEquals(filesInViewer[c], file))
               {
                 file = null;
                 break;
@@ -541,7 +548,7 @@ public class AppJmol extends StructureViewerBase
     }
     if (errormsgs.length() > 0)
     {
-      JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+      JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
               MessageManager.formatMessage(
                       "label.pdb_entries_couldnt_be_retrieved", new String[]
                       { errormsgs.toString() }),
@@ -558,6 +565,7 @@ public class AppJmol extends StructureViewerBase
    * 
    * @param type
    */
+  @Override
   public void makePDBImage(ImageMaker.TYPE type)
   {
     int width = getWidth();
@@ -581,8 +589,8 @@ public class AppJmol extends StructureViewerBase
   {
     try
     {
-      BrowserLauncher
-              .openURL("http://jmol.sourceforge.net/docs/JmolUserGuide/");
+      BrowserLauncher // BH 2018
+              .openURL("http://wiki.jmol.org");//http://jmol.sourceforge.net/docs/JmolUserGuide/");
     } catch (Exception ex)
     {
     }
@@ -621,15 +629,25 @@ public class AppJmol extends StructureViewerBase
     validate();
   }
 
+  @SuppressWarnings("serial")
   class RenderPanel extends JPanel
   {
     final Dimension currentSize = new Dimension();
 
+    public RenderPanel()
+    {
+      setPreferredSize(
+              Cache.getDefaultDim(Preferences.STRUCTURE_DIMENSIONS,
+                      Preferences.DEFAULT_STRUCTURE_DIMENSIONS));
+      // BH 2019.07.12 suggesting 600,600; current is something like 347 x 323
+    }
+
     @Override
     public void paintComponent(Graphics g)
     {
       getSize(currentSize);
-
+      // BH: Note that this size could be slightly different from the size set
+      // prior to packing.
       if (jmb != null && jmb.hasFileLoadingError())
       {
         g.setColor(Color.black);