HTML, SWING is also XML, Java client tool selection? (three)

zhaozj2021-02-17  51

The problem of swing is the speed and compatibility problem when deployment. Now, it has resolved these problems and re-enables Java client applications to a viable option, and the speed of the CPU has doubled over the past two years. In JDK 1.3, the running speed based on Swing is very fast, and the memory required is quite small. This makes us still have the last issue in the deployment Swing, which is how to deploy, here, we have three solutions to choose from.

Solution 1: Java plugin

One of the most exciting features based on the browser's Java is the Java plugin. Simple modifications to HTML web pages can eliminate the dependence on the browser JVM and allow us to run the applet in the Sun's standard JVM. Once JRE is installed, the applet is downloaded to the local disk and is placed in the high-speed buffer, and the speed of the HTML page with Applet will be much faster because all things are on the local disk. To illustrate the working principle, we first take a look at the original Applet deployment, how is the HTML webpage uses a plugin, we assume that you have mastered the knowledge of HTML and Java Applet, and created the following page:

my traditional applet page </ title> </ head> <body> <applet code = helloworld.class archive = helloworld.jar> Sorry, Looks like I Bumped Into Another Browser That Doesn't Support java applets </ applet> </ body></p> <p>The disadvantage of this method is that it relies on the browser JVM to load and execute the HelloWorld class. Considering that there are a variety of browsers in the market, they do different ways of java, making the applet's deployment into a fearful thing. You must ensure that the applet is run in the test-tested JVM. We don't ask the browser to run Java, and ask the browser to install and run us to run the Applet's JVM. In IE, we can accomplish this task by using the <Object> flag, this flag may vary, for example, in Netscape Navigator is <Embed>. The modified web page is as follows:</p> <p><Html> <head> <title> My new applet page </ title> </ head> <body> <object classid = "CLSID: 8AD9C840-044E-11D1-B3E9-00805F499D93" width = 100% height = 100codebase = " ./j2re-1_3_0_02-win.exe#version=1, 3, 0, 2">< Param name = "code" value = "helloWorld.class"> <param name = "archive" value = "helloWorld.jar" > <Param name = "cache_archive" value = "helloworld.jar"> <param name = "cache_option" value = "plugin"> </ object> </ body> The above web page will enable the browser to check if the object of the specified ClassID is Already installed, if not installed, download the JVM from the specified URL and install. Then the browser performs a plugin and downloads and displays the applet. We can learn its working principle through http://192.9.48.9/products/plugin/1.3/demos/applets/graphlayout/example1.html. For more detailed information about Java plug-ins, please refer to Sun's website.</p> <p>The advantage of the plug-in is that it can support all browsers on various operational platforms. In addition, it provides a guaranteed execution environment, plugins only need to be installed, you can buffer all Applets, enable access to the website again It is very easy. One of the biggest shortcomings of this method is that before running the applet, you must download a size of 5MB plug-in, which is especially unbearable on a low speed internet connection. In fact, if your applet is just a wattock at the top of 5kb page, downloading a 5MB plugin is not paid for this.</p> <p>Solution 2: Using Java Web Start</p> <p>Another way to deploy Java applications is Sun's Java Web Start, which is essentially similar to Java plug-ins, but there is a significant difference in the first step. Java Web Start requires artificial installation on each desktop, which is far less automatically installed. The installation of Java Web Start is quite simple. Once installed, it can be downloaded and installed on the application of Java Web Start. Like the plugin, the application is also released through the Internet.</p> <p>According to my experience, the Java plugin is similar to Java Web Start, but is better than the user affinity than Java Web Start, because it requires less administrator or user intervention. There are also some companies to create their own functionally similar deployment tools, which are sometimes easy to use than Java Web Start. For example, Sitraka's DeployDirector is better than Java Web Start and is also simpler installation.</p> <p>All in all, by using Java plug-ins and Java Web Start, Swing Application By the deployment is much simpler and safe than the original, but still more complicated than clicking a HTML page with only JavaScript. Moreover, some users may have the feeling of being stressed on the steps that need to be completed on the local machine, or there is no advantage of Swing, but if you need a dynamic GUI user interface, users enjoy more flexibility, No way is better than using Swing Applet. In addition, if the entire development is based on Java, there is no need to map between HTML request data and internal structures. RMI can provide fast two-way network calls, which can call client applications to update the display content based on servers.</p> <p>Solution three, deploy Java Swing in pure HTML</p> <p>Although HTML and SWING have their own advantages and disadvantages in developing client applications, it is obvious that the ideal solution should be supported. However, since these two techniques have a large difference in essence, only one of them can be used in one application. Although most users prefer Swing fast interactive client applications, but download and install JRE on the client system is not always a good choice. Sometimes the restrictions on security and firewalls make RMI difficult to run on the network. In this case, we need an interactive client application that can run on all systems, even if we can use a browser. Creamtec's Webcream can act as a bridge between Swing-HTML.</p> <p>Webcream is a Java tool that provides automatic internet access for GUI-based Java applications and Applets, allowing us to utilize AWT and SWING implementation of the GUI front-end application, while automatically accessing the HTML. To a certain extent, WebCream can be regarded as a dynamic Java-to-HTML conversion tool that can instantly convert the frames and conversations in Java to HTML. Then, the WebPage behavior is then imitated as a GUI event to keep the application original logic. Webcream does not require modification of existing forms and business logic, and does not need to learn any new API, which is intended to issue existing applications and Applets. WebCream just sets the Internet server and describes the tools for describing the application properties, which has all features and is free. Webcream also does not need to install on the client's machine, even no browser supports Java, because all of the browser receives all HTML code.</p> <p>As far as I know, only Webcream has such a function, and there is no other tool to provide similar solutions. However, there are also some products that use different ways to have Internet access functions that were originally not designed for the Internet. Windows 2000 has a built-in Terminal Server service that allows users to access servers remotely by logging in local system. Like the MetAframe of the Citrix System, the terminal server sends a video stream to the remote terminal and imitates the user's behavior for applications running on the server. It can run well on the high-speed network, and the performance on the low speed network is not satisfactory. It is also problematic in Java applications because they do not use this machine's drawing and scroll routines. The scalability of the terminal server is not too strong, because each user is running a copy of it. Applications converted by Webcream are different from applications running on the local system, but its performance is better because only users are submitted to a page. All users with application services with WebCream functions can share a JVM, so it can also greatly reduce resource consumption. To demonstrate WEBCREAM working principle, the following two diagrams show how a sample GUI application runs in the HTML front-end application. Figure 1 is a running GUI application (source code), Figure 2 shows that WebCream manages the same application, the window represents a web page in the browser.</p> <p>(Figure 1: GUI program in the example)</p> <p>(Figure 2: GUI after Webcream)</p> <p>Swing-HTML conversion methods are not suitable for all users, and WebCream can enhance the value of Swing front-end applications to a certain extent to enhance the value of Swing front-end applications to access front-end applications via HTML. There are 95% of applications that can be seamlessly convert to HTML, and another 5% of the program requires changing the expression and processing of data.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-29488.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="29488" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.039</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'Z_2B4GFXamWlPuHKFQOy5vExzlcqs_2Fa9fO1YLjyLNBcJB0Co_2FHoUE8emH4u5y72uuRJ6yLymcqt87ztvSTKoBW2w_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>