The simplest Java homemade browser in history

Source: Internet
Author: User

I believe many comrades have also thought of their own to write a browser (or a Web page) embedded in their own written form, but the hateful is not provided in the Java class, Java, there is a call Editpane control, can be implemented to open some Web pages, But the CSS and JS effect support is quite poor, so what to do, oh, well, I believe that the comrades who have used SWT should know that SWT is the eclipse development of the jar package, the function is very powerful, including the browser I now want to say, in the presence of SWT that is easy, good, no nonsense, on the code:


Package brower_test_2;


Import Org.eclipse.swt.SWT;
Import Org.eclipse.swt.browser.Browser;
Import Org.eclipse.swt.layout.FillLayout;
Import Org.eclipse.swt.widgets.Display;
Import Org.eclipse.swt.widgets.Shell;


public class Swtbrowseforfund {public


	static void Main (string[] args) {
		display display = new display ();
		Shell shell = new shell (display);
		Browser Browser = new Browser (Shell, SWT. NONE);
		Browser.seturl ("Http://blog.csdn.net/tangcaijun");
		Shell.setlayout (New Filllayout ());
		Shell.open ();
		while (!shell.isdisposed ())
		{
			if (Display.readanddispatch ()) 
			{
				display.sleep ();
			}
		}
		Display.dispose ();
	}





It's so simple, try it yourself ~

Attached jar Download Address: http://download.csdn.net/detail/tangcaijun/5333385

If there is a problem in the process can be posted, I can answer the words will reply as soon as possible

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.