public void testContextIsJAppletWhenJAppletIsShown() {
   JApplet applet = new JApplet();
   JButton button = new JButton();
   applet.getContentPane().add(button);
   windowContext.setActiveWindow(applet);
   assertSame(applet, windowContext.activeWindow());
 }
 public static void run(JApplet applet, int width, int height) {
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.getContentPane().add(applet);
   frame.setSize(width, height);
   applet.init();
   applet.start();
   frame.setVisible(true);
 }
示例#3
0
 public static void main(String s[]) {
   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setTitle("Homework 10");
   JApplet applet = new Homework10();
   applet.init();
   frame.getContentPane().add(applet);
   frame.pack();
   frame.setVisible(true);
 }
 public void testContextIsJAppletWhenACompentInItHasFocus() {
   Frame frame = new Frame();
   JApplet applet = new JApplet();
   JButton button = new JButton();
   frame.add(applet);
   applet.getContentPane().add(button);
   setFocusManager(button);
   windowContext.propertyChange(new PropertyChangeEvent(this, "focusOwner", null, button));
   assertSame(applet, windowContext.activeWindow());
 }
 /** 在Applet中加入了main方法之后使得,它可以同时作为应用程序和 applet 运行。 */
 public static void main(String[] args) {
   JApplet applet = new AppletDemo();
   JFrame frame = new JFrame("AppletDemo");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.getContentPane().add(applet);
   frame.setSize(100, 50);
   applet.init();
   applet.start();
   frame.setVisible(true);
 }
示例#6
0
  public static void main(String[] args) {
    Frame f = new JFrame("YAY it Works");
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            System.exit(0);
          }
        });
    JApplet applet = new midapp();
    ((RootPaneContainer) f).getContentPane().add("Center", applet);
    f.add(p2, BorderLayout.EAST);

    applet.init();
    f.pack();
    f.setSize(new Dimension(653, 437));
    f.setVisible(true);
  }
示例#7
0
  /** Destruye el applet. */
  public void destroy() {

    Log.log("Destroying Applet");

    super.destroy();

    Log.log("Applet Destroyed");
  }
  private void initPanel(Object f, Method method) {
    try {

      JApplet _applet = (JApplet) f;
      String panelClassName = (String) getValue(method, _applet, "panelClassName");
      Class panelClass = Class.forName(panelClassName);
      _applet.getContentPane().setLayout(new BorderLayout());
      Object panelInstance = panelClass.newInstance();
      JComponent panel = (JComponent) panelInstance;
      _applet.getContentPane().removeAll();
      _applet.getContentPane().setLayout(new BorderLayout());
      _applet.getContentPane().add(panel, BorderLayout.CENTER);
      SwingUtilities.updateComponentTreeUI(_applet);

    } catch (Exception e) {
      throw new RuntimeException(e.getMessage(), e);
    }
  }
  // dibujar líneas en el fondo del applet
  public void paint(Graphics g) {
    super.paint(g); // llamar al método paint heredado de JApplet

    int contador = 1; // inicialización

    while (contador <= 10) {
      g.drawLine(10, 10, 250, contador * 10);
      ++contador; // incremento
    } // fin de la instrucción while
  } // fin del método paint
 public static void main(String s[]) {
   if (s.length > 0) j2kfilename = s[0];
   else j2kfilename = "girl";
   System.out.println(j2kfilename);
   isApplet = false;
   JFrame f = new JFrame("ImageViewer");
   f.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   JApplet applet = new ImageViewer();
   f.getContentPane().add("Center", applet);
   applet.init();
   f.pack();
   f.setSize(new Dimension(550, 550));
   f.show();
 }
示例#11
0
 public void run() {
   try {
     for (; ; ) {
       fApplet.showStatus("loading icons...");
       sleep(50);
     }
   } catch (InterruptedException e) {
     return;
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see java.applet.Applet#init()
   */
  @Override
  public final void init() {
    super.init();

    String fn = JOptionPane.showInputDialog("Enter first number");
    String sn = JOptionPane.showInputDialog("Enter second number");

    double n1 = Double.parseDouble(fn);
    double n2 = Double.parseDouble(sn);

    sum = n1 + n2;
  }
示例#13
0
  /**
   * Call this method to initialize an applet from your launcher class <code>MyAppletLauncher.init()
   * </code> method.
   *
   * @param sClass class name in form "MyClass" for default package or "com.abc.MyClass" for class
   *     in some package
   * @param appletParent parent applet from a launcher.
   * @throws Throwable wrapper for many exceptions thrown while applet instantiation and calling
   *     init() method.
   */
  public void initApplet(String sClass, final JApplet appletParent) throws Throwable {
    Class<?> clazz = loadClass(sClass);
    logInfo(
        LogArea.CONFIG, "initApplet() --> %s.init(); Loader: %s", sClass, clazz.getClassLoader());
    applet = (JApplet) clazz.newInstance();
    applet.setStub(
        new AppletStub() {
          @Override
          public boolean isActive() {
            return appletParent.isActive();
          }

          @Override
          public URL getDocumentBase() {
            return appletParent.getDocumentBase();
          }

          @Override
          public URL getCodeBase() {
            return appletParent.getCodeBase();
          }

          @Override
          public String getParameter(String name) {
            return appletParent.getParameter(name);
          }

          @Override
          public AppletContext getAppletContext() {
            return appletParent.getAppletContext();
          }

          @Override
          public void appletResize(int width, int height) {
            appletParent.resize(width, height);
          }
        });
    applet.init();
    appletParent.setContentPane(applet.getContentPane());
  }
  @Override
  public void destroy() {

    System.out.println("Shuffling destroy.......");

    try {
      ShuffleDestroyRequest requestObj = new ShuffleDestroyRequest();
      requestObj.setRequestID(requestClientId);
      destroyUrlRequester.post(requestObj);
    } catch (Exception e) {
      e.printStackTrace();
    }

    super.destroy();
  }
示例#15
0
  public void init() {
    this.setSize(400, 80);

    int imgNum = (int) (1 + (Math.random() * 6));

    if (imgNum == 6) {
      imgNum = (int) (1 + (Math.random() * 6));
    }
    imgNum = 7;
    logo = new ImageIcon(this.getClass().getResource("sowlogo" + imgNum + ".png"));

    LogoPanel panel = null;

    try {
      panel = new LogoPanel(logo, this);
    } catch (IOException e) {
      e.printStackTrace();
    }

    threadLogo = new ThreadLogo(panel, this);

    String borderTxt = "Versão 2008 \u263A no rights reserved.";

    if (imgNum == 6) {
      borderTxt = "Scary Guy!! Metallica yeah!!!";
    }

    TitledBorder border = new TitledBorder(borderTxt);
    border.setTitleColor(Color.WHITE);
    border.setTitleJustification(TitledBorder.RIGHT);
    border.setTitleFont(border.getTitleFont().deriveFont(14));
    // panel.setBorder(border);
    panel.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            threadLogo.setPausada(!threadLogo.isPausada());
          }
        });
    panel.setBackground(Color.WHITE);
    getContentPane().add(panel);
    super.init();
    threadLogo.setPriority(Thread.MIN_PRIORITY);
    threadLogo.start();
  }
 public void initApplet(final JApplet applet) {
   try {
     final Method method = applet.getClass().getMethod("get", String.class);
     initWorkEnv(applet, method);
     SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
             try {
               installLaf(applet, method);
               initPanel(applet, method);
               createLogDir();
             } catch (Exception ex) {
               ex.printStackTrace();
             }
           }
         });
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
示例#17
0
 private void init(JApplet applet) {
   props = new Properties();
   String langStr = applet.getParameter("lang");
   if (langStr != null) {
     try {
       props.load(Lang.class.getResourceAsStream(this.getPackagePath() + langStr + ".lang"));
     } catch (IOException ex) {
       ex.printStackTrace();
       props = null;
     }
   } else {
     try {
       CustomLog.log("Loading lang = " + this.getPackagePath() + defaultLang + ".lang");
       props.load(Lang.class.getResourceAsStream(this.getPackagePath() + defaultLang + ".lang"));
     } catch (IOException ex) {
       ex.printStackTrace();
       props = null;
     }
   }
 }
  /** Chops up the image into the specified number of pieces */
  public void modify(JApplet applet) {
    String methodName = "modify(JApplet)";
    int imageWidth = (image.getWidth(null) / numFrames);
    if ((imageWidth * numFrames) != image.getWidth(null)) {
      Log.error(
          this,
          methodName,
          "image width of " + image.getWidth(null) + " is not divisible evenly by " + numFrames);
      return;
    }

    int imageHeight = image.getHeight(null);
    int x = 0, y = 0;

    // Slice up the image, and each sliced image is it's own image
    for (int i = 0; (i < numFrames); i++) {
      x = x + (i * imageWidth);
      // Copy the image to a BufferedImage, so we can modify it
      CropImageFilter crop = new CropImageFilter(x, y, imageWidth, imageHeight);
      imageArray[i] = applet.createImage(new FilteredImageSource(image.getSource(), crop));
    }
  }
示例#19
0
  public void paint(Graphics g) {

    super.paint(g);
    // Draws grid pixel map
    for (int i = 0; i <= 400; i += 10) {
      g.drawLine(0, i, 400, i);
      g.drawLine(i, 0, i, 400);
    }
    if (jchkLine.isSelected())
      MidpointLine(
          new Integer(jtfX1.getText()).intValue(),
          new Integer(jtfY1.getText()).intValue(),
          new Integer(jtfX2.getText()).intValue(),
          new Integer(jtfY2.getText()).intValue(),
          g);
    if (jchkCircle.isSelected())
      CircleMid2(
          new Integer(jtfCenterX.getText()).intValue(),
          new Integer(jtfCenterY.getText()).intValue(),
          new Integer(jtfRadius.getText()).intValue(),
          g);
  }
示例#20
0
  /* (non-Javadoc)
   * @see java.applet.Applet#init()
   */
  @Override
  public void init() {
    // TODO Auto-generated method stub
    super.init();
    try {
      SwingUtilities.invokeAndWait(
          new Runnable() {
            public void run() {
              mainPanel = new MainPanel(DevClientApplet.this);
              mainPanel.setOpaque(true);
              setContentPane(mainPanel);

              String codeBase = DevClientApplet.this.getCodeBase().toExternalForm();
              if (codeBase.contains("/devclient"))
                codeBase = codeBase.substring(0, codeBase.lastIndexOf("/devclient") + 1);
              mainPanel.setServer(codeBase);
            }
          });
    } catch (Exception e) {
      System.err.println("createGUI didn't complete successfully: " + e);
      e.printStackTrace(System.err);
    }
  }
示例#21
0
  @Override
  public void start() {
    super.start();

    this.gameScreen = new GameScreen();
    this.gameScreen.setUp(this.panelInViewContainer.getSize());

    switchPanelInView(this.gameScreen);

    Renderer renderer = setRendererUp(gameScreen);
    Composite scene = createScene();

    renderer.setScene(scene);

    Controller controller = new Controller(scene);

    this.sceneController = new SceneController(renderer, controller);
    this.sceneController.setApplet(this);

    this.panelInViewContainer.addMouseListener(controller);

    renderer.start();
    controller.start();
  }
 /* (non-Javadoc)
  * @see java.applet.Applet#destroy()
  */
 @Override
 public void destroy() {
   super.destroy();
   ftpConnector.destory();
 }
 private void playMusic(String nameOfSoundFile) {
   AudioClip sound = JApplet.newAudioClip(getClass().getResource(nameOfSoundFile));
   sound.play();
 }
示例#24
0
 /* (non-Javadoc)
  * @see java.applet.Applet#stop()
  */
 @Override
 public void stop() {
   // TODO Auto-generated method stub
   super.stop();
 }
  /** Inits the layout. */
  private void initLayout() {
    self = this;
    window = JSObject.getWindow(self);
    // fileLocation.setEditable(false);
    fileNameField = new JTextField(25);
    fileNameField.setEditable(false);
    fileNameField.setBackground(Color.WHITE);

    chooseBtn = new JButton();
    chooseBtn.setText(getMessage(MessageCode.FTP_FILE_CHOOSE));

    uploadBtn = new JButton();
    uploadBtn.setText(getMessage(MessageCode.FTP_FILE_UPLOAD));
    uploadBtn.setEnabled(false);

    fileChooser = new JFileChooser();
    fileChooser.setDialogTitle(getMessage(MessageCode.FTP_FILECHOOSER_TITLE));
    fileChooser.setAcceptAllFileFilterUsed(false);

    final boolean filterTypes = StringUtils.isNotBlank(allowTypes);
    final boolean filterMaxSize = maxSize > 0;

    if (filterTypes || filterMaxSize) {
      fileChooser.setFileFilter(
          new FileFilter() {
            @Override
            public String getDescription() {
              return filterTypes
                  ? getMessage(MessageCode.ALLOW_ALL_FILE)
                  : getMessage(MessageCode.ALLOW_SOME_FILE) + allowTypes;
            }

            @Override
            public boolean accept(File f) {

              if (f.isDirectory()) {
                return true;
              }

              boolean flag = true;
              if (filterTypes) {
                flag = false;
                String ext = FilenameUtils.getExtension(f.getName());
                String[] types = StringUtils.split(allowTypes, ",");
                for (String t : types) {
                  if (StringUtils.equalsIgnoreCase(t, ext)) {
                    flag = true;
                    break;
                  }
                }
              }

              if (flag && filterMaxSize) {
                flag = FileUtils.sizeOf(f) <= maxSize;
              }

              return flag;
            }
          });
    }

    progressInfo = new JLabel(getMessage(MessageCode.FTP_UPLOAD_PROGRESS));

    progressBar = new JProgressBar(0, 100);
    progressBar.setPreferredSize(new Dimension(380, 20));
    // progressBar.setString("请选择文件");
    progressBar.setStringPainted(true);
    progressBar.setBorderPainted(true);
    // progressBar.setBackground(Color.gray);
    // progressBar.setForeground(Color.blue);

    progressPanel = new JPanel();
    progressPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    progressPanel.add(progressInfo);
    progressPanel.add(progressBar);
    progressPanel.setBackground(Color.WHITE);
    progressPanel.setVisible(false);

    // main.add(fileLocation);
    selectPanel = new JPanel();
    selectPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    selectPanel.add(fileNameField);
    selectPanel.add(chooseBtn);
    selectPanel.add(uploadBtn);
    selectPanel.setBackground(Color.WHITE);

    GridLayout layout = new GridLayout(2, 1);
    Container container = self.getContentPane();
    container.setLayout(layout);
    container.add(selectPanel);
    container.add(progressPanel);
    container.setBackground(Color.WHITE);
  }
示例#26
0
 /**
  * Call this method to stop the applet from your launcher class <code>MyAppletLauncher.stop()
  * </code> method.
  */
 public void stopApplet() {
   checkApplet();
   logInfo(LogArea.CONFIG, "stopApplet() --> %s.stop()", applet.getClass().getName());
   applet.stop();
 }
示例#27
0
 public void destroy() {
   threadLogo.setMorta(true);
   super.destroy();
 }
示例#28
0
 /**
  * Call this method to destroy the applet from your launcher class <code>
  * MyAppletLauncher.destroy()</code> method.
  */
 public void destroyApplet() {
   checkApplet();
   logInfo(LogArea.CONFIG, "destroyApplet() --> %s.destroy()", applet.getClass().getName());
   applet.destroy();
 }
  /*
   * (non-Javadoc)
   *
   * @see java.awt.Container#paint(java.awt.Graphics)
   */
  @Override
  public final void paint(final Graphics g) {
    super.paint(g);

    g.drawString("The sum is " + sum, 25, 30);
  }
  public ViewerHelper(final JApplet applet) {
    // Create default user preferences with no catalog
    final UserPreferences preferences =
        new UserPreferences() {
          @Override
          public void addLanguageLibrary(String languageLibraryName) throws RecorderException {
            throw new UnsupportedOperationException();
          }

          @Override
          public boolean languageLibraryExists(String languageLibraryName)
              throws RecorderException {
            throw new UnsupportedOperationException();
          }

          @Override
          public void addFurnitureLibrary(String furnitureLibraryName) throws RecorderException {
            throw new UnsupportedOperationException();
          }

          @Override
          public boolean furnitureLibraryExists(String furnitureLibraryName)
              throws RecorderException {
            throw new UnsupportedOperationException();
          }

          @Override
          public boolean texturesLibraryExists(String name) throws RecorderException {
            throw new UnsupportedOperationException();
          }

          @Override
          public void addTexturesLibrary(String name) throws RecorderException {
            throw new UnsupportedOperationException();
          }

          @Override
          public void write() throws RecorderException {
            throw new UnsupportedOperationException();
          }

          @Override
          public boolean isNavigationPanelVisible() {
            return "true".equalsIgnoreCase(applet.getParameter(NAVIGATION_PANEL));
          }
        };

    // Create a view factory able to instantiate only a 3D view and a threaded task view
    final ViewFactory viewFactory =
        new ViewFactory() {
          public View createBackgroundImageWizardStepsView(
              BackgroundImage backgroundImage,
              UserPreferences preferences,
              BackgroundImageWizardController backgroundImageWizardController) {
            throw new UnsupportedOperationException();
          }

          public View createFurnitureCatalogView(
              FurnitureCatalog catalog,
              UserPreferences preferences,
              FurnitureCatalogController furnitureCatalogController) {
            throw new UnsupportedOperationException();
          }

          public View createFurnitureView(
              Home home, UserPreferences preferences, FurnitureController furnitureController) {
            throw new UnsupportedOperationException();
          }

          public HelpView createHelpView(
              UserPreferences preferences, HelpController helpController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createHome3DAttributesView(
              UserPreferences preferences, Home3DAttributesController home3DAttributesController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createHomeFurnitureView(
              UserPreferences preferences, HomeFurnitureController homeFurnitureController) {
            throw new UnsupportedOperationException();
          }

          public HomeView createHomeView(
              Home home, UserPreferences preferences, HomeController homeController) {
            throw new UnsupportedOperationException();
          }

          public ImportedFurnitureWizardStepsView createImportedFurnitureWizardStepsView(
              CatalogPieceOfFurniture piece,
              String modelName,
              boolean importHomePiece,
              UserPreferences preferences,
              ImportedFurnitureWizardController importedFurnitureWizardController) {
            throw new UnsupportedOperationException();
          }

          public View createImportedTextureWizardStepsView(
              CatalogTexture texture,
              String textureName,
              UserPreferences preferences,
              ImportedTextureWizardController importedTextureWizardController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createLabelView(
              boolean modification, UserPreferences preferences, LabelController labelController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createPageSetupView(
              UserPreferences preferences, PageSetupController pageSetupController) {
            throw new UnsupportedOperationException();
          }

          public PlanView createPlanView(
              Home home, UserPreferences preferences, PlanController planController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createPrintPreviewView(
              Home home,
              UserPreferences preferences,
              HomeController homeController,
              PrintPreviewController printPreviewController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createRoomView(
              UserPreferences preferences, RoomController roomController) {
            throw new UnsupportedOperationException();
          }

          public TextureChoiceView createTextureChoiceView(
              UserPreferences preferences, TextureChoiceController textureChoiceController) {
            throw new UnsupportedOperationException();
          }

          public ThreadedTaskView createThreadedTaskView(
              String taskMessage, UserPreferences preferences, ThreadedTaskController controller) {
            return new ThreadedTaskPanel(taskMessage, preferences, controller) {
              private boolean taskRunning;

              public void setTaskRunning(boolean taskRunning, View executingView) {
                if (taskRunning && !this.taskRunning) {
                  // Display task panel directly at applet center if it's empty
                  this.taskRunning = taskRunning;
                  JPanel contentPane = new JPanel(new GridBagLayout());
                  contentPane.add(this, new GridBagConstraints());
                  applet.setContentPane(contentPane);
                  applet.getRootPane().revalidate();
                }
              }
            };
          }

          public DialogView createUserPreferencesView(
              UserPreferences preferences, UserPreferencesController userPreferencesController) {
            throw new UnsupportedOperationException();
          }

          public View createView3D(
              final Home home, UserPreferences preferences, final HomeController3D controller) {
            HomeComponent3D homeComponent3D = new HomeComponent3D(home, preferences, controller);
            // Add tab key to input map to change camera
            InputMap inputMap = homeComponent3D.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
            inputMap.put(KeyStroke.getKeyStroke("SPACE"), "changeCamera");
            ActionMap actionMap = homeComponent3D.getActionMap();
            actionMap.put(
                "changeCamera",
                new AbstractAction() {
                  public void actionPerformed(ActionEvent ev) {
                    if (home.getCamera() == home.getTopCamera()) {
                      controller.viewFromObserver();
                    } else {
                      controller.viewFromTop();
                    }
                  }
                });
            return homeComponent3D;
          }

          public DialogView createWallView(
              UserPreferences preferences, WallController wallController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createWizardView(
              UserPreferences preferences, WizardController wizardController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createPhotoView(
              Home home, UserPreferences preferences, PhotoController photoController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createVideoView(
              Home home, UserPreferences preferences, VideoController videoController) {
            throw new UnsupportedOperationException();
          }

          public DialogView createCompassView(
              UserPreferences preferences, CompassController compassController) {
            throw new UnsupportedOperationException();
          }
        };

    // Force offscreen in 3D view under Plugin 2 and Mac OS X
    System.setProperty(
        "com.eteks.sweethome3d.j3d.useOffScreen3DView",
        String.valueOf(
            OperatingSystem.isMacOSX()
                && applet.getAppletContext() != null
                && applet
                    .getAppletContext()
                    .getClass()
                    .getName()
                    .startsWith("sun.plugin2.applet.Plugin2Manager")));

    initLookAndFeel();

    addComponent3DRenderingErrorObserver(applet.getRootPane(), preferences);

    // Retrieve displayed home
    String homeUrlParameter = applet.getParameter(HOME_URL_PARAMETER);
    if (homeUrlParameter == null) {
      homeUrlParameter = "default.sh3d";
    }
    // Retrieve ignoreCache parameter value
    String ignoreCacheParameter = applet.getParameter(IGNORE_CACHE_PARAMETER);
    final boolean ignoreCache =
        ignoreCacheParameter != null && "true".equalsIgnoreCase(ignoreCacheParameter);
    try {
      final URL homeUrl = new URL(applet.getDocumentBase(), homeUrlParameter);
      // Read home in a threaded task
      Callable<Void> openTask =
          new Callable<Void>() {
            public Void call() throws RecorderException {
              // Read home with application recorder
              Home openedHome = readHome(homeUrl, ignoreCache);
              displayHome(applet.getRootPane(), openedHome, preferences, viewFactory);
              return null;
            }
          };
      ThreadedTaskController.ExceptionHandler exceptionHandler =
          new ThreadedTaskController.ExceptionHandler() {
            public void handleException(Exception ex) {
              if (!(ex instanceof InterruptedRecorderException)) {
                if (ex instanceof RecorderException) {
                  showError(
                      applet.getRootPane(),
                      preferences.getLocalizedString(ViewerHelper.class, "openError", homeUrl));
                } else {
                  ex.printStackTrace();
                }
              }
            }
          };
      new ThreadedTaskController(
              openTask,
              preferences.getLocalizedString(ViewerHelper.class, "openMessage"),
              exceptionHandler,
              null,
              viewFactory)
          .executeTask(null);
    } catch (MalformedURLException ex) {
      showError(
          applet.getRootPane(),
          preferences.getLocalizedString(ViewerHelper.class, "openError", homeUrlParameter));
      return;
    }
  }