List of usage examples for java.awt Desktop browse
public void browse(URI uri) throws IOException
From source file:uk.sipperfly.ui.Exactly.java
private void contactAreaHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_contactAreaHyperlinkUpdate if (HyperlinkEvent.EventType.ACTIVATED.equals(evt.getEventType())) { System.out.println(evt.getURL()); Desktop desktop = Desktop.getDesktop(); try {//from w ww . j a va 2 s. c o m desktop.browse(evt.getURL().toURI()); } catch (Exception ex) { ex.printStackTrace(); } } }
From source file:org.domainmath.gui.MainFrame.java
public static void setPath(String path) { try {//from www . j av a2 s.co m URI uri = new URI(path); Desktop desktop = Desktop.getDesktop(); desktop.browse(uri); } catch (URISyntaxException | IOException ex) { } }
From source file:jeplus.JEPlusFrameMain.java
private void jMenuItemUserGuideActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUserGuideActionPerformed Desktop desktop = null; if (Desktop.isDesktopSupported()) { File file = new File("docs/Users Manual ver" + version + ".html"); try {/*w w w . j ava 2 s . c o m*/ desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.OPEN)) { desktop.open(file); } } catch (Exception ex) { if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) { int res = JOptionPane.showConfirmDialog(this, "<html><p>Online user's guide requires internet access.</p><p>Please click 'Yes' to open it in a browser. </p></html>", "Cannot find User Guide", JOptionPane.YES_NO_OPTION); if (res == JOptionPane.YES_OPTION) { URI uri; try { uri = new URI("http://www.jeplus.org/wiki/doku.php?id=docs:manual" + version_ps); //uri = new URI("http://www.jeplus.org/docs_html/Users%20Manual%20ver" + version + ".html"); desktop.browse(uri); } catch (URISyntaxException | IOException ex1) { JOptionPane.showMessageDialog(this, "http://www.jeplus.org/wiki/doku.php?id=docs:manual" + version_ps + " is not accessible. Please try locate the page manually on the jEPlus website."); } } } else { JOptionPane.showMessageDialog(this, "Cannot find or open " + file.getPath() + ". Please locate the User Guide manually on the jEPlus website."); } } } }
From source file:erigo.ctstream.CTstream.java
/** * Callback for menu items and "run time" controls in controlsPanel. * // w ww.j a v a 2 s. c om * @param eventI The ActionEvent which has occurred. */ @Override public void actionPerformed(ActionEvent eventI) { Object source = eventI.getSource(); if (source == null) { return; } else if (source instanceof JComboBox) { JComboBox<?> fpsCB = (JComboBox<?>) source; framesPerSec = ((Double) fpsCB.getSelectedItem()).doubleValue(); // Even when "change detect" is turned on, we always save an image at a rate which is // the slower of 1.0fps or the current frame rate; this is kind of a "key frame" of // sorts. Because of this, the "change detect" checkbox is meaningless when images/sec // is 1.0 and lower. if (framesPerSec <= 1.0) { changeDetectCheck.setEnabled(false); // A nice side benefit of processing JCheckBox events using an Action listener // is that calling "changeDetectCheck.setSelected(false)" will NOT fire an // event; thus, we maintain our original value of bChangeDetect. changeDetectCheck.setSelected(false); } else { changeDetectCheck.setEnabled(true); changeDetectCheck.setSelected(bChangeDetect); } } else if ((source instanceof JCheckBox) && (((JCheckBox) source) == screencapCheck)) { bScreencap = screencapCheck.isSelected(); if ((writeTask != null) && (writeTask.bIsRunning)) { if (bScreencap) { startScreencapCapture(); } else if (!bScreencap) { stopScreencapCapture(); } } } else if ((source instanceof JCheckBox) && (((JCheckBox) source) == webcamCheck)) { bWebcam = webcamCheck.isSelected(); if ((writeTask != null) && (writeTask.bIsRunning)) { if (bWebcam) { startWebcamCapture(); } else if (!bWebcam) { stopWebcamCapture(); } } } else if ((source instanceof JCheckBox) && (((JCheckBox) source) == audioCheck)) { bAudio = audioCheck.isSelected(); if ((writeTask != null) && (writeTask.bIsRunning)) { if (bAudio) { startAudioCapture(); } else if (!bAudio) { stopAudioCapture(); } } } else if ((source instanceof JCheckBox) && (((JCheckBox) source) == textCheck)) { bText = textCheck.isSelected(); if ((writeTask != null) && (writeTask.bIsRunning)) { if (bText) { startTextCapture(); } else if (!bText) { stopTextCapture(); } } } else if ((source instanceof JCheckBox) && (((JCheckBox) source) == includeMouseCursorCheck)) { if (includeMouseCursorCheck.isSelected()) { bIncludeMouseCursor = true; } else { bIncludeMouseCursor = false; } } else if ((source instanceof JCheckBox) && (((JCheckBox) source) == changeDetectCheck)) { if (changeDetectCheck.isSelected()) { bChangeDetect = true; } else { bChangeDetect = false; } } else if ((source instanceof JCheckBox) && (((JCheckBox) source) == fullScreenCheck)) { if (fullScreenCheck.isSelected()) { bFullScreen = true; // Save the original height guiFrameOrigHeight = guiFrame.getHeight(); // Shrink the GUI down to just controlsPanel Rectangle guiFrameBounds = guiFrame.getBounds(); Rectangle updatedGUIFrameBounds = new Rectangle(guiFrameBounds.x, guiFrameBounds.y, guiFrameBounds.width, controlsPanel.getHeight() + 22); guiFrame.setBounds(updatedGUIFrameBounds); } else { bFullScreen = false; // Expand the GUI to its original height Rectangle guiFrameBounds = guiFrame.getBounds(); int updatedHeight = guiFrameOrigHeight; if (guiFrameOrigHeight == -1) { updatedHeight = controlsPanel.getHeight() + 450; } Rectangle updatedGUIFrameBounds = new Rectangle(guiFrameBounds.x, guiFrameBounds.y, guiFrameBounds.width, updatedHeight); guiFrame.setBounds(updatedGUIFrameBounds); } // To display or not display screencap preview is dependent on whether we are in full screen mode or not. if (screencapStream != null) { screencapStream.updatePreview(); } } else if ((source instanceof JCheckBox) && (((JCheckBox) source) == previewCheck)) { if (previewCheck.isSelected()) { bPreview = true; } else { bPreview = false; } } else if (eventI.getActionCommand().equals("Start")) { // Make sure all needed values have been set String errStr = canCTrun(); if (!errStr.isEmpty()) { JOptionPane.showMessageDialog(guiFrame, errStr, "CTstream settings error", JOptionPane.ERROR_MESSAGE); return; } ((JButton) source).setText("Starting..."); bContinueMode = false; firstCTtime = 0; continueWallclockInitTime = 0; startCapture(); ((JButton) source).setText("Stop"); ((JButton) source).setBackground(Color.RED); continueButton.setEnabled(false); } else if (eventI.getActionCommand().equals("Stop")) { ((JButton) source).setText("Stopping..."); stopCapture(); ((JButton) source).setText("Start"); ((JButton) source).setBackground(Color.GREEN); continueButton.setEnabled(true); } else if (eventI.getActionCommand().equals("Continue")) { // This is just like "Start" except we pick up in time just where we left off bContinueMode = true; firstCTtime = 0; continueWallclockInitTime = 0; startCapture(); startStopButton.setText("Stop"); startStopButton.setBackground(Color.RED); continueButton.setEnabled(false); } else if (eventI.getActionCommand().equals("Settings...")) { boolean bBeenRunning = false; if (startStopButton.getText().equals("Stop")) { bBeenRunning = true; } // Stop capture (if it is running) stopCapture(); startStopButton.setText("Start"); startStopButton.setBackground(Color.GREEN); // Only want to enable the Continue button if the user had in fact been running if (bBeenRunning) { continueButton.setEnabled(true); } // Let user edit settings; the following function will not // return until the user clicks the OK or Cancel button. ctSettings.popupSettingsDialog(); } else if (eventI.getActionCommand().equals("Launch CTweb server...")) { // Pop up dialog to launch the CTweb server new LaunchCTweb(this, guiFrame); } else if (eventI.getActionCommand().equals("CloudTurbine website") || eventI.getActionCommand().equals("View data")) { if (!Desktop.isDesktopSupported()) { System.err.println("\nNot able to launch URL in a browser window, feature not supported."); return; } Desktop desktop = Desktop.getDesktop(); String urlStr = "http://cloudturbine.com"; if (eventI.getActionCommand().equals("View data")) { // v=1 specifies to view 1 sec of data // y=4 specifies 4 grids in y-direction // n=X specifies the number of channels // Setup the channel list String chanListStr = ""; int chanIdx = 0; NumberFormat formatter = new DecimalFormat("00"); if (bWebcam) { chanListStr = chanListStr + "&p" + formatter.format(chanIdx * 10) + "=" + sourceName + "/" + webcamStreamName; ++chanIdx; } if (bAudio) { chanListStr = chanListStr + "&p" + formatter.format(chanIdx * 10) + "=" + sourceName + "/" + audioStreamName; ++chanIdx; } if (bScreencap) { chanListStr = chanListStr + "&p" + formatter.format(chanIdx * 10) + "=" + sourceName + "/" + screencapStreamName; ++chanIdx; } if (bText) { chanListStr = chanListStr + "&p" + formatter.format(chanIdx * 10) + "=" + sourceName + "/" + textStreamName; ++chanIdx; } if (chanIdx == 0) { urlStr = "http://localhost:" + Integer.toString(webScanPort); } else { urlStr = "http://localhost:" + Integer.toString(webScanPort) + "/?dt=1000&c=0&f=false&sm=false&y=4&n=" + Integer.toString(chanIdx) + "&v=1" + chanListStr; } } URI uri = null; try { uri = new URI(urlStr); } catch (URISyntaxException e) { System.err.println("\nURISyntaxException:\n" + e); return; } try { desktop.browse(uri); } catch (IOException e) { System.err.println("\nCaught IOException trying to go to " + urlStr + ":\n" + e); } } else if (eventI.getActionCommand().equals("Exit")) { exit(false); } }
From source file:xtrememp.XtremeMP.java
@Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source == openMenuItem) { playlistManager.addFilesDialog(true); } else if (source == openURLMenuItem) { String url = JOptionPane.showInputDialog(mainFrame, tr("Dialog.OpenURL.Message"), tr("Dialog.OpenURL"), JOptionPane.INFORMATION_MESSAGE); if (url != null && Utilities.startWithProtocol(url)) { boolean isPlaylistFile = false; for (String ext : PlaylistFileFilter.PlaylistFileExt) { if (url.endsWith(ext)) { isPlaylistFile = true; }//from w w w.j ava2 s . c o m } if (isPlaylistFile) { playlistManager.clearPlaylist(); playlistManager.loadPlaylist(url); playlist.begin(); } else { PlaylistItem newPli = new PlaylistItem(url, url, -1, false); playlistManager.add(newPli); playlist.setCursor(newPli); } acOpenAndPlay(); } } else if (source == openPlaylistMenuItem) { playlistManager.openPlaylistDialog(); } else if (source == savePlaylistMenuItem) { playlistManager.savePlaylistDialog(); } else if (source == preferencesMenuItem) { PreferencesDialog preferencesDialog = new PreferencesDialog(audioPlayer, this); preferencesDialog.setVisible(true); } else if (source == exitMenuItem) { exit(); } else if (source == playPauseMenuItem || source == playPauseButton) { acPlayPause(); } else if (source == previousMenuItem || source == previousButton) { acPrevious(); } else if (source == nextMenuItem || source == nextButton) { acNext(); } else if (source == randomizePlaylistMenuItem) { playlistManager.randomizePlaylist(); } else if (source == stopMenuItem || source == stopButton) { acStop(); } else if (source == playlistManagerMenuItem) { if (visualizationManager.isVisible()) { visualizationManager.setDssEnabled(false); CardLayout cardLayout = (CardLayout) (mainPanel.getLayout()); cardLayout.show(mainPanel, Utilities.PLAYLIST_MANAGER); playlistManagerMenuItem.setSelected(true); Settings.setLastView(Utilities.PLAYLIST_MANAGER); } } else if (source == visualizationMenuItem) { if (playlistManager.isVisible()) { visualizationManager.setDssEnabled(true); CardLayout cardLayout = (CardLayout) (mainPanel.getLayout()); cardLayout.show(mainPanel, Utilities.VISUALIZATION_PANEL); visualizationMenuItem.setSelected(true); Settings.setLastView(Utilities.VISUALIZATION_PANEL); } } else if (source == updateMenuItem) { SoftwareUpdate.checkForUpdates(true); SoftwareUpdate.showCheckForUpdatesDialog(); } else if (source == aboutMenuItem) { Object[] options = { tr("Button.Close") }; Desktop desktop = null; if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.BROWSE)) { options = new Object[] { tr("Button.Close"), tr("Button.Website") }; } } StringBuffer message = new StringBuffer(); message.append("<html><b><font color='red' size='5'>").append(tr("Application.title")); message.append("</font></b><br>").append(tr("Application.description")); message.append("<br>Copyright 2005-2014 The Xtreme Media Player Project"); message.append("<br><br><b>").append(tr("Dialog.About.Authors")).append(": </b>") .append(tr("Application.authors")); message.append("<br><b>").append(tr("Dialog.About.Version")).append(": </b>").append(currentVersion); message.append("<br><b>").append(tr("Dialog.About.Codename")).append(": </b>") .append(currentVersion.getCodename()); message.append("<br><b>").append(tr("Dialog.About.ReleaseDate")).append(": </b>") .append(currentVersion.getReleaseDate()); message.append("<br><b>").append(tr("Dialog.About.Homepage")).append(": </b>") .append(tr("Application.homepage")); message.append("<br><br><b>").append(tr("Dialog.About.JavaVersion")).append(": </b>") .append(System.getProperty("java.version")); message.append("<br><b>").append(tr("Dialog.About.JavaVendor")).append(": </b>") .append(System.getProperty("java.vendor")); message.append("<br><b>").append(tr("Dialog.About.JavaHome")).append(": </b>") .append(System.getProperty("java.home")); message.append("<br><b>").append(tr("Dialog.About.OSName")).append(": </b>") .append(System.getProperty("os.name")); message.append("<br><b>").append(tr("Dialog.About.OSArch")).append(": </b>") .append(System.getProperty("os.arch")); message.append("<br><b>").append(tr("Dialog.About.UserName")).append(": </b>") .append(System.getProperty("user.name")); message.append("<br><b>").append(tr("Dialog.About.UserHome")).append(": </b>") .append(System.getProperty("user.home")); message.append("<br><b>").append(tr("Dialog.About.UserDir")).append(": </b>") .append(System.getProperty("user.dir")); message.append("</html>"); int n = JOptionPane.showOptionDialog(mainFrame, message, tr("Dialog.About"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, Utilities.APP_256_ICON, options, options[0]); if (n == 1 && desktop != null) { try { URL url = new URL(tr("Application.homepage")); desktop.browse(url.toURI()); } catch (IOException | URISyntaxException ex) { logger.error(ex.getMessage(), ex); } } } else if (source.equals(playModeRepeatNoneMenuItem)) { playlist.setPlayMode(Playlist.PlayMode.REPEAT_NONE); } else if (source.equals(playModeRepeatOneMenuItem)) { playlist.setPlayMode(Playlist.PlayMode.REPEAT_ONE); } else if (source.equals(playModeRepeatAllMenuItem)) { playlist.setPlayMode(Playlist.PlayMode.REPEAT_ALL); } else if (source.equals(playModeShuffleMenuItem)) { playlist.setPlayMode(Playlist.PlayMode.SHUFFLE); } }
From source file:editeurpanovisu.EditeurPanovisu.java
private void genereVisite() throws IOException { if (!repertSauveChoisi) { repertoireProjet = currentDir;//from w ww . j av a 2 s . c o m } if (!dejaSauve) { projetSauve(); } if (dejaSauve) { deleteDirectory(repertTemp + "/panovisu/images"); File imagesRepert = new File(repertTemp + "/panovisu/images"); if (!imagesRepert.exists()) { imagesRepert.mkdirs(); } File boutonRepert = new File(repertTemp + "/panovisu/images/navigation"); if (!boutonRepert.exists()) { boutonRepert.mkdirs(); } File boussoleRepert = new File(repertTemp + "/panovisu/images/boussoles"); if (!boussoleRepert.exists()) { boussoleRepert.mkdirs(); } copieDirectory(repertAppli + File.separator + "panovisu/images/boussoles", boussoleRepert.getAbsolutePath()); File planRepert = new File(repertTemp + "/panovisu/images/plan"); if (!planRepert.exists()) { planRepert.mkdirs(); } copieDirectory(repertAppli + File.separator + "panovisu/images/plan", planRepert.getAbsolutePath()); File reseauRepert = new File(repertTemp + "/panovisu/images/reseaux"); if (!reseauRepert.exists()) { reseauRepert.mkdirs(); } copieDirectory(repertAppli + File.separator + "panovisu/images/reseaux", reseauRepert.getAbsolutePath()); File interfaceRepert = new File(repertTemp + "/panovisu/images/interface"); if (!interfaceRepert.exists()) { interfaceRepert.mkdirs(); } copieDirectory(repertAppli + File.separator + "panovisu/images/interface", interfaceRepert.getAbsolutePath()); File MARepert = new File(repertTemp + "/panovisu/images/MA"); if (!MARepert.exists()) { MARepert.mkdirs(); } File hotspotsRepert = new File(repertTemp + "/panovisu/images/hotspots"); if (!hotspotsRepert.exists()) { hotspotsRepert.mkdirs(); } copieFichierRepertoire(repertAppli + File.separator + "panovisu" + File.separator + "images" + File.separator + "aide_souris.png", repertTemp + "/panovisu/images"); copieFichierRepertoire(repertAppli + File.separator + "panovisu" + File.separator + "images" + File.separator + "fermer.png", repertTemp + "/panovisu/images"); copieFichierRepertoire(repertAppli + File.separator + "panovisu" + File.separator + "images" + File.separator + "precedent.png", repertTemp + "/panovisu/images"); copieFichierRepertoire(repertAppli + File.separator + "panovisu" + File.separator + "images" + File.separator + "suivant.png", repertTemp + "/panovisu/images"); for (int i = 0; i < gestionnaireInterface.nombreImagesBouton - 1; i++) { ReadWriteImage.writePng(gestionnaireInterface.nouveauxBoutons[i], boutonRepert.getAbsolutePath() + File.separator + gestionnaireInterface.nomImagesBoutons[i], false, 0.f); } ReadWriteImage.writePng( gestionnaireInterface.nouveauxBoutons[gestionnaireInterface.nombreImagesBouton - 1], hotspotsRepert.getAbsolutePath() + File.separator + "hotspot.png", false, 0.f); ReadWriteImage.writePng(gestionnaireInterface.nouveauxBoutons[gestionnaireInterface.nombreImagesBouton], hotspotsRepert.getAbsolutePath() + File.separator + "hotspotImage.png", false, 0.f); ReadWriteImage.writePng(gestionnaireInterface.nouveauxMasque, MARepert.getAbsolutePath() + File.separator + "MA.png", false, 0.f); File xmlRepert = new File(repertTemp + File.separator + "xml"); if (!xmlRepert.exists()) { xmlRepert.mkdirs(); } File cssRepert = new File(repertTemp + File.separator + "css"); if (!cssRepert.exists()) { cssRepert.mkdirs(); } File jsRepert = new File(repertTemp + File.separator + "js"); if (!jsRepert.exists()) { jsRepert.mkdirs(); } String contenuFichier; File xmlFile; String chargeImages = ""; for (int i = 0; i < nombrePanoramiques; i++) { String fPano = "panos/" + panoramiquesProjet[i].getNomFichier() .substring(panoramiquesProjet[i].getNomFichier().lastIndexOf(File.separator) + 1, panoramiquesProjet[i].getNomFichier().length()) .split("\\.")[0]; if (panoramiquesProjet[i].getTypePanoramique().equals(Panoramique.CUBE)) { fPano = fPano.substring(0, fPano.length() - 2); chargeImages += " images[" + i + "]=\"" + fPano + "_f.jpg\"\n"; chargeImages += " images[" + i + "]=\"" + fPano + "_b.jpg\"\n"; chargeImages += " images[" + i + "]=\"" + fPano + "_u.jpg\"\n"; chargeImages += " images[" + i + "]=\"" + fPano + "_d.jpg\"\n"; chargeImages += " images[" + i + "]=\"" + fPano + "_r.jpg\"\n"; chargeImages += " images[" + i + "]=\"" + fPano + "_l.jpg\"\n"; } else { chargeImages += " images[" + i + "]=\"" + fPano + ".jpg\"\n"; } String affInfo = (panoramiquesProjet[i].isAfficheInfo()) ? "oui" : "non"; String affTitre = (gestionnaireInterface.bAfficheTitre) ? "oui" : "non"; double regX; double zN; if (panoramiquesProjet[i].getTypePanoramique().equals(Panoramique.SPHERE)) { regX = Math.round(((panoramiquesProjet[i].getLookAtX() - 180) % 360) * 10) / 10; zN = Math.round(((panoramiquesProjet[i].getZeroNord() - 180) % 360) * 10) / 10; } else { regX = Math.round(((panoramiquesProjet[i].getLookAtX() + 90) % 360) * 10) / 10; zN = Math.round(((panoramiquesProjet[i].getZeroNord() + 90) % 360) * 10) / 10; } int rouge = (int) (Color.valueOf(gestionnaireInterface.couleurDiaporama).getRed() * 255.d); int bleu = (int) (Color.valueOf(gestionnaireInterface.couleurDiaporama).getBlue() * 255.d); int vert = (int) (Color.valueOf(gestionnaireInterface.couleurDiaporama).getGreen() * 255.d); String coulDiapo = "rgba(" + rouge + "," + vert + "," + bleu + "," + gestionnaireInterface.diaporamaOpacite + ")"; Color coulTitre = Color.valueOf(gestionnaireInterface.couleurFondTitre); rouge = (int) (coulTitre.getRed() * 255.d); bleu = (int) (coulTitre.getBlue() * 255.d); vert = (int) (coulTitre.getGreen() * 255.d); String coulFondTitre = "rgba(" + rouge + "," + vert + "," + bleu + "," + gestionnaireInterface.titreOpacite + ")"; contenuFichier = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!--\n" + " Visite gnre par l'diteur panoVisu \n" + "\n" + " Cration L.LANG le monde 360 : http://lemondea360.fr\n" + "-->\n" + "\n" + "\n" + "<scene>\n" + " <pano \n" + " image=\"" + fPano + "\"\n" + " titre=\"" + panoramiquesProjet[i].getTitrePanoramique() + "\"\n" + " titrePolice=\"" + gestionnaireInterface.titrePoliceNom + "\"\n" + " titreTaillePolice=\"" + Math.round(Double.parseDouble(gestionnaireInterface.titrePoliceTaille)) + "px\"\n" + " titreTaille=\"" + Math.round(gestionnaireInterface.titreTaille) + "%\"\n" + " titreFond=\"" + coulFondTitre + "\"\n" + " titreCouleur=\"" + gestionnaireInterface.couleurTitre + "\"\n" // + " titreOpacite=\"" + gestionnaireInterface.titreOpacite + "\"\n" + " diaporamaCouleur=\"" + coulDiapo + "\"\n" + " type=\"" + panoramiquesProjet[i].getTypePanoramique() + "\"\n" + " multiReso=\"oui\"\n" + " nombreNiveaux=\"" + panoramiquesProjet[i].getNombreNiveaux() + "\"\n" + " zeroNord=\"" + zN + "\"\n" + " regardX=\"" + regX + "\"\n" + " regardY=\"" + Math.round(panoramiquesProjet[i].getLookAtY() * 10) / 10 + "\"\n" + " affinfo=\"" + affInfo + "\"\n" + " afftitre=\"" + affTitre + "\"\n" + " />\n" + " <!--Dfinition de la Barre de navigation-->\n" + " <boutons \n" + " styleBoutons=\"navigation\"\n" + " couleur=\"rgba(255,255,255,0)\"\n" + " bordure=\"rgba(255,255,255,0)\"\n" + " deplacements=\"" + gestionnaireInterface.toggleBarreDeplacements + "\" \n" + " zoom=\"" + gestionnaireInterface.toggleBarreZoom + "\" \n" + " outils=\"" + gestionnaireInterface.toggleBarreOutils + "\"\n" + " fs=\"" + gestionnaireInterface.toggleBoutonFS + "\" \n" + " souris=\"" + gestionnaireInterface.toggleBoutonSouris + "\" \n" + " rotation=\"" + gestionnaireInterface.toggleBoutonRotation + "\" \n" + " positionX=\"" + gestionnaireInterface.positionBarre.split(":")[1] + "\"\n" + " positionY=\"" + gestionnaireInterface.positionBarre.split(":")[0] + "\" \n" + " dX=\"" + gestionnaireInterface.dXBarre + "\" \n" + " dY=\"" + gestionnaireInterface.dYBarre + "\"\n" + " espacement=\"" + Math.round(gestionnaireInterface.espacementBoutons) + "\"\n" + " visible=\"" + gestionnaireInterface.toggleBarreVisibilite + "\"\n" + " />\n"; if (gestionnaireInterface.bAfficheBoussole) { String SAiguille = (gestionnaireInterface.bAiguilleMobileBoussole) ? "oui" : "non"; contenuFichier += "<!-- Boussole -->\n" + " <boussole \n" + " affiche=\"oui\"\n" + " image=\"" + gestionnaireInterface.imageBoussole + "\"\n" + " taille=\"" + gestionnaireInterface.tailleBoussole + "\"\n" + " positionY=\"" + gestionnaireInterface.positionBoussole.split(":")[0] + "\"\n" + " positionX=\"" + gestionnaireInterface.positionBoussole.split(":")[1] + "\"\n" + " opacite=\"" + gestionnaireInterface.opaciteBoussole + "\"\n" + " dX=\"" + gestionnaireInterface.dXBoussole + "\"\n" + " dY=\"" + gestionnaireInterface.dYBoussole + "\"\n" + " aiguille=\"" + SAiguille + "\"\n" + " />\n"; } if (gestionnaireInterface.bAfficheMenuContextuel) { String SPrecSuiv = (gestionnaireInterface.bAffichePrecSuivMC) ? "oui" : "non"; String SPlanet = (gestionnaireInterface.bAffichePlanetNormalMC) ? "oui" : "non"; String SPers1 = (gestionnaireInterface.bAffichePersMC1) ? "oui" : "non"; String SPers2 = (gestionnaireInterface.bAffichePersMC2) ? "oui" : "non"; contenuFichier += "<!-- MenuContextuel -->\n" + " <menuContextuel \n" + " affiche=\"oui\"\n" + " precSuiv=\"" + SPrecSuiv + "\"\n" + " planete=\"" + SPlanet + "\"\n" + " pers1=\"" + SPers1 + "\"\n" + " lib1=\"" + gestionnaireInterface.stPersLib1 + "\"\n" + " url1=\"" + gestionnaireInterface.stPersURL1 + "\"\n" + " pers2=\"" + SPers2 + "\"\n" + " lib2=\"" + gestionnaireInterface.stPersLib2 + "\"\n" + " url2=\"" + gestionnaireInterface.stPersURL2 + "\"\n" + " />\n"; } if (gestionnaireInterface.bSuivantPrecedent) { int panoPrecedent = (i == nombrePanoramiques - 1) ? 0 : i + 1; int panoSuivant = (i == 0) ? nombrePanoramiques - 1 : i - 1; String nomPano = panoramiquesProjet[panoSuivant].getNomFichier(); String strPanoSuivant = "xml/" + nomPano.substring(nomPano.lastIndexOf(File.separator) + 1, nomPano.lastIndexOf(".")) + ".xml"; nomPano = panoramiquesProjet[panoPrecedent].getNomFichier(); String strPanoPrecedent = "xml/" + nomPano.substring(nomPano.lastIndexOf(File.separator) + 1, nomPano.lastIndexOf(".")) + ".xml"; contenuFichier += "<!-- Bouton Suivant Precedent -->\n" + " <suivantPrecedent\n" + " suivant=\"" + strPanoSuivant + "\" \n" + " precedent=\"" + strPanoPrecedent + "\" \n" + " /> \n" + ""; } if (gestionnaireInterface.bAfficheMasque) { String SNavigation = (gestionnaireInterface.bMasqueNavigation) ? "oui" : "non"; String SBoussole = (gestionnaireInterface.bMasqueBoussole) ? "oui" : "non"; String STitre = (gestionnaireInterface.bMasqueTitre) ? "oui" : "non"; String splan = (gestionnaireInterface.bMasquePlan) ? "oui" : "non"; String SReseaux = (gestionnaireInterface.bMasqueReseaux) ? "oui" : "non"; String SVignettes = (gestionnaireInterface.bMasqueVignettes) ? "oui" : "non"; contenuFichier += "<!-- Bouton de Masquage -->\n" + " <marcheArret \n" + " affiche=\"oui\"\n" + " image=\"MA.png\"\n" + " taille=\"" + gestionnaireInterface.tailleMasque + "\"\n" + " positionY=\"" + gestionnaireInterface.positionMasque.split(":")[0] + "\"\n" + " positionX=\"" + gestionnaireInterface.positionMasque.split(":")[1] + "\"\n" + " opacite=\"" + gestionnaireInterface.opaciteMasque + "\"\n" + " dX=\"" + gestionnaireInterface.dXMasque + "\"\n" + " dy=\"" + gestionnaireInterface.dYMasque + "\"\n" + " navigation=\"" + SNavigation + "\"\n" + " boussole=\"" + SBoussole + "\"\n" + " titre=\"" + STitre + "\"\n" + " plan=\"" + splan + "\"\n" + " reseaux=\"" + SReseaux + "\"\n" + " vignettes=\"" + SVignettes + "\"\n" + " />\n"; } if (gestionnaireInterface.bAfficheReseauxSociaux) { String STwitter = (gestionnaireInterface.bReseauxSociauxTwitter) ? "oui" : "non"; String SGoogle = (gestionnaireInterface.bReseauxSociauxGoogle) ? "oui" : "non"; String SFacebook = (gestionnaireInterface.bReseauxSociauxFacebook) ? "oui" : "non"; String SEmail = (gestionnaireInterface.bReseauxSociauxEmail) ? "oui" : "non"; contenuFichier += "<!-- Rseaux Sociaux -->\n" + " <reseauxSociaux \n" + " affiche=\"oui\"\n" + " taille=\"" + gestionnaireInterface.tailleReseauxSociaux + "\"\n" + " positionY=\"" + gestionnaireInterface.positionReseauxSociaux.split(":")[0] + "\"\n" + " positionX=\"" + gestionnaireInterface.positionReseauxSociaux.split(":")[1] + "\"\n" + " opacite=\"" + gestionnaireInterface.opaciteReseauxSociaux + "\"\n" + " dX=\"" + gestionnaireInterface.dXReseauxSociaux + "\"\n" + " dY=\"" + gestionnaireInterface.dYReseauxSociaux + "\"\n" + " twitter=\"" + STwitter + "\"\n" + " google=\"" + SGoogle + "\"\n" + " facebook=\"" + SFacebook + "\"\n" + " email=\"" + SEmail + "\"\n" + " />\n"; } if (gestionnaireInterface.bAfficheVignettes) { String SAfficheVignettes = (gestionnaireInterface.bAfficheVignettes) ? "oui" : "non"; contenuFichier += "<!-- Barre des vignettes -->" + " <vignettes \n" + " affiche=\"" + SAfficheVignettes + "\"\n" + " tailleImage=\"" + gestionnaireInterface.tailleImageVignettes + "\"\n" + " fondCouleur=\"" + gestionnaireInterface.couleurFondVignettes + "\"\n" + " texteCouleur=\"" + gestionnaireInterface.couleurTexteVignettes + "\"\n" + " opacite=\"" + gestionnaireInterface.opaciteVignettes + "\"\n" + " position=\"" + gestionnaireInterface.positionVignettes + "\"\n" + " >\n"; for (int j = 0; j < nombrePanoramiques; j++) { String nomPano = panoramiquesProjet[j].getNomFichier(); String nFichier = nomPano.substring(nomPano.lastIndexOf(File.separator) + 1, nomPano.lastIndexOf(".")) + "Vignette.jpg"; String nXML = nomPano.substring(nomPano.lastIndexOf(File.separator) + 1, nomPano.lastIndexOf(".")) + ".xml"; ReadWriteImage.writeJpeg(panoramiquesProjet[j].getVignettePanoramique(), repertTemp + "/panos/" + nFichier, 1.0f, false, 0.0f); contenuFichier += " <imageVignette \n" + " image=\"panos/" + nFichier + "\"\n" + " xml=\"xml/" + nXML + "\"\n" + " />\n"; } contenuFichier += " </vignettes> \n" + ""; } contenuFichier += " <!--Dfinition des hotspots--> \n" + " <hotspots>\n"; for (int j = 0; j < panoramiquesProjet[i].getNombreHotspots(); j++) { HotSpot HS = panoramiquesProjet[i].getHotspot(j); double longit; if (panoramiquesProjet[i].getTypePanoramique().equals(Panoramique.SPHERE)) { longit = HS.getLongitude() - 180; } else { longit = HS.getLongitude() + 90; } String txtAnime = (HS.isAnime()) ? "true" : "false"; contenuFichier += " <point \n" + " type=\"panoramique\"\n" + " long=\"" + longit + "\"\n" + " lat=\"" + HS.getLatitude() + "\"\n" + " image=\"panovisu/images/hotspots/hotspot.png\"\n" + " xml=\"xml/" + HS.getFichierXML() + "\"\n" + " info=\"" + HS.getInfo() + "\"\n" + " anime=\"" + txtAnime + "\"\n" + " />\n"; } for (int j = 0; j < panoramiquesProjet[i].getNombreHotspotImage(); j++) { HotspotImage HS = panoramiquesProjet[i].getHotspotImage(j); double longit; if (panoramiquesProjet[i].getTypePanoramique().equals(Panoramique.SPHERE)) { longit = HS.getLongitude() - 180; } else { longit = HS.getLongitude() + 90; } String txtAnime = (HS.isAnime()) ? "true" : "false"; contenuFichier += " <point \n" + " type=\"image\"\n" + " long=\"" + longit + "\"\n" + " lat=\"" + HS.getLatitude() + "\"\n" + " image=\"panovisu/images/hotspots/hotspotImage.png\"\n" + " img=\"images/" + HS.getLienImg() + "\"\n" + " info=\"" + HS.getInfo() + "\"\n" + " anime=\"" + txtAnime + "\"\n" + " />\n"; } contenuFichier += " </hotspots>\n"; contenuFichier += "\n" + "<!-- Dfinition des images de fond -->\n" + "\n"; if (gestionnaireInterface.nombreImagesFond > 0) { for (int ii = 0; ii < gestionnaireInterface.nombreImagesFond; ii++) { ImageFond imgFond = gestionnaireInterface.imagesFond[ii]; String strImgFond = "images/" + imgFond.getFichierImage().substring( imgFond.getFichierImage().lastIndexOf(File.separator) + 1, imgFond.getFichierImage().length()); String SMasquable = (imgFond.isMasquable()) ? "oui" : "non"; contenuFichier += " <imageFond\n" + " fichier=\"" + strImgFond + "\"\n" + " posX=\"" + imgFond.getPosX() + "\" \n" + " posY=\"" + imgFond.getPosY() + "\" \n" + " offsetX=\"" + imgFond.getOffsetX() + "\" \n" + " offsetY=\"" + imgFond.getOffsetY() + "\" \n" + " tailleX=\"" + imgFond.getTailleX() + "\" \n" + " tailleY=\"" + imgFond.getTailleY() + "\" \n" + " opacite=\"" + imgFond.getOpacite() + "\" \n" + " masquable=\"" + SMasquable + "\" \n" + " url=\"" + imgFond.getUrl() + "\" \n" + " infobulle=\"" + imgFond.getInfobulle() + "\" \n" + " />\n" + ""; } } if (gestionnaireInterface.bAffichePlan && panoramiquesProjet[i].isAffichePlan()) { int numPlan = panoramiquesProjet[i].getNumeroPlan(); Plan planPano = plans[numPlan]; rouge = (int) (gestionnaireInterface.couleurFondPlan.getRed() * 255.d); bleu = (int) (gestionnaireInterface.couleurFondPlan.getBlue() * 255.d); vert = (int) (gestionnaireInterface.couleurFondPlan.getGreen() * 255.d); String SAfficheRadar = (gestionnaireInterface.bAfficheRadar) ? "oui" : "non"; String coulFond = "rgba(" + rouge + "," + vert + "," + bleu + "," + gestionnaireInterface.opacitePlan + ")"; contenuFichier += " <plan\n" + " affiche=\"oui\" \n" + " image=\"images/" + planPano.getImagePlan() + "\"\n" + " largeur=\"" + gestionnaireInterface.largeurPlan + "\"\n" + " position=\"" + gestionnaireInterface.positionPlan + "\"\n" + " couleurFond=\"" + coulFond + "\"\n" + " couleurTexte=\"#" + gestionnaireInterface.txtCouleurTextePlan + "\"\n" + " nord=\"" + planPano.getDirectionNord() + "\"\n" + " boussolePosition=\"" + planPano.getPosition() + "\"\n" + " boussoleX=\"" + planPano.getPositionX() + "\"\n" + " boussoleY=\"" + planPano.getPositionX() + "\"\n" + " radarAffiche=\"" + SAfficheRadar + "\"\n" + " radarTaille=\"" + Math.round(gestionnaireInterface.tailleRadar) + "\"\n" + " radarCouleurFond=\"#" + gestionnaireInterface.txtCouleurFondRadar + "\"\n" + " radarCouleurLigne=\"#" + gestionnaireInterface.txtCouleurLigneRadar + "\"\n" + " radarOpacite=\"" + Math.round(gestionnaireInterface.opaciteRadar * 100.d) / 100.d + "\"\n" + " >\n"; for (int iPoint = 0; iPoint < planPano.getNombreHotspots(); iPoint++) { double posX = planPano.getHotspot(iPoint).getLongitude() * gestionnaireInterface.largeurPlan; double posY = planPano.getHotspot(iPoint).getLatitude() * planPano.getHauteurPlan() * gestionnaireInterface.largeurPlan / planPano.getLargeurPlan(); if (planPano.getHotspot(iPoint).getNumeroPano() == i) { contenuFichier += " <pointPlan\n" + " positX=\"" + posX + "\"\n" + " positY=\"" + posY + "\"\n" + " xml=\"actif\"\n" + " /> \n"; } else { contenuFichier += " <pointPlan\n" + " positX=\"" + posX + "\"\n" + " positY=\"" + posY + "\"\n" + " xml=\"xml/" + planPano.getHotspot(iPoint).getFichierXML() + "\"\n" + " texte=\"" + planPano.getHotspot(iPoint).getInfo() + "\"\n" + " /> \n"; } } contenuFichier += " </plan>\n"; } contenuFichier += "</scene>\n"; String fichierPano = panoramiquesProjet[i].getNomFichier(); String nomXMLFile = fichierPano .substring(fichierPano.lastIndexOf(File.separator) + 1, fichierPano.length()) .split("\\.")[0] + ".xml"; xmlFile = new File(xmlRepert + File.separator + nomXMLFile); xmlFile.setWritable(true); FileWriter fw = new FileWriter(xmlFile); try (BufferedWriter bw = new BufferedWriter(fw)) { bw.write(contenuFichier); } } Dimension tailleEcran = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); int hauteur = (int) tailleEcran.getHeight() - 200; String titreVis = "Panovisu - visualiseur 100% html5 (three.js)"; TextArea tfVisite = (TextArea) paneChoixPanoramique.lookup("#titreVisite"); if (!tfVisite.getText().equals("")) { titreVis = tfVisite.getText() + " - " + titreVis; } String fPano1 = "panos/niveau0/" + panoramiquesProjet[0].getNomFichier().substring( panoramiquesProjet[0].getNomFichier().lastIndexOf(File.separator) + 1, panoramiquesProjet[0].getNomFichier().length()); String fichierHTML = "<!DOCTYPE html>\n" + "<html lang=\"fr\">\n" + " <head>\n" + " <title>" + titreVis + "</title>\n" + " <meta charset=\"utf-8\">\n" + " <meta name=\"viewport\" content=\"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0\">\n" + " <link rel=\"stylesheet\" media=\"screen\" href=\"panovisu/libs/jqueryMenu/jquery.contextMenu.css\" type=\"text/css\"/>\n" + " <meta property=\"og:title\" content=\"" + titreVis + "\" />\n" + " <meta property=\"og:description\" content=\"Une page cre avec panoVisu Editeur : 100% Libre 100% HTML5\" />\n" + " <meta property=\"og:image\" content=\"" + fPano1 + "\" />" + " </head>\n" + " <body>\n" + " <header>\n" + "\n" + " </header>\n" + " <article style=\"height : " + hauteur + "px;\">\n" + " <div id=\"pano\">\n" + " </div>\n" + " </article>\n" + " <script src=\"panovisu/panovisuInit.js\"></script>\n" + " <script src=\"panovisu/panovisu.js\"></script>\n" + " <script>\n" + "\n" + " $(function() {\n" + " $(window).resize(function(){\n" + " $(\"article\").height($(window).height()-10);\n" + " $(\"#pano\").height($(window).height()-10);\n" + " })\n" + " $(\"article\").height($(window).height()-10);\n" + " $(\"#pano\").height($(window).height()-10);\n" + " ajoutePano({\n" + " langue : \"" + locale.toString() + "\",\n" + " panoramique: \"pano\",\n" + " minFOV: 35,\n" + " maxFOV: 120,\n" + " fenX: \"100%\",\n" + " fenY: \"100%\",\n" + " xml: \"xml/PANO.xml\"\n" + " });\n" + " $(\".reseauSocial-twitter\").on(\"click\", function() {\n" + " window.open(\n" + " \"https://twitter.com/share?url=\" + document.location.href\n" + " );\n" + " return false;\n" + " });\n" + " $(\".reseauSocial-fb\").on(\"click\", function() {\n" + " window.open(\n" + " \"http://www.facebook.com/share.php?u=\" + document.location.href\n" + " );\n" + " return false;\n" + " });\n" + " $(\".reseauSocial-google\").on(\"click\", function() {\n" + " window.open(\n" + " \"https://plus.google.com/share?url=\" + document.location.href + \"&hl=fr\"\n" + " );\n" + " return false;\n" + " });\n" + " $(\".reseauSocial-email\").attr(\"href\",\"mailto:?body=\" + document.location.href + \"&hl=fr\");\n" // + " images=new Array();\n" // + chargeImages // + " prechargeImages(images); \n \n" + " });\n" + " </script>\n" + " </body>\n" + "</html>\n"; if (panoEntree.equals("")) { fichierHTML = fichierHTML .replace("PANO", panoramiquesProjet[0].getNomFichier() .substring(panoramiquesProjet[0].getNomFichier().lastIndexOf(File.separator) + 1, panoramiquesProjet[0].getNomFichier().length()) .split("\\.")[0]); } else { fichierHTML = fichierHTML.replace("PANO", panoEntree); } File fichIndexHTML = new File(repertTemp + File.separator + "index.html"); fichIndexHTML.setWritable(true); FileWriter fw1 = new FileWriter(fichIndexHTML); try (BufferedWriter bw1 = new BufferedWriter(fw1)) { bw1.write(fichierHTML); } DirectoryChooser repertChoix = new DirectoryChooser(); repertChoix.setTitle("Choix du repertoire de sauvegarde de la visite"); File repert = new File(EditeurPanovisu.repertoireProjet); repertChoix.setInitialDirectory(repert); File repertVisite = repertChoix.showDialog(null); String nomRepertVisite = repertVisite.getAbsolutePath(); copieDirectory(repertTemp, nomRepertVisite); Dialogs.create().title("Gnration de la visite") .message("Votre visite a bien t gnr dans le rpertoire : " + nomRepertVisite) .showInformation(); if (Desktop.isDesktopSupported()) { if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { Desktop dt = Desktop.getDesktop(); File fIndex = new File(nomRepertVisite + File.separator + "index.html"); dt.browse(fIndex.toURI()); } } } else { Dialogs.create().title("Gnration de la visite") .message("Votre visite n'a pu tre gnre, votre fichier n'tant pas sauvegard") .showError(); } }
From source file:base.BasePlayer.Main.java
public static void gotoURL(String url) { if (!java.awt.Desktop.isDesktopSupported()) { System.err.println("Desktop is not supported"); System.exit(1);//from ww w .j av a 2s .c om } java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) { System.err.println("Desktop doesn't support the browse action"); System.exit(1); } try { java.net.URI uri = new java.net.URI(url); desktop.browse(uri); } catch (Exception ex) { Main.showError("Can not open URL.", "Error"); //System.err.println( ex.getMessage() ); ex.printStackTrace(); } }