Posts about java

JAVA vertical gradient background panel

24 January 2015

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;...

JAVA JScrollPane change scroll amount/increment

24 January 2015

yourScrollPane.getVerticalScrollBar().setUnitIncrement(85);

JAVA JScrollPane change scrollbar width or height

24 January 2015

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));

Displaying posts 4 - 6 of 10 in total