Make favorite buttons more compact.

Make the scrollbar less sensitive for AutoScroll.
This commit is contained in:
Steven Lawson 2014-08-29 22:41:44 -04:00
parent 7c148988f9
commit 680df00aec
2 changed files with 17 additions and 6 deletions

View file

@ -29,7 +29,7 @@ public class BTC_FavoriteButtonsPanel extends JPanel
{
public BTC_FavoriteButtonsPanel(final Collection<FavoriteButtonEntry> buttonList)
{
super.setLayout(new GridLayout(0, 2, 1, 1));
super.setLayout(new GridBagLayout());
final ActionListener actionListener = new ActionListener()
{
@ -43,6 +43,8 @@ public class BTC_FavoriteButtonsPanel extends JPanel
}
};
int x = 0;
int y = 0;
for (final FavoriteButtonEntry buttonData : buttonList)
{
final JButton button = new JButton();
@ -50,11 +52,20 @@ public class BTC_FavoriteButtonsPanel extends JPanel
button.setActionCommand(buttonData.getCommand());
button.addActionListener(actionListener);
final Dimension max = button.getMaximumSize();
max.setSize(max.getWidth(), 10);
button.setMaximumSize(max);
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = x;
gridBagConstraints.gridy = y;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.ipadx = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
add(button, gridBagConstraints);
add(button);
if (++x > 1)
{
x = 0;
y++;
}
}
}

View file

@ -161,7 +161,7 @@ public class BTC_MainPanel extends javax.swing.JFrame
if (!vScroll.getValueIsAdjusting())
{
if (vScroll.getValue() + vScroll.getModel().getExtent() >= (vScroll.getMaximum() - 10))
if (vScroll.getValue() + vScroll.getModel().getExtent() >= (vScroll.getMaximum() - 50))
{
BTC_MainPanel.this.mainOutput.setCaretPosition(startLength);