JTextField – Font, Color & Alignment

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.

SQL CLR Trigger Explained

 In the last article, we saw creating a SQL CLR Function. I would suggest reading that article first before reading this one. Like CLR function, one can write SQL Trigger also in the C-Sharp. In this article, we will learn to create the SQL CLR Trigger and execute that in SQL Server Management studio. In this example, we are going to write a CLR Trigger that does not allow entering the Negative Bonus in the Emp table.

JLabel Border and Font

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.

Java AWT Dialog Example

In this example, we create AWT Frame which shows personal data. Here, fields Name and Age collect user input from the Frame itself. Address multi-line text field is read-only and ellipsis button next to it will launch a dialog to gather user input. The frame wants to display the address in a precise format and hence it invokes the dialog. Once the dialog is displayed as modal, the code execution in the Frame window is blocked. This means, the user can not interact with any of the UI components in the Frame Window before closing the dialog. In the dialog, the user can fill the details required for the address field and click OK. Or they can also click Cancel and that is not a usual workflow. the address information from the dialog and displays that in address multi-line field. Note, the frame gets the address in a formatted way from the dialog. Since, address field is disabled, the user can not edit its content manually. They can feed the address only via the dialog and there by the frame gets the formatted address.