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 ‘setBackground’

Java AWT Scrollbar Example

About AWT Scrollbar Example

In our example, we will have three panels and the AWT Frame hosts them via BorderLayout manger. The top panel hosts three AWT Scrollbar controls to denote red, blue, green color values. Middle panel will live in the centre part of the Frame Window. Gray Scale check box will sit in the South part of the Frame window’s border layout.

All three AWT Scrollbar together represent an RGB color value. So, each Scroll can produce a range of values which falls between 0 to 255. When the user adjusts the Scrollbar, we will create RGB Color and apply that to the panel in the middle of the Frame. When Gray Scale is in checked state, we produce the grey-scaled color and apply that to the middle panel. This example helps you to learn how to use AWT Scrollbar and how to handle the AdjustmentEvent raised by it.

Continue Reading →