Hi Nagehan, >I want to select the shapes in my scene with the mouse, like that folders >are selected by operating systems. Press the button of the mouse and drag >it, select the shapes in the region whose bounds was drawing by mouse. Who >can help me?
This is just what I have been doing. You need the Drag and Drop API in AWT, and the picking API in Java 3D. For the Drag and Drop API, I used the example code at http://developer.java.sun.com/developer/qow/archive/1/index.html. I extend Canvas3D to implement DragSourceListener, DragGestureListener and DropTargetListener. To do the picking I use something like following code (in DragableCanvas3D) - public void dragGestureRecognized(DragGestureEvent e) { branchGroup = window.pickGraphic(this, e.getDragOrigin()); TransferableGraphic graphic = makeTransferable(branchGroup); if(graphic.getSceneRoot() != null) { dragSource.startDrag(e, DragSource.DefaultMoveDrop, graphic, this); } } And then in the window that holds the DragableCanvas3D - Note - scenes is a vector of nodes that are parents of the parts of the scene group that must be 'Drag and Drop'able. You must do sceneGroup.setCapability(Node.ENABLE_PICK_REPORTING) on each. public BranchGroup doPicking(Canvas3D pickFromCanvas, Point pickLocation) { PickCanvas pickCanvas = new PickCanvas(pickFromCanvas, universe.getLocale()); pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO); pickCanvas.setTolerance(5.0f); pickCanvas.setShapeLocation(pickLocation.x, pickLocation.y); PickResult pickResult = pickCanvas.pickClosest(); BranchGroup returnGroup = null; if (pickResult != null) { SceneGraphPath path = pickResult.getSceneGraphPath(); int pathLimit = path.nodeCount(); int scenesLimit = scenes.size(); Node node; for(int i = 0; ((i < pathLimit) && (returnGroup == null)); ++i) { node = path.getNode(i); for(int j = 0; ((j < scenesLimit) && (returnGroup == null)); ++j) { if(node.equals(scenes.elementAt(j))) { returnGroup = (BranchGroup) scenes.elementAt(j); } } } } return returnGroup; } I hope this helps. Let me know on or off list if you want any more of the code or other help. Good luck, Hugh =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".