Using SWINGX and timingframework to implement fade and fade

Source: Internet
Author: User

This article uses SWINGX and timingframework to show how to achieve the fade effect, the procedure is concise and practical, hope to be helpful to everybody.

Using Alphacomposite in swing allows you to set the opacity of the interface, and then work with Javax.swing.Timer to make it easier to fade in. But we need to inherit the specific UI component and rewrite its Paintcomponent method, while also providing a ActionListener implementation for the timer. This is a bit tedious for programmers.

Fortunately, Jxpanel (JPanel subclasses) in Swingx the Setalpha method to set the half transparency, and all UI components in the Jxpanel can be semi-transparent. The animator provided by Timingframework can help us to set the alpha value of Jxpanel in a non-linear way. Therefore, we in the implementation of fade, you can use Jxpanel to replace JPanel, with animator to replace the timer.

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.