Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘setForeGround’

JProgressBar – Long Running Task Progress

Java-Swing-JProgressBar-Example

After the JLabel, we have a JProgressBar component which occupies the entire width of the Frame window. Towards the bottom we have a JButton which will increment the progress bar value on each click. The first checkbox will set the progress maximum to 500 when checked. Second check box will change the JProgressBar Color and the third one will set the progress label on the progress bar. So, to test how ProgressBar works, one can make the combination of the three check boxes and use the JButton to mimic the progress of the long running task.

Continue Reading →

JTextField – Font, Color & Alignment

Java Swing - JTextField Example

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.

Continue Reading →