BoundedRangeModel hModel = new DefaultBoundedRangeModel(iX,iEX,0,iW); horizontalBar.setModel(hModel);
try { BoundedRangeModel hModel = new DefaultBoundedRangeModel(iX,iEX,0,iW); horizontalBar.setModel(hModel); } catch(IllegalArgumentException iae) { System.err.println("illegal width:["+iX+","+iEX+",0," +iW+"]"); iae.printStackTrace(); }
            public void cameraBoundsChanged(double valueX, double valueY,                                            double extentX, double extentY,                                            double width, double height)            {                int iX = (int)Math.round(valueX);                int iY = (int)Math.round(valueY);                int iEX = (int)Math.round(extentX);                int iEY = (int)Math.round(extentY);                int iW = (int)Math.round(width);                int iH = (int)Math.round(height);                                BoundedRangeModel horizModel = horizontalBar.getModel();                BoundedRangeModel vertModel = verticalBar.getModel();                                if(iEX+iX > iW) horizontalBar.setEnabled(false);                else                {                    horizontalBar.setEnabled(true);                    if(iW != horizModel.getMaximum() ||                       iEX != horizModel.getExtent())                    {                        BoundedRangeModel hModel =                            new DefaultBoundedRangeModel(iX,iEX,0,iW);                        horizontalBar.setModel(hModel);                    }                    else                    {                        horizModel.setValue(iX);                    }                }                                if(iEY+iY > iH) verticalBar.setEnabled(false);                else                {                    verticalBar.setEnabled(true);                    if(iH != vertModel.getMaximum() ||                       iEY != vertModel.getExtent())                    {                        BoundedRangeModel vModel =                            new DefaultBoundedRangeModel(iY,iEY,0,iH);                        verticalBar.setModel(vModel);                    }                    else                    {                        vertModel.setValue(iY);                    }                }            }