List of usage examples for java.awt Desktop getDesktop
public static synchronized Desktop getDesktop()
From source file:genrsa.GenRSAController.java
/** * Abre el archivo Banco de pruebas// w ww. j a va2 s . com * @param event */ public void testBench(ActionEvent event) { try { String str = System.getProperty("user.dir") + "/Documentacin/Banco de Pruebas.pdf"; File localFile = new File(str); Desktop.getDesktop().open(localFile); } catch (IOException e) { } }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
private void openWebsite() { String s = ILIASDOWNLOADER_WEBSITE; try {//from w ww. j a va2 s .c o m Desktop.getDesktop().browse(new URI(s)); } catch (IOException | URISyntaxException e) { showError("Fehler beim ffnen von: " + s, e); } }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
private void openWebsiteLicense() { String s = ServiceFunctions.ILIASDOWNLOADER_WEBSITE_LICENSE; try {// www . ja v a2s.co m Desktop.getDesktop().browse(new URI(s)); } catch (IOException | URISyntaxException e) { showError("Fehler beim ffnen von: " + s, e); } }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
private void openAndroidWebsite() { String s = ILIASDOWNLOADER_ANDROID_WEBSITE; try {//from w w w .jav a 2s . c o m Desktop.getDesktop().browse(new URI(s)); } catch (IOException | URISyntaxException e) { showError("Fehler beim ffnen von: " + s, e); } }
From source file:com._17od.upm.gui.MainWindow.java
private void LaunchSelectedURL(String url) { if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); try {/*from w w w . j a va2s .com*/ desktop.browse(new URI(url)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Linux and Mac specific code in order to launch url } else { Runtime runtime = Runtime.getRuntime(); try { runtime.exec("xdg-open " + url); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
From source file:uiuc.dm.miningTools.ui.ParametersSelectionFrame.java
private void initMiningFunctionParametersSelectionPanel() { miningFunctionParamsSelectionPanel = new JPanel(); sigLevelParamsPanel = new JPanel(); plotMapParamsPanel = new JPanel(); plotDensityMapPanel = new JPanel(); plotDensityMapPanel//from ww w . j a va2s .co m .setPreferredSize(new Dimension(PLOT_MAP_PARAMS_PANEL_WIDTH, PLOT_MAP_PARAMS_PANEL_HEIGHT)); /*Fei*/ followingParamsPanel = new JPanel(); followingParamsPanel .setPreferredSize(new Dimension(FOLLOWING_PARAMS_PANEL_WIDTH, FOLLOWING_PARAMS_PANEL_HEIGHT)); /**/ miningFunctionParamsSelectionPanel.setPreferredSize( new Dimension(MINING_FUNC_PARAMS_SELECTION_PANEL_WIDTH, MINING_FUNC_PARAMS_SELECTION_PANEL_HEIGHT)); sigLevelParamsPanel .setPreferredSize(new Dimension(SIG_LEVEL_PARAMS_PANEL_WIDTH, SIG_LEVEL_PARAMS_PANEL_HEIGHT)); plotMapParamsPanel .setPreferredSize(new Dimension(PLOT_MAP_PARAMS_PANEL_WIDTH, PLOT_MAP_PARAMS_PANEL_HEIGHT)); miningFunctionParamsSelectionPanel.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Mining Function Parameters"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); // add sigLevel params comps to its panel sigLevelParamsPanel.add(numRoundLabel); sigLevelParamsPanel.add(numRoundCombo); sigLevelParamsPanel.add(distThresLabel); distThresTextedField.setText(Double.toString(DEFAULT_DIST_THRES_ATT)); sigLevelParamsPanel.add(distThresTextedField); sigLevelParamsPanel.add(miningFucntionParamsHelpButton); sigLevelParamsPanel.setVisible(false); // add plot map params comps to its panel plotMapParamsPanel.add(saveKmlButton); plotMapParamsPanel.setVisible(false); /*Fei*/ // add following params comps to its panel followingParamsPanel.add(this.lMaxThresLabel); followingParamsPanel.add(this.lMaxLabelTextedField); this.dMaxLabelTextedField.setText(Double.toString(DEFAULT_DIST_THRES)); this.lMaxLabelTextedField.setText(Double.toString(DEFAULT_TIME_THRES)); this.minIntervalLengthField.setText(Double.toString(DEFAULT_MIN_LENGTH)); followingParamsPanel.add(this.dMaxThresLabel); followingParamsPanel.add(this.dMaxLabelTextedField); followingParamsPanel.add(this.minIntervalLengthLabel); followingParamsPanel.add(this.minIntervalLengthField); followingParamsPanel.add(this.miningFunctionParamsHelpButtonFollowing); followingParamsPanel.setVisible(false); miningFunctionParamsSelectionPanel.add(followingParamsPanel); plotDensityMapPanel.add(saveDensityMapButton); plotDensityMapPanel.setVisible(false); miningFunctionParamsSelectionPanel.add(plotDensityMapPanel); this.miningFunctionParamsHelpButtonFollowing.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { String workingDir = System.getProperty("user.dir").replace("\\", "/"); Desktop.getDesktop().browse(new URI("file://" + workingDir + "/index.html#following")); } catch (URISyntaxException ex) { Logger.getLogger(ParametersSelectionFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ParametersSelectionFrame.class.getName()).log(Level.SEVERE, null, ex); } } }); /**/ miningFunctionParamsSelectionPanel.add(sigLevelParamsPanel); miningFunctionParamsSelectionPanel.add(plotMapParamsPanel); /* miningFucntionParamsHelpButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFrame helpTextFrame = new JFrame("Mining Function Parameters Help"); helpTextFrame.setSize(HELP_TEXT_JFRAME_WIDTH, HELP_TEXT_JFRAME_HEIGHT); JTextArea text = new JTextArea(); text.setEditable(false); text.setCursor(null); text.setOpaque(false); text.setFocusable(false); text.setLineWrap(true); text.setWrapStyleWord(true); text.setPreferredSize( new Dimension(HELP_TEXT_JFRAME_WIDTH - 20, HELP_TEXT_JFRAME_HEIGHT - 20)); text.setText(genMiningFunctionParameterHelpText()); JPanel panel = new JPanel(); panel.setPreferredSize( new Dimension(HELP_TEXT_JFRAME_WIDTH, HELP_TEXT_JFRAME_HEIGHT)); panel.add(text); helpTextFrame.add(panel); helpTextFrame.setVisible(true); panel.setPreferredSize( new Dimension(HELP_TEXT_JFRAME_WIDTH, HELP_TEXT_JFRAME_HEIGHT)); panel.add(text); helpTextFrame.add(panel); helpTextFrame.setVisible(true); } });*/ miningFucntionParamsHelpButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { //JFrame help = new Browser(); // help.setLocation(this.getX() + this.getWidth(), this.getY()); // help.setVisible(true); //javafxPanel.setScene(scene); String workingDir = System.getProperty("user.dir").replace("\\", "/"); Desktop.getDesktop().browse(new URI("file://" + workingDir + "/index.html#significance")); // long spentTime2 = 1; //javafxPanel.setScene(scene); //javafxPanel.setVisible(true); } catch (IOException ex) { Logger.getLogger(ParametersSelectionFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (URISyntaxException ex) { Logger.getLogger(ParametersSelectionFrame.class.getName()).log(Level.SEVERE, null, ex); } } }); hidePanel(miningFunctionParamsSelectionPanel); }
From source file:com.github.vatbub.tictactoe.view.Main.java
@FXML void aboutLinkOnAction(ActionEvent event) { try {// www . j a v a2 s . c o m Desktop.getDesktop().browse(new URI("https://github.com/vatbub/tictactoe#tictactoe")); } catch (URISyntaxException | IOException e) { FOKLogger.log(Main.class.getName(), Level.SEVERE, "Typo in a hardcoded value", e); } }
From source file:com._17od.upm.gui.AccountDialog.java
/** * Method that get(as input) the selected Account URL and open this URL via * the default browser of our platform./* ww w.ja v a2 s. c o m*/ * * @param url */ private void LaunchSelectedURL(String url) { if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); try { desktop.browse(new URI(url)); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } } else { // Linux and Mac specific code in order to launch url Runtime runtime = Runtime.getRuntime(); try { runtime.exec("xdg-open " + url); } catch (IOException e) { e.printStackTrace(); } } }
From source file:org.wandora.application.tools.extractors.palvelukartta_v2.PalvelukarttaSelector.java
private void openButtonMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_openButtonMouseReleased Desktop dt = Desktop.getDesktop(); if (dt != null) { try {/*ww w .ja va 2s .co m*/ dt.browse(new URI("http://www.hel.fi/palvelukartta")); } catch (Exception e) { e.printStackTrace(); } } }
From source file:net.sf.taverna.t2.workbench.ui.impl.UserRegistrationForm.java
private void followHyperlinkToTandCs() { // Open a Web browser try {//from ww w. j ava 2 s.co m Desktop.getDesktop().browse(new URI(TERMS_AND_CONDITIONS_URL)); } catch (Exception ex) { logger.error("User registration: Failed to launch browser to show terms and conditions at " + TERMS_AND_CONDITIONS_URL); } }