Browse DevX
Sign up for e-mail newsletters from DevX

Search the Tips
Tip Bank > Java > Java APIs > AWT


1-20 of 104     Previous     Next
Monitoring AWT Events with the AWTEventListener Class
by Leonard Anghel
The AWTEventListener class' sole purpose is to view events. All you have to do is to implement the eventDispatched method.
Using the FOP-to-AWT Viewer
by Leonard Anghel
When you want to use the FOP-to-AWT Viewer from a Java application, you can use the ExampleAWTViewer.java.
How to Unhook Subclassing when Windows is Ready
by Simon Bryan
Why You Shouldn
by Nitin Garg
There are fundamental incompatibilities between the ways AWT and Swing draw themselves. Swing classes are pure Java classes that look the same on all operating systems. AWT Java classes are not ...
Mouse movement control
by DevX Pro
Can you tell me if there's a way that I can force the mouse to move to a certain position on the screen, e.g. 20 pixels down, 15 pixels left, etc.?
TextField Max Characters
by DevX Pro
How do I restrict the number of characters to be entered in a TextField?
Switching Between Frames
by DevX Pro
I'm building an application that has several different frames. Each has a button that when pressed should bring up a new frame and close the calling frame. How can I display the new frame and close the calling frame?
Determining the Top Level Frame
by DevX Pro
I have developed a custom AWT component that can be placed at any level in a component hierarchy. How can it determine the top level Frame in the hierarchy?
Mouse Click Coordinate
by DevX Pro
I know how to detect a mouse click with a MouseListener, but how do I obtain the coordinates associated with the click?
Manually Positioning Buttons in a Java Applet
by Manoj K
You can use Java's layout managers to maintain the relative position of objects in an applet without manually repositioning them as the applet's size changes. However, you may occasionally want to ...
AWT Thread Interaction
by DevX Pro
I have two threads in an application. Thread A displays a form and allows the user to interact with it, thread B executes a loop which continually retrieves data and updates the form object by executing a synchronized method in the form object. I first tried to code thread A to use the showDialog() method on the form object, then started thread a and then thread b. However, thread a starts and the form then waits to be closed before the statement starting thread b is executed. I then tried just using the show() method in thread a - this allows the start of thread b to execute but I lose my interaction with the form.
Textfield Alignment
by DevX Pro
How do I right align numbers in a textfield?
Paint Outside The GUI Thread
by Behrouz Fallahi
A call to repaint() will schedule a component to be repainted when the gui thread is free. But what if we can't wait till ...
Textfield With Limited Length Of Characters
by Behrouz Fallahi
Sometimes it is useful to have a text field, for which you can specify a max number of characters. The following class give you just ...
The Robots of Java
by Behrouz Fallahi
Version 1.3 of Java 2 platform, currently in Beta, has a new java.awt.Robot class that lets you generate mouse and key events at system level. You can use this to enhance accessibility offered by ...
Use Escape Key to Close Your AWT Dialogs
by Behrouz Fallahi
It has become customary for Microsoft Windows users to close an active window by pressing the escape key. It is not that easy to intercept key events in Java. This is because key events go directly ...
Scrollbar Value Notification
by DevX Pro
Is there a way that I can dynamically determine the value of a Scrollbar when I am scrolling? The adjustmentValueChanged method gets called only when you stop scrolling. But I want to catch the value of the scrollbar when I press on the scrollbar and I am dragging it. Is there a way to do this?
by DevX Pro
I am trying to put all the checkboxes in a CheckboxGroup into an unselected state, but Checkbox.setState(false) does not automatically unselect the checkbox once a checkbox has been selected within a CheckboxGroup. How can this be done?
Create a Label With Underlined Text
by Behrouz Fallahi
The following class will give you a label with underlined text.
Aligned Columns in java.awt.List
by Behrouz Fallahi
You can use, or extend, java.awt.List to create a simple multi-column list. In order to do so, you need to use a fixed character width font set like Courier.
1-20 of 104     Previous     Next
Thanks for your registration, follow us on our social networks to keep up-to-date