Home » Desktop Java » awt (page 5)

awt

HyperLinkListener example

With this example we shall show you how to use a HyperLinkListener in Java. This is very useful when you have hyperlinks in the content you present in your application. In that case it might be important to monitor the hyperlink activity of the applications. For example, you might want to interact somehow with the user every time he clicks ...

Read More »

FocusListener example

This is an example that discusses how to use FocusListener in Java. This is a very handy feature when you have several components and you want to monitor and handle the event when on of them gains or looses focus. In short, all you have to do in order to work with a FocusListener is: Create a new FocusListener Override ...

Read More »

ContainerListener example

In this example we shall show you how to use a ContainerListener in Java. When you develop an Application with dynamic GUI features it’s very important to monitor the activities of the components that are added or removed from a component container, and that is the job of the ContainerListener. In short to work with a ContainerListener you have to: ...

Read More »

Maximization event example

With this tutorial we shall show you how use the ComponentListener interface to handle Maximization events in your Java Application. The basic idea is very simple. We want the user to be noted every time he maximizes a certain window in our Application. This is very important when your application has to handle many different windows an you want to ...

Read More »

Print window position example

In this example we are going to see how to use a ComponentListener in order to print the window position in a Java application. The position of the window will be updated every time the user changes position to the window. This may be useful when you want your application to react differently depending on the position of the window. In ...

Read More »

ComponentAdapter example

In this tutorial we are going to see how to use the ComponentAdapter class in Java. In some ways the ComponentAdapter is quite similar to the ComponentListener interface, but being a class it can be used more robustly, among some other features it implements . In this example we are going to see how to monitor the window position of a window in you application.The position ...

Read More »

ComponentListener example

With this example we are going to see how to use a ComponentListener in order to monitor the window events in our Java Application. This may be useful when you want your application to react differently depending on the position or the kind of movement of the window. In short, to work with the ComponentListener interface, one should follow these steps: Create a class ...

Read More »

AncestorListener example with timer

In this example we are going to see how AncestorListener can be paired with a timer in Java. This is very useful when you add or remove components to your Java Application and you want to monitor the relationship changes that follow these actions. Basically, all you have to do in order to work with AncestorListener with a timer in ...

Read More »

AdjustmentListener example

In this tutorial we are going to see how AdjustmentListener works in Java. It is quite useful when you want to monitor a very wide variety of changes in a program with rich GUI components. For example if you bundle an AdjustmentListener with a scroll pane every time a value or a property of that component changes, the corresponding event ...

Read More »

Java ActionListener example

In this tutorial we are going to see how ActionListener works in Java. This is one the most important components you have to work with when you’re developing a GUI Application. The ActionListener in able to monitor a number of important events that occur in GUI Apps. In short, all you have to do to work with an ActionListener in ...

Read More »