RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Introduction to Java Interface Event-Handling : Page 2

Java is an event-driven language. This means that program flow usually varies dependent upon what actions a user performs, and differs from traditional procedural-based languages where program execution was very linear. Here's what you need to know to make your Java programs respond to events such as the user moving the mouse or clicking a button.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Listing 1 contains the code for a simple Java applet that displays a button. When a user clicks the button the code changes the background color of the button in a round-robin fashion based on a index into the private strColors[] array. Because it's an applet, you cannot run it directly as a Windows application—it must be embedded into an HTML page. Listing 2 gives the HTML tags for such a page.

Figure 1 and Figure 2 show the sample applet in action.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date