Posts about java
Recently i had to create a gradient background for one of the panels in our [POS application](http://inforviegas.pt/wp-content/uploads/2010/09/VOS.jpg), so i though i'd share the code.
You need to pass the top and bottom colors of the gradient and also make sure that any panels inside this one are transparent (i.e. setOpaque(false)), otherwise they will paint above it.
import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D;...
It's actually pretty simple. Just do something like this, adjusting to the horizontal scrollbar and/or the height that you want:
yourScrollPcane.getVerticalScrollBar().setPreferredSize(new Dimension(85, Integer.MAX_VALUE));