Allow flexibility about which button is used for dragging.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1592 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -133,6 +133,14 @@ public class ScrollBox extends JPanel
|
|||||||
_box.height = (int) Math.round(_vert.getExtent() * _vFactor);
|
_box.height = (int) Math.round(_vert.getExtent() * _vFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the specified button is ok for dragging the box around.
|
||||||
|
*/
|
||||||
|
protected boolean isActiveButton (MouseEvent e)
|
||||||
|
{
|
||||||
|
return e.getButton() == MouseEvent.BUTTON1;
|
||||||
|
}
|
||||||
|
|
||||||
/** The bounds that we observe / modify. */
|
/** The bounds that we observe / modify. */
|
||||||
protected BoundedRangeModel _horz, _vert;
|
protected BoundedRangeModel _horz, _vert;
|
||||||
|
|
||||||
@@ -150,7 +158,7 @@ public class ScrollBox extends JPanel
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void mousePressed (MouseEvent e)
|
public void mousePressed (MouseEvent e)
|
||||||
{
|
{
|
||||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
if (isActiveButton(e)) {
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
|
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
|
||||||
Point p = e.getPoint();
|
Point p = e.getPoint();
|
||||||
if (_box.contains(p)) {
|
if (_box.contains(p)) {
|
||||||
@@ -180,7 +188,7 @@ public class ScrollBox extends JPanel
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void mouseReleased (MouseEvent e)
|
public void mouseReleased (MouseEvent e)
|
||||||
{
|
{
|
||||||
if (e.getButton() == MouseEvent.BUTTON1) {
|
if (isActiveButton(e)) {
|
||||||
setCursor(null);
|
setCursor(null);
|
||||||
_lastPoint = null;
|
_lastPoint = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user