Let me talk about more cool ways to get the appearance of the program in JBuilder!
Java program default appearance (Lookandfeel) can be changed to Java appearance, MotiF appearance, Windows appearance, Mac appearance;
And the appearance of Java has five styles are sea blue gemstone, grandmother green style, ruby style, charcoal style,
High contrast style.
The specific method of appearance changes is as follows:
1: You can call one of the following three in the program directly:
Import javax.swing. *;
UIManager.SetLookAndfeel ("com.sun.java.swing.plaf.motif.motiflookandfeel");
UIManager.SetLookandFeel ("javax.swing.plaf.metal.MetallookAndfeel");
UIManager.SetLookAndfeel ("com.sun.java.swing.plaf.windows.windowslookandfeel");
2: Or use the menu to transform:
Import javax.swing. *;
JMenuBar MB = new jmenubar ();
JMenu File = New Jmenu ("Look & Feel", True;
ButtonGroup Buttongroup = New Buttongroup ();
Final uimanager.lookandfeelinfo [] info = uimanager.getinstalledLookandFeels ();
For (int i = 0; i JRADIOBUTTONMENUITEM ITEM = New JRADIOBUTTONMENUITEM (INFO [i] .Getname (), i == 0); Final string classname = info [i] .getclassname (); Item.addActionListener (New ActionListener () { Public Void ActionPerformed (ActionEvent AE) { Try {uimanager.setlookandfeel (classname); Catch (Exception E) {system.out.println (e); Swingutilities.UpdateComponentTreeui (Touchyfeely.this); }); Buttongroup.Add (item); File.Add (item); } Mb.add (file); Setjmenubar (MB); } By the previous published, a big rich friend, please change the content to JBuilder related content. Thank you. I hope to write a lot of essence, don't bill it! From: Humanc2d4, Time: 2003-5-16 14:45:00, ID: 1867298 Let me talk about the digital signature of the applet in jbuilder (reproduced from: Programmates) Since Java technology has started applying, people have given great attention to the security issues of Java platforms and security issues caused by deploying Java technology. Especially after JAVA2 released in November 1998, Java's security architecture has undergone fundamental improvements. For end users, it protects files and private data from malicious programs or viral infections and destruction, identification code providers. identity of. For developers, by using an API method, security features can be integrated into applications, because the architecture of the API can define and integrate the use of specific resources, encryption, security management, policy management, and provide Some classes to manage public key certificates for public key / key pairs and trusted user groups. At the same time, system administrators, developers, and users can use the tool management key library it provides, generate digital signatures in the JAR file, the signature integrity detection, creation, and modify the policy file. According to the Java designer's point of view, Java security includes two aspects of content, first provide Java as a safe platform to users, on which the Java program can be safely running; secondly provides security with Java programming language Tools and services, which makes some areas of security and very sensitive areas such as the enterprise world can also apply Java technology. This article will introduce the security new features of Java2 and the specific implementation methods of the Applet digital signature under this new feature. Java2 adopts a new security architecture as shown in Figure 1, and provides a lot of new specials based on this security architecture? 1.1 Idiobi Access Control This ability exists in JDK from the beginning. But use it, the writer of the application has to do a large number of programming work, for example, create subclasses of the SecurityManager and the ClassLoader class and make it userize. HotJava1.0 is a such application that allows the browser user to choose from several different security levels. However, this programming involves very sensitive security issues, which requires programmers to have a deep understanding and sake of software security. The new security architecture will make these simple and safe. 1.2 Easy to configure security policies Similar to the above, this ability exists in the original JDK, but not in use, and writing security code is not a simple thing. Thus, it is expected that the application's writers and users can set the security policy without programming. 1.3 Easy to expand access control structure Up to JDK1.1, in order to create 1 new access license, you must add 1 new Check method in the SecurityManager class. The new security architecture allows you to set various types of access licenses (each representation of 1 system resource) and automatically processes all correct access licenses (including undefined licenses). 1.4 Safety check to extend to all Java programs All local code is a trusted built-in concept will not exist. Instead, it will be a local code (such as non-system code, mounted in a local application package, etc.) obey the same security control as Applet, but can declare The policy of local code is tolerate, so that these codes can be considered to be fully credible and efficiently run. The above principles can also be applied to the signed applet and any Java application. 2 Java2 security system concept and operation mechanism 2.1 protection domain A basic concept in the Java2 security architecture is Protected Domain. One domain can be divided by an object set, which can be directly accessed by one subject. The body is an entity that is granted permitted in a computer system. The sandbox for JDK1.0 is a protected domain example with a fixed boundary. The concept of protecting domains is a convenient mechanism that plays a packet and isolation between the protection unit. For example, we can separate the protected domain to avoid direct interactions between them, so that any allowed interaction must be explicitly allowed by trusted system code or related domains. The protection domain is usually divided into a clear 2 category, system domain, and application domain. All protected external resources such as file systems, network facilities, and screens and keyboards can only be accessed through the system domain. Figure 2 shows the composition of the domain of one Java application environment. Conceptually, one field includes 1 group class, which is granted the same set of licenses. The protection domain is determined by the current policy. The Java application environment maintains mapping from code (classes and instances) to their protection domains and then to their licensed, as shown in Figure 3. One thread execution may occur completely in one single protection domain, or it may also involve one application domain or a system domain. For example: an application for 1 print message will have to interact with the system domain because the system domain is the only access point for the output stream. At any time in this case, both the application domain cannot obtain any additional licenses except the print message by calling the system domain, otherwise it will be a serious security hidden danger. In the opposite case, one system domain calls 1 method from one application domain, such as when 1 APT system domain calls 1 Applet's painting method to display this applet, valid access and application domain Allowed current permissions are the same at any time, and this is also essential. In other words, a domain with lower privileges cannot obtain additional licenses by calling a domain of higher privileges or by a higher permissions. The above related 1 thread involves two protected domains naturally summarizes a thread that traverses multiple protected domains, and a simple and cautious experience of calculating licensing is: (1) A license set that performs thread can be considered a integration of all protected domains traversed by the thread. (2) When 1 code calls the DOPRIVILEGED method, the permission to perform threads is considered to be a protected domain that includes all code and a protective domain that is directly or indirectly called. That is, one trusted code can be temporarily accessed through the DOPRIVILEGED method, which is necessary in some cases. For example, one application may not be allowed to directly access files containing fonts, but the system utility that displays text must obtain those fonts on behalf of users. During execution, when requesting access to 1 critical system resource (such as file I / O and network I / O) or API method requires 1 sensitive operation, such as reading 1 file, resource processing code is directly or indirectly called 1 Special method called AccessController class, the access control class makes the decision to give the request or operation occurred by checking the call stack. In the call stack is a member method of some classes that need to be called, because each class belongs to some protected domains, and each protected domain has established some policies, so each method of the calling stack is assigned 1 Group permissions. The access control class begins with the top, check each method from the top, see if the method is allowed by the protected domain, if a method permission is found, not allowed, access control It is throwing safety unusual; There is a special case, that is, when the access control traverses calls the stack, it will look for the privileged domain. If there is an excellent domain, even if there is no reach the bottom of the stack, the access control will stop traverse the callout stack and allow the operation. . Although new security The mechanism seems to have added a number of calls to the API method, but Java2 does use some technologies to accelerate The process of checking permissions, such as access control, will filter out repeated domains and stop checking when encountering the first priority domain. Note The additional operation will be a local method call, and the SUN's reference test shows a new security check is quite fast. Finally, each domain includes a system or application domain that can add internal resources in its domain boundaries. For example, a bank system application may need to support and protect some of its inside, such as checking, save And withdrawals, etc. Since this protector is unlike those predictable semantics can be preset by JDK, thus this The protection is best to keep it to the system or application developer. At present, one domain is individually identified by a code source (CODESource), which encapsulates two features of the code running in this domain: code base address and public key certificate set, the public key corresponds to the domain A private key for all code signed. Thus, classes from the same key and from the same URL are placed in the same domain. One domain is also included in this domain license to grant code, which is determined by the current security policy. 2.2 Certificates, Keyware and related tools Under the Java2 security system, one applet development and running process is as follows: In the distribution terminal of the code: (1) Develop Java source procedures and compile them. (2) Package class files and resource files with JAR tools. (3) Create a public key and key with KeyTool, generate X. 509V1 signing certificate, output certificate. (4) Digital signature of the JAR file with the generated key via the JARSIGNER tool. At the receiving end of the code: (1) Enter the certificate with the keytool as trusted. (2) Create and modify security policy profiles and access access to the security policy configuration file with PolicyTool. (3) From the network, the field code is obtained, verify the digital signing certificate and the integrity of the digital signature certificate and the integrity of the document code. (4) Verify the legality of the bytecode, allocate the appropriate permissions according to the policy file. (5) Execute the code, and recover the memory by the garbage collector after completion. Before using the public key to verify the digital signing certificate, the recipient needs to confirm the reliability of the public key itself, so it is usually provided to provide a certificate containing the public key rather than the public key itself. 1 certificates include: (1) 1 public key. (2) 1 unique name entity (individual or company), it is owner of the certificate, including user name, company, organization, city, address, national code, provincial, etc. (3) Digital signature: 1 certificate is signed by 1 distributor's entity, guaranteed that the certificate does contain another The public key of the entity (owner). (4) Identifier information of the distributor. For the recipient to verify his digital signature with the distributor's public key to check the legality of the certificate. However, the public key may be included in another certificate, and the digital signature needs to be verified with the public key of the distributor of another certificate, so nested until a public key is confirmed by the recipient. If the recipient cannot establish a trust chain, for example: 1 distributor's certificate is not legal, you can calculate the fingerprint with the keytool-import command, each fingerprint is a related short number, which is uniquely reliable to identify the certificate (a fingerprint is a The hash value of certificate information calculated by the information summary algorithm), the recipient can call the owner of the certificate and compare the issued certificate and the fingerprint of the reception certificate, if the fingerprint is the same, the certificate is different. Therefore, it is possible to ensure that the certificate is not modified during transmission. Another potential problem is the identity of the sender's identity, sometimes a certificate is self-signed, that is, the key is signed with the key corresponding to the public key in the certificate, if the recipient already knows or trust the sender, then there is no problem. . Otherwise, the sender needs to obtain a certificate from a trusted third party. This third party is usually a certificate of authorization agency CA, then send a self-signed certificate signing request CSR to CA, by the CA verification CSR signature and send CSR identity, license, and other information. The CA then the certificate of signing with the CA, authorizes the CSR's sender as the owner of the public key, and anyone can use it to verify the signature of the certificate, in many cases CA itself There is a certificate from a higher level of CA to constitute a certificate chain. All trusted certificate entities can be introduced into a key bar as a trust certificate, and the public keys in each certificate can be used to verify the signature generated with the corresponding key. The sender also provides a public key certificate corresponding to the signed key when sending a signature code and a document. With the keytool-export command or the API function, you can output a certificate into the file from the key library, and then send this file to the required recipient, and introduce it into the keystore by the recipient with the KeyTool-Import command or API function. If you use the Jarsigner tool to generate a signature for the JAR file, he will remove the certificate and certificate chain from the key library, and put it together with the signature in JAR files. The key and the corresponding public key certificate are placed in a database protected by the password, called a keystore. 1 key library contains two types of entries, trusted certificates entry, key and certificate entry, each contains 1 key and the key certificate corresponding to the key, and each entry in the key library has 1 individual name is identified. The owner of the 1 key library can have multiple keys in the key library, which can be accessed by different alias, each alias is usually named by a specific role of the key used by the owner of the key, and the alias can also be identified the key. the goal of. E.g: SignPersonalemail can be used to identify an entry for 1 key library, and its key is used to sign an individual email, Signjarfiles is used to identify one entry, and its key is used for signature JAR files. 3 Applet's digital signature authentication implementation specific method, step 3.1 Combined with my own Java2-based applet My project is to use Applet to make a real-time message queue monitor. Since local resources are involved, digital signatures and certifications must be performed on Applet. The environment I use is Windows2000, the application server is WebLogic 6.0, the development environment is JBuilder 4.0. I remind everyone to pay attention to the concept of the server and the client. Those files should be on the server, those files should be on the client. First, use JRE 1.3.0_01 (Java Run Environment 1.3.0.1 version) to replace the JVM (Java virtual machine) of IE, Www.java.sun.com go to download, download well, first installed on the client, the installation process is very simple. In the HTML file of the server-side call applet, it also need to include it in order to download the client download, the specific way of writing, please look down; Specific steps are as follows: Service-Terminal: 1. All package files need to be used in all package files (I have to use the weblogic JMS package to use the command jar xf weblogicc.jar), then use the JDK package command to compile the monitor. Class and the package just unzipped Pack into a package together. (Premise that I have placed the monitor and unlocked bags in the same directory), all the commands under the DOS state, see the bin directory of JDK1.3 (1.2), the command is as follows: Jar CVF Monitor.jar * .class This command generates a package called Monitor.jar 2. Create KeyStore and Keys for the package file created (Monitor.jar). The KeyStore will be used to store the private keys and public key certifications, and Alias alias is taken here for Monitor. The command is as follows: KeyTool -Genkey-Keystore Monitor.Keystore -Alaias Monitor This command generates a keystore file called Monitor.KeyStore, then this command, the system will ask you a lot of questions, such as your company name, your address, you have the password you want to set, etc., all by your casual write. 3. Sign by using the key you just generated to sign the JAR file The command is as follows: Jarsigner -keystore Monitor.KeyStore Monitor.jar Monitor This command will sign the Monitor.jar file without generating a new file. 4. Import the public key into a CER file, this CER file is the only file to copy to the client. . The command is as follows: Keytool -Export-Keystore Monitor.Keystore -Alaias Monitor -file Monitor.cer This command will generate a Monitor.cer authentication file, of course, these steps may ask you the password you just set. This completes the server side settings. At this time, you can copy the JAR file and the keystore file and the CER file (I am Monitor.jar, Monitor.KeyStore, Monitor.cer), I am using WebLogic6.0, so copy it to C: EAWLSERVER6.0CONFIGMYDOMAINAPPLICATIONSDEFAULTWEBAPP_MYSERVER is under a directory under its own. Client: 1. First, JRE 1.3.0_01 should be installed, and then copy the server-side Monitor.cer file to JRE's specific directory, I am here: C: Program filesjavasoftjre1.3.0_01libsecurity directory. 2. Pour the public key into JRE CACERTS (this is the default keystore of JRE) The command is as follows: KeyTool -Import -Alaias Monitor -file Monitor.cer -Keystore Cacerts Note that this is to enter the password of the cacerts, it should be Changeit, not your own keystore's password. 3. Modify the Policy policy file, use the command policytool system in the DOS state, will automatically pop up a policytool dialog, as shown in Figure 4, first select the Open item of the File menu, open C: Program Filesjavasoftjre1.3.0_01libsecurity directory Java.Poliy file, After selecting Change KeyStore in the EDIT menu, in the dialog box, enter file: / c: / program files /javasoft/jre/1.3.0_01/lib/security/cacerts, here should pay attention to the backslash, Enter JKS in New KeyStore Type, which is a fixed format of Cacerts, and then click Add Policyntry to enter CodeBase in the dialog that appears: http: // URL: 7001 / * The URL is the server's IP address, 7001 is my weblogic port, if you are in other application servers, such as Apache, that port number can be omitted. Enter (alias alias) in SignedBY: This is Monitor and click the Add Peimission button. In the PERMISSION, in the dialog that appears, select the permissions you want to give this applet, this is a lot of permissions, readers can find information to find themselves. I am using allpeimission, enter alias in the right signedby: Monitor is finally saved, in the File menu SAVE item. Of course, you can see that I have implemented signature authentication for multiple packages. This is completed so that the settings of the client. When the client is running the applet program with IE, you will ask if you authorize the signature, select Authorization, the package will automatically download from the server to the local computer, and IE will automatically start JRE, and you can see it in the lower right column. The Java console equivalent to IE. 4. Call an applet's HTML file Everyone knows that the HTML file for the normal call of Applet is no longer used by Java2 security, and it is changed to the ActiveX type call. Specific points in IE and Nescape Different Writings, this can find ready-made tutorials on Sun online. I don't have much to say, just give everyone the HTML written by IE.