The example shows three JTextFields. Each text fields contains the text in different text colour. Also, we may notice that the texts alignments are different. First JTextField shows the text left aligned. The second control shows the text aligned towards the middle of the text field. Final text field shows the text right aligned. You may also notice we display all texts in a bigger size than the default.
This example has four JLabels in it and a FlowLayout Manager is taking care of laying out these labels. Each label uses a unique border to draw around it. Since JLabel is a component, one can apply the same technique for other components as well. For example, a JTextField can use same technique to draw the border. Now, we can have a look at the Bevel Raised border in the picture above and the JLabel looks like a button, right? But it is not. We also set a Font for all the JLabels in this example.
The below picture shows the example which we will create here. In the AWT Frame, we will display only one button. The button Do Task will open a AWT Window which shows a status message for a small while. This window is a sign to the user that some processing is going on. But our example mimics the long-running task with the ‘Thread.sleep’ method. After a few seconds, the window closes automatically. You can use this same example to create a flash window. Here, we displayed some text in the window. In a flash window, you can display an image to show your brand.