当前位置: 首页>>代码示例>>Java>>正文


Java BrowserLauncher类代码示例

本文整理汇总了Java中edu.stanford.ejalbert.BrowserLauncher的典型用法代码示例。如果您正苦于以下问题:Java BrowserLauncher类的具体用法?Java BrowserLauncher怎么用?Java BrowserLauncher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BrowserLauncher类属于edu.stanford.ejalbert包,在下文中一共展示了BrowserLauncher类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: menuAboutDiscussionGroupActionPerformed

import edu.stanford.ejalbert.BrowserLauncher; //导入依赖的package包/类
private void menuAboutDiscussionGroupActionPerformed(
		java.awt.event.ActionEvent e) {
	try {
		if (Desktop.isDesktopSupported()) {
			Desktop desktop = Desktop.getDesktop();
			URI groupURI = new URI(ModelTest.DISCUSSION_GROUP);
			desktop.browse(groupURI);
		} else {
			BrowserLauncher launcher = new BrowserLauncher();
			launcher.openURLinBrowser(ModelTest.DISCUSSION_GROUP);
		}
	} catch (Exception f) {
		JOptionPane.showMessageDialog(new JFrame(), f.getMessage(),
				"Error loading webpage", JOptionPane.ERROR_MESSAGE);
	}
}
 
开发者ID:ddarriba,项目名称:jmodeltest2,代码行数:17,代码来源:FrameMain.java

示例2: linkActivated

import edu.stanford.ejalbert.BrowserLauncher; //导入依赖的package包/类
/**
 * Called if someone has activated a hyperlink.
 * 
 * @param u URL of the link
 */
protected void linkActivated(URL u)
{
	// external links are loaded by the BrowserLauncher
	if (u.getProtocol().equals("http")
		|| u.getProtocol().equals("https"))
	{
		try 
		{
			BrowserLauncher.openURL(u.toString());
		} 
		catch (IOException e) 
		{
			Common.setMessage(Resource.getString("msg.browser.launcher.error") + " " + e);
		}
	}
	else
	{
		// all local links are loaded into the JEditorPane
		Cursor c = html.getCursor();
		Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
		html.setCursor(waitCursor);
		SwingUtilities.invokeLater(new PageLoader(u, c));
	}
}
 
开发者ID:silid,项目名称:project-x-cvs,代码行数:30,代码来源:Html.java

示例3: openBrowser

import edu.stanford.ejalbert.BrowserLauncher; //导入依赖的package包/类
public void openBrowser() {
    String url = "http://127.0.0.1:"
            + httpServer.getPort() + "/";
    try {
        Desktop.getDesktop().browse(new URI(url));
    } catch (Exception e1) {
        try {
            new BrowserLauncher().openURLinBrowser(url);
        } catch (Exception e2) {
            e1.printStackTrace();
            e2.printStackTrace();
            JOptionPane.showMessageDialog(null, e1.getLocalizedMessage());
        }
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:16,代码来源:Navigator.java

示例4: OSMCreditPanel

import edu.stanford.ejalbert.BrowserLauncher; //导入依赖的package包/类
/**
 * Konstruktor
 */
public OSMCreditPanel() {
         
   super(new FlowLayout(FlowLayout.CENTER));
   JLabel lab = new JLabel("Map data \u00a9 ");
   lab.setFont(font);
   lab.setForeground(new Color(0x505050));
   add(lab);
             
   lab = new JLabel("OpenStreetMap");
   lab.setCursor(new Cursor(Cursor.HAND_CURSOR));
   Map<TextAttribute, Integer> fontAttr = new HashMap<>();
   fontAttr.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
   lab.setFont(font.deriveFont(fontAttr));
   lab.setForeground(new Color(0x330066));
   add(lab);
             
   lab.addMouseListener(new MouseAdapter() {
     @Override
     public void mouseClicked(MouseEvent e) {
       try {
          new BrowserLauncher().openURLinBrowser("http://www.openstreetmap.org/copyright");
       }  catch (BrowserLaunchingInitializingException | UnsupportedOperatingSystemException ex) {
          System.err.println(ex);
       }
     }
   });                
             
   lab = new JLabel(" contributors");
   lab.setFont(font);
   lab.setForeground(new Color(0x505050));
   add(lab);                
             
   setBackground(new Color(210, 210, 210, 170));
   setOpaque(true);
   setPreferredSize(new Dimension(270, 24));            

         
}
 
开发者ID:makaw,项目名称:somado,代码行数:42,代码来源:OSMCreditPanel.java

示例5: menuHelpOpenActionPerformed

import edu.stanford.ejalbert.BrowserLauncher; //导入依赖的package包/类
private void menuHelpOpenActionPerformed(java.awt.event.ActionEvent e) {
	try {
		if (Desktop.isDesktopSupported()) {
			Desktop desktop = Desktop.getDesktop();
			URI wikiURI = new URI(ModelTest.WIKI);
			desktop.browse(wikiURI);
		} else {
			BrowserLauncher launcher = new BrowserLauncher();
			launcher.openURLinBrowser(ModelTest.WIKI);
		}
	} catch (Exception f) {
		JOptionPane.showMessageDialog(new JFrame(), f.getMessage(),
				"Error loading webpage", JOptionPane.ERROR_MESSAGE);
	}
}
 
开发者ID:ddarriba,项目名称:jmodeltest2,代码行数:16,代码来源:FrameMain.java

示例6: menuAboutWWWActionPerformed

import edu.stanford.ejalbert.BrowserLauncher; //导入依赖的package包/类
private void menuAboutWWWActionPerformed(java.awt.event.ActionEvent e) {
	try {
		if (Desktop.isDesktopSupported()) {
			Desktop desktop = Desktop.getDesktop();
			URI jModelTestURI = new URI(ModelTest.URL);
			desktop.browse(jModelTestURI);
		} else {
			BrowserLauncher launcher = new BrowserLauncher();
			launcher.openURLinBrowser(ModelTest.URL);
		}
	} catch (Exception f) {
		JOptionPane.showMessageDialog(new JFrame(), f.getMessage(),
				"Error loading webpage", JOptionPane.ERROR_MESSAGE);
	}
}
 
开发者ID:ddarriba,项目名称:jmodeltest2,代码行数:16,代码来源:FrameMain.java

示例7: showHtmlWindow

import edu.stanford.ejalbert.BrowserLauncher; //导入依赖的package包/类
private void showHtmlWindow(String title,String text) {
	JPanel panel = new JPanel(new BorderLayout());
	JEditorPane pane = new JEditorPane("text/html",text) {
		public boolean isFocusTraversable() {
			return false;
		}
	};
	pane.addHyperlinkListener(new HyperlinkListener() {
		public void hyperlinkUpdate(HyperlinkEvent e) {
			if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
				try {
					URL url = e.getURL();
					BrowserLauncher.openURL(url.toString());
				}
				catch(IOException ex) {
					// do nothing
				}
			}
		}
	});
	pane.setEditable(false);
	pane.setOpaque(false);
	panel.add(pane,BorderLayout.CENTER);
	Box box = Box.createHorizontalBox();
	box.add(Box.createHorizontalGlue());
	JButton creditsButton = new JButton("RealmSpeak Credits...");
	creditsButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent ev) {
			showCredits();
		}
	});
	box.add(creditsButton);
	panel.add(box,BorderLayout.SOUTH);
	
	FrameManager.showDefaultManagedFrame(this,panel,title,IconFactory.findIcon("images/logo/realmbox.jpg"),true);
}
 
开发者ID:dewkid,项目名称:RealmSpeak,代码行数:37,代码来源:RealmSpeakFrame.java


注:本文中的edu.stanford.ejalbert.BrowserLauncher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。