Java tips articles

Source: Internet
Author: User
ArticleDirectory
  • 2. A problem when converting a common application into an applet
1 Java, Conditional compilation
Java does not have a Conditional compilation mechanism similar to C/C ++ Because Java considers itself cross-platform, the previous Conditional compilation was designed to solve the problem of C/C ++ quick platform. However, Conditional compilation and translation can also be used for debugging. ProgramYou can introduce the assertion mechanism commonly used in C, that is, create an assertion class, and define an empty assertion class to put it in a different namespace. CodeYou only need to import the package of the empty assertion class to the original program when you change the debugging version to the shipping version. This technique can be used in any type of Conditional compilation program code.

Now 1. Version 4 seems to be able to use assert and assert mechanisms.

2. A problem when converting a common application into an applet

Basically, an application has a jframe as the outer frame. However, jframe cannot be added to the applet; otherwise, the prompt is: you cannot add a window to the applet (jframe extends window ).
Add jframe. getcontentpane () instead of directly adding jframe.

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.