Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    14
    Rep Power
    0

    Unhappy Java Script context menu into JAVA Context Menu...

    HI all,


    I want to implement java script context menu code into java code.please look at below and give me some resolution.

    function EntityContextMenu(display, menu) {
    var actions = [];
    var selectedEntity = null;
    var menu = menu;
    display.addEventListener('mouseclickentity',clicke d);

    function clicked(dm,de,evt) {
    if(evt.button==3) {
    selectedEntity = de;
    selectedEntity.IsFixed = true;
    for (var i=0;i<actions.length;i++) {
    actions[i].show(de);
    }
    menu.showMenu( evt.x,evt.y, evt.source.parent);

    menu.parent.onclick = function(){
    if(selectedEntity != null){
    delete selectedEntity.IsFixed;
    selectedEntity = null;
    }
    }
    }
    }

    this.hide = function(entityAction){
    if(selectedEntity != null){
    delete selectedEntity.IsFixed;
    selectedEntity = null;
    }
    menu.hideAllMenus();
    }

    this.addAction = function( entityAction ) {
    actions.push(entityAction);
    };
    }

    function EntityAction(button) {
    var _this = this;
    this.currentEntity = null;
    this.button = button;
    this.menu = null;
    button.onaction = function() {
    _this.perform( _this.currentEntity );
    menu.hide();
    }
    this.show = function(entity, menu) {
    this.currentEntity = entity;
    this.menu = menu;
    this.shown(entity);
    }
    this.shown = function(entity) { }
    this.perform = function(entity) { }
    }

    var menu = new EntityContextMenu(displayManager, contextMenu);



    Just give me java code for above.

    Thanks in advance

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,406
    Rep Power
    20

    Default Re: Java Script context menu into JAVA Context Menu...

    Quote Originally Posted by cnu.nandhikonda@gmail.com View Post
    Just give me java code for above.
    This is a forum, not a free code factory. Here's a learning resource, go through it and you will be able to do this yourself.
    Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    Also go through these:
    Forum Rules
    Guide For New Members
    BB Code List - Java Programming Forum

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Right click and context menu on MacOS
    By mamadeo in forum Java Applets
    Replies: 3
    Last Post: 05-24-2012, 09:38 PM
  2. Add item to menu context
    By ahmakki in forum New To Java
    Replies: 2
    Last Post: 02-15-2012, 07:58 PM
  3. Eclipse Mozilla as Browser Context Menu
    By schilwan in forum Eclipse
    Replies: 1
    Last Post: 02-10-2012, 08:57 PM
  4. Context Menu
    By ravjot28 in forum AWT / Swing
    Replies: 3
    Last Post: 01-23-2010, 05:32 PM
  5. SWT JFace bug using context menu
    By xcallmejudasx in forum SWT / JFace
    Replies: 0
    Last Post: 11-14-2008, 04:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •