Java basics-something about J2SE-general Linux technology-Linux programming and kernel information. For more information, see the following. In java, the development interface is annoying. Pay attention to the following issues:
1. Jframe cannot be placed in JPanel, which is different from iframe in html.
2. the dialog in java is not completely controlled, except for the default prompt dialog boxes.
3. If the layout needs to be free, select null and locate it directly. To make it universally available, you can combine Dimension screenSize = Toolkit. getdefatooltoolkit (). getScreenSize ();
Dimension frameSize = frame. getSize ();
4. Use tools (JBuilder or eclipse) to complete non-business operations.
5. Do not initialize the interface control multiple times in java. Otherwise, one click will appear as multiple clicks (the control is in the same position)
When packaging a jar file, note that it is not. class configuration file location and reference, if getClass () appears (). after getResource ("image \ dl.jpg") is packaged, the interface cannot be run because it may not find the file.
There are two ways to read images from the java interface:
1. Image image1 = Toolkit. getdefatooltoolkit (). createImage (getClass (). getResource ("image \ dl.jpg "));
This. setIconImage (image1 );
2. File file3 = new File ("success.gif ");
Image1 = javax. imageio. ImageIO. read (file3 );
ImageIcon icon1 = new ImageIcon (image1 );
JLabel2.setIcon (icon1 );
Note: The second method is not feasible to change the title icon.
Add a package-related problem: when there is a call relationship between programs, there are two methods: 1) package to the agreed directory; 2) import, when not registered, put the package in the same directory of the called program, or register it in the environment variable.
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.