How to make shape objects clickable/selectable in transformgroups in java 3

I am building a visualizer program that has Java 3D components inside Swing components. I have a branchgroup inside a canvas3d inside a simpleuniverse, which is added to a JTabbedPane. Inside the branchgroup I have multiple transformgroups each with one shape in them (box, cone, sphere, cylinder). Each transformgroup has the ability to rotate, zoom, and tranlate objects because I have incorperated a MouseZoom, MouseRotate, and MouseTranslate object as from the Java 3D library functions (these are applied to each transformgroup every time one is created and added to the branchgroup). My problem is that I am trying to make these shapes clickable/sectable/dragable/dropable on the screen - currently when I try to translate ONE object all the shapes move on the screen and I cannot get just one shape to move (all shapes move when I only want one to). How do I make only one shape move when it is clicked?
I know the question is kind of out there and specific so if anyone knows how to generically give transformgroups/shapes drag and drop properties that would also help a great deal. Does anyone know how to to this? Thanks a ton.

shape uses the contains and intersects methods, is that what you need? Without code it is hard to guess what is required.

Similar Messages

  • How to make path object clickable in flex 4.0

    hi , i apprechiate if any one can help me out  with my problem here as i am new to flex
    I am developing a flex web application and in one my components i need to draw paths around some shapes , i did this easily but my problem is that i need to make changes in response to user  mouse click or mouse hover events over that path.
    the problem is that the path object do not have any events accept the activate event. any one can help me out on this one .

    thanks for your reply but my problem is not to recreate the path based on an event
    what i need is to listen to the click event on the path itself after it is created and diplayed to the user so that when the path is clicked i can change application state.

  • How to make any object self-shining?

    hi,
    i guess thats an easy question, but i dont know where to look for the answer.
    so how to make any object self-shining like the infamous colorcube, so that one does not need to place any light?
    and am I right in my assumption that doing so will reduce the need of rendering power, since lights dont have to be computed?
    thanx,
    Usul

    I'm not sure what you mean here- if your object is lit then lighting will need to be calculated. If you don't want shapes to be lit, I think you can disable it by calling setLightingEnable(false) in their materials.

  • HOw to make an Object oriented alv respond to double click

    Hi all,
    HOw to make an Object oriented alv respond to double click.SAmple code will be helpful.
    Thanks in advance,
    Alex.

    Hi,
    1. Create a Control (for Custom and Split Containers only)
    2. Instantiate a Container Object (in case of Custom and Split Containers, specify the control which is created by us in Screen painter) CREATE OBJECT
    3. Instantiate an Object of the kind of report that has to be displayed (List, Grid or Tree). CREATE OBJECT . Here we need to specify the Parent Container as the so that it sits in that container.
    4. Call appropriate methods to display the report on the screen. CALL METHOD ->
    DATA : g_dock TYPE REF TO cl_gui_docking_container,
    g_split TYPE REF TO cl_gui_easy_splitter_container,
    g_cont1 TYPE REF TO cl_gui_container,
    g_cont2 TYPE REF TO cl_gui_container,
    g_grid1 TYPE REF TO cl_gui_alv_grid,
    g_grid2 TYPE REF TO cl_gui_alv_grid.
    i_mara is an internal table of structure MARA
    SELECT * FROM mara INTO TABLE i_mara.
    i_kna1 is an internal table of structure KNA1
    SELECT * FROM kna1 INTO TABLE i_kna1.
    To create an Object of type Docking Container
    CREATE OBJECT g_dock
    EXPORTING
    side = cl_gui_docking_container=>dock_at_top
    extension = 200 .
    To Create an Object of Type Split Container. Here we can see that the Docking *Container Created above has been used as a parent .
    CREATE OBJECT g_split
    EXPORTING
    parent = g_dock
    orientation = 1 .
    Easy Split container splits one Control into 2 manageable controls, each of them is used * to handle one GUI Container each
    g_cont1 = g_split->top_left_container.
    g_cont2 = g_split->bottom_right_container.
    To Create an Object of type Grid . Here we can see that the Left Split Container * Created above has been used as a parent .
    CREATE OBJECT g_grid1
    EXPORTING
    i_parent = g_cont1 .
    To Create an Object of type Grid . Here we can see that the Right Split Container * Created above has been used as a parent .
    CREATE OBJECT g_grid2
    EXPORTING
    i_parent = g_cont2 .
    The method of Grid Control Object is used to display the Data.
    CALL METHOD g_grid1->set_table_for_first_display
    EXPORTING
    i_structure_name = 'MARA'
    CHANGING
    it_outtab = i_mara[] .
    The method of Grid Control Object is used to display the Data.
    CALL METHOD g_grid2->set_table_for_first_display
    EXPORTING
    i_structure_name = 'KNA1'
    CHANGING
    it_outtab = i_kna1[] .
    Regards
    Hari

  • How to make first row as selected in af:table

    Hi,
    I am using JDeveloper 11.1.1.4 and ADF-BC in my application.
    In all the pages across my application we have multi select enabled for the table[af:table].
    But when the pages are displayed,the first row is not selected by default.
    My requirement is to display first row as selected across all the tables in my app.
    I have the selectionListenerset as for example selectionListener="#{bindings.RSCMapVO2.collectionModel.makeCurrent}" in all the pages.
    Please suggest on how to make first row as selected.
    Regards,
    Praveen

    Hi
    Put these codes in your selection listner method(You have to define a selectionListner method in your backing bean and put this code segment
    (Special thanks go to Franks how posted this code segment. threadID=1089583)
    RichTable yourTable = (RichTable) selectionEvent.getSource();
    //the Collection Model is the object that provides the structured data
    //for the table to render
    CollectionModel yourTableModel = (CollectionModel) yourTable.getValue();
    //the ADF object that implements the CollectionModel is JUCtrlHierBinding. It
    //is wrapped by the CollectionModel API
    JUCtrlHierBinding yourTableBinding = (JUCtrlHierBinding) yourTableModel.getWrappedData();
    //Acess the ADF iterator binding that is used with ADF table binding
    DCIteratorBinding yourTableIteratorBinding = yourTableeBinding.getDCIteratorBinding();
    //the role of this method is to synchronize the table component selection
    //with the selection in the ADF model
    Object _selectedRowData = yourTable.getSelectedRowData();
    //cast to JUCtrlHierNodeBinding, which is the ADF object that represents
    //a row
    JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding) selectedRowData;
    //get the row key from the node binding and set it as the current row in the
    //iterator
    Key rwKey = nodeBinding.getRowKey();
    tableIteratorBinding.setCurrentRowWithKey(rwKey.toStringFormat(true));
    Thanks
    Padma

  • How to make an object mutable?

    Can any one tell me how to make an object mutable?
    Following is Class X & Y?
    class Y
    public static void main(String arg[]) {
    X a1=new X();
    Object a=a1.get();
    System.out.println(a.toString());
    a1.set(a);
    System.out.println(a.toString());
    class X implements Serializable
    public Object get(){
    return new Object();
    public synchronized void set(Object o)
    o=null;
    In my class Y when i say
    a1.set(a);
    I want local Object a of main method should be nullified.
    Can it be possible if yes what is the way or code to be applied so that
    my next a.toString() statement will give me NullpointerException.

    Isn't it more accurate to say that object references are passed by value?
    OP -- Basically you can't to what you want to do. When you "pass an object" as a method parameter, what you're really passing is a copy of the reference that points to the object. You now have two refs pointing to the same object--one in the caller and one in the method being executed. Setting either of those refs to null does NOT affect the object itself, and does NOT affect the other ref. It just means that the ref that's been set to null no longer points to any object.
    If you want the called method to make a change that the caller can see, you need to either 1) return a value from the method, 2) encapsulate the object to be changed as a member of new class, or 3) pass the object to be changed as the single element of an array. I would STRONGLY recommend against (3) as a way to simulate pass by reference. Better to examine your design and determine whether (1) or (2) more closely matches what you're really trying to accomplish.

  • How to make an object distributed across multiple jres?

    Hi,
    We used cache data mechanism for performance tuning. It will store data in static variable (Hashtable) and get initialized when app starts . We are using IPlanet Application Server and
    Using 6 KJS engines. This object ( Hashtable) is not distributed across all JRES.It has to reinitialize data again when request goes to any other KJS.
    We avoid sharing data in session and request, as data is huge.
    Can any one help us how to make this object distributed across all KJSs?
    Thanks in advance.
    raj

    We used cache data mechanism for performance tuning.
    It will store data in static variable (Hashtable) and
    get initialized when app starts.
    We are using IPlanet Application Server and
    Using 6 KJS engines. This object ( Hashtable) is not
    distributed across all JRES. It has to reinitialize
    data again when request goes to any other KJS.
    We avoid sharing data in session and request, as data
    is huge.
    Can any one help us how to make this object
    distributed across all KJSs?When you say 'initialized when app starts' do you mean iPlanets StartUp classes, rather than the Servlets init() ? Given a 'huge' dataset, avoid the latter.
    I'd suggest that a better approach is to implement this as an Entity Bean and accessed from Session bean and using Value Objects to return the data subsets.
    Checkout the Java Pet Store
    http://java.sun.com/blueprints/code/jps13/datasheet.html

  • How to make default values in selection field?

    hi,
          i have selection field date , using data element 'QENTST' using following code in view INIT Method. i get the input selection field when i test application.
    DATA: LT_RANGE_TABLE TYPE REF TO DATA.
    CALL METHOD WD_THIS->M_HANDLER->CREATE_RANGE_TABLE
      EXPORTING
        I_TYPENAME                     =     'QENTST'
      RECEIVING
        RT_RANGE_TABLE           =     LT_RANGE_TABLE.
    CALL METHOD WD_THIS->M_HANDLER->ADD_SELECTION_FIELD
      EXPORTING
        I_ID                                     = 'QENTST'
        IT_RESULT                         = LT_RANGE_TABLE
        I_OBLIGATORY                 = ABAP_TRUE.
    What i need now , to make default value in this selection field( low = sy-datum and high = sy-datum + 10 ) . I have checked , i found one method called... SET_RANGE_TABLE_OF_SEL_FIELD. Bt i m not able to understand how to assign values to input table parameter in this method?
    Thanks In Advance.
    Saurin Shah

    Hi,
    Refer this Article by Thomas on how to make default values in Select Options:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60474842-91ca-2b10-3390-d2fd30f335fd
    I hope it would solve your problem.

  • How to make a field in selection screen as READ_ONLY !!

    Hi,
       How to make a field in selection screen as READ_ONLY !!.
    Thanks,
    Senthil

    This is the code you need to have in your program.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF SCREEN-NAME = 'MYSELFLD'.
        SCREEN-INPUT = 0.
        MODIFY-SCREEN.
      ENDIF.
    ENDLOOP.

  • How to make required field on selection screen in Query

    i'm now working with query(SQ01).
    but don't know how to make required field on selection screen in Query.
    thanks in advance

    i'm now working with query(SQ01).
    but don't know how to make required field on selection screen in Query.
    thanks in advance

  • How to make Shape3D object translucent

    Hi,
    How to make Shape3D object (like Box, Cylinder) translucent? I tried the below option but the box is not becoming translucent at all.
    final PhongMaterial redMaterial = new PhongMaterial();
              redMaterial.setSpecularColor(Color.rgb(10, 255, 15, opacity));
              redMaterial.setDiffuseColor(Color.rgb(10, 255, 15, opacity));
    final Box box = new Box(width,height,depth);
    box.setMaterial(redMaterial);
    When opacity is 1, the color of the box will be Green, when it is 0 the color becomes black.
    Is there any way the box can be made translucent?

    There is at least one unresolved issue concerning PhongMaterial's transparency: RT-28874.
    I'm neither able to get it working properly. My red Sphere also fades to black while varying the opacity value from 1.0 to 0.0.
    August

  • How to make form fields "Clickable"

    Hey Guys,
    I created a Fillable PDF Form with Form fields using ADOBE Acrobat 9.0 Pro-Ex + LiveCycle Designer for Windows XP.
    My question is when you create a form, is there a way to make form fields "clickable" instead of just auto-tab? Because if you mess up when filling out the form, you don't want to have to tab through the whole document just to get back to that spot. How can i fix that?
    My other question is, when printing the form, the form field "text boxes" always show up. Is there a way to hide the boxes and just print the form without them. (The information that was filled in will still show, just the outline of the boxes won't?)
    Thanks a bunch,
    Joseph

    Unfortunately I don't know enough about Designer to tell you what you did to make the boxes unclickable, but for me I've never had an issue doing that.
    However, I can tell you what you need to do to get rid of the boxes around each of your text fields.
    1. In design mode, select the field(s) you wish to get rid of the borders on. (If all you have are text fields, you can press Ctrl+A to select all fields. If not, you can hold down the Ctrl button while left-clicking each field to change all text fields at once.)
    2. Open the Object window (Shift+F7 toggles this on and off). Find the option for Appearance.
    3. Click the drop down menu next to Appearance and choose none.
    4. The borders will now be gone from the text fields.

  • How to make a row as selected in output internal table in oops ALV

    Hi All,
    I have ALV grid output using oops ALV concept, in my output i have a checkbox as first column when i select this checkbox and press a push button 'Print' which is there above ALV grid that particular line in output table should get selected and i need to code some logic for printing selected row.
    how to make the particluar row in the output internal table to be selected and where to write the logic for print once it is pressed?
    Thanks in advance
    Srilakshmi.

    but the checkbox is not getting set in internal table when i select some checkboxes.
    can anybody explain y the checkbox in internal table not set?
    Hi Srilakshmi,
    As explained by Uwe, when we change a field ( say check box ) in ALV grid, the view (frontend) changes (showing the tick mark) but the changed data ( normally ) is not transfered to the backend.
    We can initiate this data transfer by just registering the cl_gui_alv_grid=>mc_evt_modified  edit event
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
    Now as soon as we check a checkbox, the data_changed event is triggered.
    This initiates data transfer to the backend and the checkbox field in internal table is updated.
    check the below code for example.
    DATA: go_cont            TYPE REF TO cl_gui_custom_container,
          go_grid            TYPE REF TO cl_gui_alv_grid,
          gt_fieldcat        TYPE lvc_t_fcat,
          gv_language        TYPE spras VALUE 'E',
          gt_outtab          TYPE TABLE OF bus_loca_demo WITH HEADER LINE.
    START-OF-SELECTION.
      CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'BASIC'.
      SET TITLEBAR  '001'.
      PERFORM create_and_init_alv CHANGING gt_outtab[]
                                           gt_fieldcat.
    ENDMODULE.                    "pbo OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'PRINT'.
          BREAK-POINT.
      ENDCASE.
    ENDMODULE.                    "pai INPUT
    FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                      pt_fieldcat TYPE lvc_t_fcat.
      CHECK go_cont IS NOT BOUND.
      CREATE OBJECT go_cont
        EXPORTING
          container_name = 'CUSTOM'.
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = go_cont.
      PERFORM build_display_table.
      PERFORM build_fieldcat CHANGING pt_fieldcat.
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified ). " This does the trick
    ENDFORM.                               "CREATE_AND_INIT_ALV
    FORM build_display_table.
      FREE gt_outtab.
      DO 10 TIMES.
        gt_outtab-creation_partner = sy-index.
        gt_outtab-date_field       = sy-datum.
        APPEND gt_outtab.
      ENDDO.
    ENDFORM.                               "build_display_table
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'BUS_LOCA_DEMO'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'CHECKBOX'.
            ls_fcat-checkbox = 'X'.
            ls_fcat-edit     = abap_true.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'ENTER_FIELD' OR 'DBLCLICK_FIELD'.
            ls_fcat-no_out  = abap_true.
            MODIFY pt_fieldcat FROM ls_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                               "build_fieldcat
    Cheers,
    Jose.

  • How to make a sphere clickable

    Hi guys,
    I've been programming in Java for a while, and am very new to Java3D. I have the code below which displays a simple sphere in a box. I have some things I'd like to do but am unsure of how to go about them.
    import com.sun.j3d.utils.geometry.*;
    import com.sun.j3d.utils.universe.*;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import com.sun.j3d.utils.behaviors.mouse.MouseWheelZoom;
    import java.awt.event.*;
    import java.awt.event.WindowAdapter;
    import java.awt.*;
    public class prototype1 {
    public prototype1() {
    SimpleUniverse universe = new SimpleUniverse();
    BranchGroup group = new BranchGroup();
    Sphere sphere = new Sphere(0.5f);
    TransformGroup maing = new TransformGroup();
    maing.addChild(sphere);
       group.addChild(maing);
       Color3f light1Color = new Color3f(1.8f, 0.1f, 0.1f);
       BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
       Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
       DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
       light1.setInfluencingBounds(bounds);
       group.addChild(light1);
       universe.getViewingPlatform().setNominalViewingTransform();
       universe.addBranchGraph(group);
    public static void main(String[] args) { new prototype1(); }
    }The first thing I cannot do is figure out how to resize the window that the sphere appears in.
    The second thing I cannot do is to make the sphere clickable, so that when you click on it a simple System.out.println occurs. I have looked around and found a group.setPickable(true); sort of statement, can this be applied here? Or is a better method to have a button over the sphere and make it invisible? Or is there some way to detect the co-ordinates of the panel that have been clicked? If anyone has any ideas or can point me towards some good tutorials that would be fanatastic,
    Thanks
    Beccy

    Hi!
    Right have figured out the first problem by myself!
    This is my code so far:
    import com.sun.j3d.utils.geometry.*;
    import com.sun.j3d.utils.universe.*;
    import javax.media.j3d.*;
    import javax.swing.BoxLayout;
    import javax.swing.JFrame;
    import javax.vecmath.*;
    import com.sun.j3d.utils.behaviors.mouse.MouseWheelZoom;
    import java.awt.event.*;
    import java.awt.*;
    public class prototype1 {
    public prototype1() {
         JFrame.setDefaultLookAndFeelDecorated(true);
         JFrame frame = new JFrame("Prototype Visualisation");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Panel canvasPanel = new Panel();
         canvasPanel.setLayout(new BoxLayout(canvasPanel, BoxLayout.Y_AXIS));
         GraphicsConfiguration config = SimpleUniverse
                .getPreferredConfiguration();
         Canvas3D canvas = new Canvas3D(config);
         canvas.setSize(700,450);
         canvasPanel.add(canvas);
         frame.add(canvasPanel);
         frame.pack();
         frame.setVisible(true);
       SimpleUniverse universe = new SimpleUniverse(canvas);
       BranchGroup group = new BranchGroup();
       Sphere sphere = new Sphere(0.1f);
       sphere.setPickable(true);
       TransformGroup maing = new TransformGroup();
       maing.addChild(sphere);
       group.addChild(maing);
       Color3f light1Color = new Color3f(1.8f, 0.1f, 0.1f);
       BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
       Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
       DirectionalLight light1 = new DirectionalLight(light1Color, light1Direction);
       light1.setInfluencingBounds(bounds);
       group.addChild(light1);
       //group.setPickable(true);
       universe.getViewingPlatform().setNominalViewingTransform();
       //TransformGroup cameraTransform = universe.getViewingPlatform().getViewPlatformTransform();
       //cameraTransform.setTransform(getCameraTransform(5.0));
       // add the group of objects to the Universe
       universe.addBranchGraph(group);
    public static void main(String[] args) { new prototype1(); }
    }

  • How to make an object getting out of the screen ?

    Hello everybody !
    I am creating a game introduction with Flash pro CS6 and here's is my problem.
    I want a object in my animation to leave the screen, but I dont know how to do it.
    Is there for example, a way to delimited the working area, so that when I make an object go out of this area, it does not appear in my final animation ( no matter the format, .avi, .mov, spritesheets ... ) or can eventualy be "cut" ( if I make my object half inside the working arear and half outside ) ?
    Is there an other way to do this ?
    Thanks !

    Using a mask might be one way.

Maybe you are looking for

  • Unique Highlighting Elements in Form Fields

    Hi all My boss is asking me to build an interactive PDf file for in-office use that has some unique highlighting features. She wants the viewer to select an option on the PDF file, and when they make that selection, a box or rectangle outlines the ch

  • Info bar in 10.7

    There's alot about Lion I'm not used to. How can I get the info bar at the bottom of Finder windows back? Thanks

  • IChat will not launch from my brand new iMac - What do i need to do?

    Just purchased a brand new iMac 24". Really nice machine except that iChat will not launch. I click on the icon but it just bounces once and does nothing. Any ideas what i need to do please?

  • How to reinstall safari on macbook air?, how to reinstall safari on macbook air?

    I am having problems with safari 6.05 on my MacBook Air.  The address window is not displaing correctly and it takes unuassly long time for websites to load. I thaught deleting and reisntalling Safari would be the obvious and easy option.  But from i

  • How do I get back into CS3?

    Installed new hard drive and moved everything to new drive.  But now Dreamweaver CS3 won't let me access saying the Licensing is deactivated.  I installed this from the Internet 6 or 7 years ago and do not have installment discs.  Any suggestions?