Skip to content Skip to sidebar Skip to footer

Javaawtdesktop Browse Example

Java Code Examples for java.awt.Desktop

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project groovejaar, under directory /src/groovejaar/.

Source file: GrooveJaar.java

29

vote

static void openURL(String url) throws IOException, URISyntaxException {   Desktop desktop=Desktop.getDesktop();   if (desktop.isSupported(Desktop.Action.BROWSE)) {     desktop.browse(new URI(url));   }  else   showMessage(("Error")); }            

Example 2

From project Briss, under directory /src/main/java/at/laborg/briss/utils/.

Source file: DesktopHelper.java

27

vote

public static void openDonationLink(String uri) throws IOException {   if (Desktop.isDesktopSupported()) {     Desktop desktop=Desktop.getDesktop();     URI donationURI;     try {       donationURI=new URI(uri);       desktop.browse(donationURI);     }  catch (    URISyntaxException e) {     }   } }            

Example 3

From project jftp, under directory /src/main/java/com/myjavaworld/jftp/.

Source file: LocalSystemMenu.java

27

vote

public LocalSystemMenu(JFTP jftp){   super();   this.jftp=jftp;   if (Desktop.isDesktopSupported()) {     Desktop desktop=Desktop.getDesktop();     openSupported=desktop.isSupported(Desktop.Action.OPEN);     editSupported=desktop.isSupported(Desktop.Action.EDIT);     printSupported=desktop.isSupported(Desktop.Action.PRINT);   }   setText(resources.getString("text.localSystem"));   setMnemonic(resources.getString("mnemonic.localSystem"),resources.getString("mnemonicIndex.localSystem"));   prepareMenuItems();   addMenuListener(this); }            

Example 4

From project nevernote, under directory /src/cx/fbn/nevernote/gui/.

Source file: ExternalBrowse.java

27

vote

@SuppressWarnings("unused") private void emailNote(){   if (Desktop.isDesktopSupported()) {     Desktop desktop=Desktop.getDesktop();     String text2=browser.getContentsToEmail();     QUrl url=new QUrl("mailto:");     url.addQueryItem("subject",browser.getTitle());     url.addQueryItem("body",text2);     QDesktopServices.openUrl(url);   } }            

Example 5

From project sgl-Editor, under directory /src/de/moonshade/osbe/menuhandler/.

Source file: ActionOnlineDocs.java

26

vote

@Override public void start(){   Desktop desktop=Desktop.getDesktop();   URI uri;   try {     uri=new URI("https://github.com/MoonShade/sgl-Editor/wiki");     desktop.browse(uri);   }  catch (  IOException e) {     e.printStackTrace();   } catch (  URISyntaxException e1) {     e1.printStackTrace();   } }            

Example 6

From project Core_2, under directory /shell/src/main/java/org/jboss/forge/shell/plugins/builtin/.

Source file: EditPlugin.java

25

vote

@DefaultCommand public void run(@Option(description="The files to edit",defaultValue=".") final Resource<?>[] dirs) throws IOException {   for (  Resource<?> resource : dirs) {     if (resource instanceof FileResource<?>) {       Desktop dt=Desktop.getDesktop();       try {         dt.edit((File)resource.getUnderlyingResourceObject());       }  catch (      UnsupportedOperationException e) {         if (OSUtils.isLinux()) {           NativeSystemCall.exec(true,"gedit",resource.getFullyQualifiedName());         }  else         throw e;       }     }   } }            

Example 7

From project en4j, under directory /NBPlatformApp/NoteContentViewModule/src/main/java/com/rubenlaguna/en4j/NoteContentViewModule/.

Source file: UnrecognizedResourceJPanel.java

25

vote

private void jButton1MouseReleased(java.awt.event.MouseEvent evt){   new SwingWorker<Void,Void>(){     @Override protected Void doInBackground() throws Exception {       try {         String extension=FilenameUtils.getExtension(resource.getFilename());         File tempFile=File.createTempFile("en4j","." + extension);         tempFile.deleteOnExit();         OutputStream os=new BufferedOutputStream(new FileOutputStream(tempFile));         InputStream is=resource.getDataAsInputStream();         byte[] buf=new byte[1024];         int len;         while ((len=is.read(buf)) > 0) {           os.write(buf,0,len);         }         is.close();         os.close();         Desktop dt=Desktop.getDesktop();         dt.open(tempFile);       }  catch (      IOException ex) {         Exceptions.printStackTrace(ex);       }       return null;     }   } .execute(); }            

Example 8

From project ihtika, under directory /Sources/Bundles/I_InternalFunctions/src/main/java/ihtika2/i_internalfunctions/service/.

Source file: InternalFunctions.java

25

vote

@Override public void launchBrowser(String uriStr){   Desktop desktop;   if (Desktop.isDesktopSupported()) {     desktop=Desktop.getDesktop();     if (desktop.isSupported(Desktop.Action.BROWSE)) {       URI uri;       try {         uri=new URI("http://" + uriStr);         desktop.browse(uri);       }  catch (      IOException ioe) {         ioe.printStackTrace();       } catch (      URISyntaxException use) {         use.printStackTrace();       }     }   } }            

Example 9

From project jinx, under directory /src/test/java/net/jeremybrooks/jinx/.

Source file: JinxTestUtil.java

25

vote

public static Token login() throws Exception {   JinxLogger.setLogger(new StdoutLogger());   if (properties == null) {     properties=new Properties();     properties.load(JinxTestUtil.class.getResourceAsStream("/secret.properties"));     JinxLogger.getLogger().log(properties.toString());   }   Token token=null;   Jinx jinx=Jinx.getInstance();   File tokenFile=new File((String)properties.get("path.to.token"));   if (tokenFile.exists()) {     token=new Token();     token.load(tokenFile);     Jinx.getInstance().init((String)properties.get("flickr.key"),(String)properties.get("flickr.secret"),token);   }  else {     jinx.init((String)properties.get("flickr.key"),(String)properties.get("flickr.secret"));     Frob frob=AuthApi.getInstance().getFrob(JinxConstants.PERMS_WRITE);     JinxLogger.getLogger().log("Go to this URL to authorize the application:");     JinxLogger.getLogger().log(frob.getLoginUrl());     Desktop desktop=Desktop.getDesktop();     desktop.browse(URI.create(frob.getLoginUrl()));     System.out.println("Waiting 30 seconds for app authorization...");     Thread.sleep(30000);     token=AuthApi.getInstance().getToken(frob);     if (token.getNsid() != ("")) {       JinxLogger.getLogger().log("Authorization successful.");       File file=new File((String)properties.get("path.to.token"));       JinxLogger.getLogger().log(file.getAbsolutePath());       token.store(file);     }  else {       JinxLogger.getLogger().log("Authorization failed.");     }   }   return token; }            

Example 10

From project jninka, under directory /jninka-parent/jninka-gui/src/main/java/org/whitesource/jninka/gui/.

Source file: AgentPresenter.java

25

vote

private JButton getLinkButton(String text,String address){   JButton result=new JButton();   final URI uri;   try {     uri=new URI(address);     result.setText(text);     result.setHorizontalAlignment(SwingConstants.CENTER);     result.addActionListener(new ActionListener(){       public void actionPerformed(      ActionEvent e){         if (Desktop.isDesktopSupported()) {           Desktop desktop=Desktop.getDesktop();           try {             desktop.browse(uri);           }  catch (          Exception ex) {           }         }       }     } );   }  catch (  URISyntaxException e) {     log.severe("error: " + e.getMessage());   }   return result; }            

Example 11

From project LateralGM, under directory /org/lateralgm/components/.

Source file: AboutBox.java

25

vote

protected static void setLinkHandler(JEditorPane ep){   try {     if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {       ep.addHyperlinkListener(new HyperlinkListener(){         public void hyperlinkUpdate(        HyperlinkEvent e){           if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && Desktop.isDesktopSupported()) {             Desktop desktop=Desktop.getDesktop();             try {               desktop.browse(e.getURL().toURI());             }  catch (            URISyntaxException use) {               use.printStackTrace();             } catch (            IOException ioe) {               ioe.printStackTrace();             }           }         }       } );       return;     }   }  catch (  NoClassDefFoundError e) {   }   ((HTMLEditorKit)ep.getEditorKit()).setLinkCursor(null); }            

Example 12

public void output() throws Exception {   if (Desktop.isDesktopSupported()) {     Desktop desktop=Desktop.getDesktop();     if (desktop.isSupported(Desktop.Action.OPEN)) {       OutputStragegy st=output.getOutputStrategy(getName());       File lastFolder=st.lastOutputFolder();       if (lastFolder.exists()) {         desktop.open(lastFolder);       }  else {         log.warning("Folder does not exist (yet): " + lastFolder);       }     }   } }            

Example 13

From project sandbox, under directory /xoo/src/main/java/org/xwiki/xoo/.

Source file: Utils.java

25

vote

public static void openWithDefaultBrowser(String url){   if (!Desktop.isDesktopSupported()) {     System.out.println("Desktop is not supported (fatal)");     return;   }   Desktop desktop=Desktop.getDesktop();   if (!desktop.isSupported(Desktop.Action.BROWSE)) {     System.out.println("Desktop doesn't support the browse action (fatal)");     return;   }   try {     URI uri=new URI(url);     desktop.browse(uri);   }  catch (  URISyntaxException e) {     e.printStackTrace();   } catch (  IOException e) {     e.printStackTrace();   } catch (  java.lang.Exception e) {     e.printStackTrace();   } }            

Example 14

From project nuxeo-distribution, under directory /nuxeo-launcher/src/main/java/org/nuxeo/launcher/gui/.

Source file: NuxeoFrame.java

24

vote

@Override public void actionPerformed(ActionEvent event){   try {     Desktop.getDesktop().browse(java.net.URI.create(controller.getLauncher().getURL()));   }  catch (  Exception e) {     setError("An error occurred while launching browser",e);   } }            

Example 15

From project ANNIS, under directory /annis-kickstarter/src/main/java/de/hu_berlin/german/korpling/annis/kickstarter/.

Source file: MainFrame.java

23

vote

private void btLaunchActionPerformed(java.awt.event.ActionEvent evt){   try {     Desktop.getDesktop().browse(new URI("http://localhost:8080/annis-gui/app/"));   }  catch (  Exception ex) {     new ExceptionDialog(this,ex).setVisible(true);   } }            

Example 16

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/directorytree/.

Source file: ExternalViewerAction.java

23

vote

@Override public void actionPerformed(ActionEvent e){   Logger.noteAction(this.getClass());   String tempPath=Case.getCurrentCase().getTempDirectory();   tempPath=tempPath + File.separator + this.fileObject.getName();   File tempFile=new File(tempPath);   if (tempFile.exists()) {     tempFile.delete();   }   try {     tempFile.createNewFile();     ContentUtils.writeToFile(fileObject,tempFile);   }  catch (  IOException ex) {     logger.log(Level.WARNING,"Can't save to temporary file.",ex);   }   try {     Desktop.getDesktop().open(tempFile);   }  catch (  IOException ex) {     logger.log(Level.WARNING,"File type not supported.",ex);   }   tempFile.deleteOnExit(); }            

Example 17

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/update/.

Source file: InfoPane.java

23

vote

private void initUi(){   setLayout(new BorderLayout());   infoPanel=new JEditorPane("text/html",null);   infoPanel.setEditable(false);   infoPanel.addHyperlinkListener(new HyperlinkListener(){     public void hyperlinkUpdate(    HyperlinkEvent e){       if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {         try {           Desktop.getDesktop().browse(e.getURL().toURI());         }  catch (        Exception e1) {           JOptionPane.showMessageDialog(InfoPane.this,"Failed to open URL:\n" + e.getURL() + ":\n"+ e1.getMessage(),"Error",JOptionPane.ERROR_MESSAGE);         }       }     }   } );   infoPanelScrollPane=new JScrollPane(infoPanel);   setBorder(BorderFactory.createTitledBorder("Module Information"));   add(infoPanelScrollPane,BorderLayout.CENTER); }            

Example 18

public CoffeeScriptOptionsPanel(CoffeeScriptOptionsPanelController controller){   this.controller=controller;   initComponents();   compilerComboBox.setModel(new javax.swing.DefaultComboBoxModel(CoffeeScriptSettings.CompilerType.values()));   compilerHelp.addHyperlinkListener(new HyperlinkListener(){     @Override public void hyperlinkUpdate(    HyperlinkEvent e){       if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {         try {           Desktop.getDesktop().browse(e.getURL().toURI());         }  catch (        Exception e1) {         }       }     }   } ); }            

Example 19

public static DesktopBrowser create(){   try {     Class.forName("java.awt.Desktop");     if (!Desktop.isDesktopSupported())     return (null);     return (new DesktopBrowser(Desktop.getDesktop()));   }  catch (  Exception e) {     return (null);   } }            

Example 20

From project cytoscape-plugins, under directory /org.openbel.cytoscape.navigator/src/org/openbel/cytoscape/navigator/.

Source file: KamNavigatorPlugin.java

23

vote

/**   * Default no-arg plugin construtor to initialize this plugin.  */ public KamNavigatorPlugin(){   Cytoscape.getNodeAttributes().setUserEditable(KAM_NODE_ID_ATTR,false);   Cytoscape.getNodeAttributes().setUserVisible(KAM_NODE_ID_ATTR,false);   Cytoscape.getNodeAttributes().setUserEditable(KAM_NODE_FUNCTION_ATTR,false);   Cytoscape.getNodeAttributes().setUserVisible(KAM_NODE_FUNCTION_ATTR,true);   Cytoscape.getEdgeAttributes().setUserEditable(KAM_EDGE_ID_ATTR,false);   Cytoscape.getEdgeAttributes().setUserVisible(KAM_EDGE_ID_ATTR,false);   Cytoscape.getNodeAttributes().setUserEditable(KAM_NAME_ATTR,false);   Cytoscape.getNodeAttributes().setUserVisible(KAM_NAME_ATTR,true);   Cytoscape.getNodeAttributes().setUserEditable(KAM_COMPILE_DATE_ATTR,false);   Cytoscape.getNodeAttributes().setUserVisible(KAM_COMPILE_DATE_ATTR,false);   Cytoscape.getNodeAttributes().setUserEditable(WSDL_URL_ATTR,false);   Cytoscape.getNodeAttributes().setUserVisible(WSDL_URL_ATTR,false);   final KamNodeContextListener nctx=new KamNodeContextListener();   Cytoscape.getPropertyChangeSupport().addPropertyChangeListener(CytoscapeDesktop.NETWORK_VIEW_CREATED,nctx);   Cytoscape.getPropertyChangeSupport().addPropertyChangeListener(CytoscapeDesktop.NETWORK_VIEW_DESTROYED,nctx);   Cytoscape.getPropertyChangeSupport().addPropertyChangeListener(CytoscapeDesktop.NETWORK_VIEW_CREATED,this);   Cytoscape.getPropertyChangeSupport().addPropertyChangeListener(Cytoscape.NETWORK_CREATED,this);   Cytoscape.getPropertyChangeSupport().addPropertyChangeListener(Cytoscape.NETWORK_DESTROYED,this);   final JMenu pluginMenu=Cytoscape.getDesktop().getCyMenus().getOperationsMenu();   JMenu kiMenu=getKamPluginMenu();   if (kiMenu == null) {     kiMenu=new JMenu(KAM_PLUGIN_SUBMENU);     pluginMenu.add(kiMenu);   }   kiMenu.add(new SearchKAMDialogAction());   kiMenu.add(new SearchKAMListDialogAction());   kiMenu.addSeparator();   kiMenu.add(new SettingsDialogAction());   JMenuItem feedbackItem=kiMenu.add(new FeedbackMailToAction());   feedbackItem.setEnabled(Desktop.isDesktopSupported() ? Desktop.getDesktop().isSupported(Desktop.Action.MAIL) : false);   updateMenuState(false);   loadKAMStyle(); }            

Example 21

From project gitblit, under directory /src/com/gitblit/client/.

Source file: Utils.java

23

vote

public static void browse(String url){   try {     Desktop.getDesktop().browse(new URI(url));   }  catch (  Exception x) {     showException(null,x);   } }            

Example 22

From project hudsontrayapp-plugin, under directory /client-jdk16/src/main/java/org/hudson/trayapp/gui/tray/.

Source file: AWTTrayIcon.java

23

vote

public void browse(final URI uri) throws Exception {   new Thread(new Runnable(){     public void run(){       try {         Desktop.getDesktop().browse(uri);       }  catch (      IOException e) {         e.printStackTrace();       }     }   } ,"browse launch thread " + uri.toString()).start(); }            

Example 23

From project Maimonides, under directory /src/com/codeko/apps/maimonides/alumnos/.

Source file: PanelCorrespondencia.java

23

vote

@Action public void abrir(){   int row=tabla.getSelectedRow();   if (row > -1) {     Carta c=modelo.getElemento(tabla.convertRowIndexToModel(row));     File archivo=c.getArchivo();     if (archivo != null && archivo.exists()) {       try {         Desktop.getDesktop().open(archivo);       }  catch (      IOException ex) {         Logger.getLogger(PanelCorrespondencia.class.getName()).log(Level.SEVERE,null,ex);       }     }   } }            

Example 24

From project mdk, under directory /ui/src/main/java/uk/ac/ebi/mdk/ui/edit/crossreference/module/.

Source file: GoogleSearch.java

23

vote

public GoogleSearch(){   component=PanelFactory.createDialogPanel("left:p:grow, 4dlu, min","p, 4dlu, p");   field=FieldFactory.newField(30);   search=ButtonFactory.newButton("Search",new AbstractAction(){     public void actionPerformed(    ActionEvent e){       try {         String text=field.getText() + (restrict.isSelected() ? " " + Joiner.on(" OR ").join(SITES) : "");         String query=URLEncoder.encode(text,"UTF-8");         String address=String.format(GOOGLE_SEARCH_FORMAT,query);         Desktop.getDesktop().browse(new URI(address));       }  catch (      Exception ex) {         LOGGER.error("Unable to open browser: " + ex.getMessage());       }     }   } );   restrict.setSelected(true);   CellConstraints cc=new CellConstraints();   component.add(restrict,cc.xy(1,1));   component.add(search,cc.xy(3,1));   component.add(field,cc.xyw(1,3,3)); }            

Example 25

From project playn, under directory /java/src/playn/java/.

Source file: JavaPlatform.java

23

vote

@Override public void openURL(String url){   try {     Desktop.getDesktop().browse(URI.create(url));   }  catch (  Exception e) {     log.warn("Failed to open URL [url=" + url + ", error="+ e+ "]");   } }            

Example 26

public static DesktopBrowser create(){   try {     Class.forName("java.awt.Desktop");     if (!Desktop.isDesktopSupported())     return (null);     return (new DesktopBrowser(Desktop.getDesktop()));   }  catch (  Exception e) {     return (null);   } }            

Example 27

From project skmclauncher, under directory /src/main/java/com/sk89q/mclauncher/util/.

Source file: UIUtil.java

23

vote

/**   * Browse to a folder.  * @param file  * @param component   */ public static void browse(File file,Component component){   try {     Desktop.getDesktop().browse(new URL("file://" + file.getAbsolutePath()).toURI());   }  catch (  IOException e) {     JOptionPane.showMessageDialog(component,"Unable to open '" + file.getAbsolutePath() + "'. Maybe it doesn't exist?","Open failed",JOptionPane.ERROR_MESSAGE);   } catch (  URISyntaxException e) {   } }            

Example 28

From project sparsemapcontent, under directory /app/src/main/java/org/sakaiproject/nakamura/app/.

Source file: LaunchNakamura.java

23

vote

/**   * Performs the action when the browser button is pressed, which is launch a web browser and browse to the server URL.  * @param evt The details of the event.  */ private void browserButtonActionPerformed(java.awt.event.ActionEvent evt){   try {     Desktop.getDesktop().browse(new URL(localhostURL).toURI());   }  catch (  IOException e) {     System.err.println("IO Exception: " + e.getMessage());   } catch (  URISyntaxException e) {     System.err.println("URISyntaxException: " + e.getMessage());   } }            

Example 29

From project spliffy, under directory /spliffy-sync-app/module/src/main/java/org/spliffy/sync/app/.

Source file: WindowController.java

23

vote

public WindowController(String url){   if (Desktop.isDesktopSupported()) {     desktop=Desktop.getDesktop();   }  else {     desktop=null;   }   this.url=url; }            

Example 30

From project st-js, under directory /test-helper/src/main/java/org/stjs/testing/driver/.

Source file: ServerSession.java

23

vote

private boolean checkBrowsers() throws InterruptedException, IOException {   final int initialTimeout=2000;   final int stepTimeout=500;   System.out.println("Waiting for " + browserCount + " browser(s)");   try {     Thread.sleep(Math.min(initialTimeout,timeout));     if (server.getBrowserCount() < browserCount) {       if (startBrowser && Desktop.isDesktopSupported() && (server.getBrowserCount() == 0)) {         System.out.println("Starting the default browser ...");         Desktop.getDesktop().browse(new URL(server.getHostURL(),"/start.html").toURI());       }       for (int i=initialTimeout; i < timeout; i+=stepTimeout) {         Thread.sleep(stepTimeout);         if (server.getBrowserCount() >= browserCount) {           System.out.println("Captured browsers");           return true;         }       }       System.err.println("Unable to capture at least " + browserCount + " browser(s)");       return false;     }   }  catch (  MalformedURLException ex) {     ex.printStackTrace();   } catch (  URISyntaxException e) {     e.printStackTrace();   }   System.out.println("Have " + server.getBrowserCount() + " browsers connected");   return true; }            

Example 31

From project subsonic, under directory /subsonic-booter/src/main/java/net/sourceforge/subsonic/booter/agent/.

Source file: SubsonicAgent.java

23

vote

public void openBrowser(){   try {     Desktop.getDesktop().browse(new URI(url));   }  catch (  Throwable x) {     x.printStackTrace();   } }            

Example 32

From project subsonic_1, under directory /subsonic-booter/src/main/java/net/sourceforge/subsonic/booter/agent/.

Source file: SubsonicAgent.java

23

vote

public void openBrowser(){   try {     Desktop.getDesktop().browse(new URI(url));   }  catch (  Throwable x) {     x.printStackTrace();   } }            

Example 33

From project subsonic_2, under directory /subsonic-booter/src/main/java/net/sourceforge/subsonic/booter/mac/.

Source file: StatusPanel.java

23

vote

private void openBrowser(){   String url=urlButton.getText();   if (url == null) {     return;   }   try {     Desktop.getDesktop().browse(new URI(url));   }  catch (  Throwable x) {     x.printStackTrace();   } }            

Example 34

From project Supersonic, under directory /src/main/java/be/hehehe/supersonic/action/.

Source file: CheckForUpdateAction.java

23

vote

@Override public void actionPerformed(ActionEvent e){   new SwingWorker<Object,Void>(){     private boolean update;     @Override protected Object doInBackground() throws Exception {       update=updateService.checkForUpdate();       return null;     }     protected void done(){       if (update) {         int result=JOptionPane.showConfirmDialog(null,"An update is available, do you want to visit the download page?","Update available",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);         if (result == JOptionPane.YES_OPTION) {           try {             Desktop.getDesktop().browse(updateService.getDownloadPageURI());           }  catch (          IOException e) {             JXErrorPane.showDialog(e);           }         }       }  else       if (noUpdatesReporting) {         JOptionPane.showMessageDialog(null,"No updates available","Updates",JOptionPane.INFORMATION_MESSAGE);       }     }   } .execute(); }            

Example 35

From project syncany, under directory /syncany/src/org/syncany/util/.

Source file: FileUtil.java

23

vote

public static void browsePage(String url){   try {     Desktop.getDesktop().browse(URI.create(url));   }  catch (  Exception ex) {   } }            

Example 36

From project uniquery, under directory /src/org/uniquery/gui/.

Source file: InfoTab.java

23

vote

public InfoTab(String title){   super();   this.title=title;   setName(this.title);   setEditable(false);   setContentType("text/html");   addHyperlinkListener(new HyperlinkListener(){     @Override public void hyperlinkUpdate(    HyperlinkEvent e){       if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {         if (Desktop.isDesktopSupported()) {           if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {             try {               Desktop.getDesktop().browse(e.getURL().toURI());             }  catch (            IOException ioe) {               ioe.printStackTrace();               displayBrowserError();             } catch (            URISyntaxException use) {               use.printStackTrace();             }           }  else {             displayBrowserError();           }         }       }     }   } );   String content=readInfoFile();   content=content.replaceAll("\\$NAME",Uniquery.NAME);   content=content.replaceAll("\\$VERSION",Uniquery.VERSION);   content=content.replaceAll("\\$HOMEPAGE",Uniquery.HOMEPAGE);   setText(content); }            

Example 37

From project WoWHead-Item-Parser, under directory /wowhead_itemreader/.

Source file: MainFrame.java

23

vote

private void editorPaneHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt){   if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {     try {       try {         Desktop.getDesktop().browse(evt.getURL().toURI());       }  catch (      URISyntaxException ex) {         Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE,null,ex);       }     }  catch (    IOException ex) {       Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE,null,ex);     }   } }            

maffeiwaidelve.blogspot.com

Source: http://www.javased.com/?api=java.awt.Desktop

Post a Comment for "Javaawtdesktop Browse Example"