Specific steps for Java JFrame swing nested browsers

1、 Functions to be realized by using swing nested browser:

By nesting a browser in a form through the swing implementation of Java, the content of another project can be displayed in this browser. Just go back to the URL of the home page of another project, so that another project can be displayed normally in the swing nested browser;

2、 When using the method in the following browser tool class, you only need to obtain the URL address of the first page of another project and the title of the string type to be displayed in the upper left corner of the browser from the server of another project. The parameters are only URL and title;

(1) Main steps:

1. Create a browser through the following java code;

2. Create JFrame form and make basic settings for the form; 3. Set the positioning size displayed by the browser and add the browser to the JFrame form:

Note: the Java code for adding the browser to the form must be after adding the toolbar background picture at the top of the browser to the Java code of the form, otherwise the browser content will not be displayed;

4. Set the left icon of the toolbar at the top of the browser;

5. Set the title text on the left side of the toolbar at the top of the browser;

6. Set the minimize, maximize, close and other pictures on the right side of the toolbar at the top of the browser and various events of the mouse;

7. Add an event for the form: when the size of the form changes, the Java code in the method body will be executed; Because the size of the form can be changed;

8. Very important: the following line of code in the browser tool class must be commented out, otherwise this form will not pop up when other forms call this form;

(2) All codes of browser tools are as follows:

The tool class code used in the above code to obtain the current computer size is as follows:

The specific steps of the above Java JFrame swing nested browser are all the contents shared by Xiaobian. I hope it can give you a reference and support more programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>