/** Activates or deactivates Drag support on asociated JTree * component * @param active true if the support should be active, false * otherwise */ public void activate (boolean active) { if (this.active == active) return; this.active = active; DragGestureRecognizer dgr = getDefaultGestureRecognizer(); if (active) { dgr.setSourceActions (getAllowedDragActions ()); try { dgr.removeDragGestureListener(this); dgr.addDragGestureListener(this); } catch (TooManyListenersException exc) { throw new IllegalStateException("Too many listeners for drag gesture."); // NOI18N } } else { dgr.removeDragGestureListener(this); } }
/** Activates or deactivates Drag support on asociated JTree * component * @param active true if the support should be active, false * otherwise */ public void activate (boolean active) { if (this.active == active) return; this.active = active; DragGestureRecognizer dgr = getDefaultGestureRecognizer(); if (active) { dgr.setSourceActions (getAllowedDragActions ()); try { dgr.removeDragGestureListener(this); dgr.addDragGestureListener(this); } catch (TooManyListenersException exc) { throw new IllegalStateException("Too many listeners for drag gesture."); // NOI18N } } else { dgr.removeDragGestureListener(this); } }
/** Activates or deactivates Drag support on asociated JTree * component * @param active true if the support should be active, false * otherwise */ public void activate(boolean active) { if (this.active == active) { return; } this.active = active; DragGestureRecognizer dgr = getDefaultGestureRecognizer(); if (dgr == null) { return; } if (active) { dgr.setSourceActions(getAllowedDragActions()); try { dgr.removeDragGestureListener(this); dgr.addDragGestureListener(this); } catch (TooManyListenersException exc) { throw new IllegalStateException("Too many listeners for drag gesture."); // NOI18N } } else { dgr.removeDragGestureListener(this); } }