Hi, I guess the problem you face is that ContextImage has no #add() method ? This is because <img/> cannot have children HTML elements.
What is the HTML output you need to produce? Please create the plain HTML example at JSFiddle (https://jsfiddle.net/) and give us a link. I guess you need to add the dropdown to the link, not to the image. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Sep 29, 2016 at 8:23 AM, ASHU_JAVA <ashu....@gmail.com> wrote: > I'm trying to create a image button. When this button clicked, a drop down > menu should appear with External Links to other websites. > > Till now, I've managed to create drop down menu with External links but on > navigation bar as provided in example: > http://tomaszdziurko.pl/2012/03/wicket-and-twitter-bootstrap-navbar/. > > HTML: > <div wicket:id="navBar"/> > Code: > public Builder withMenuItemAsDropdown(MenuItemEnum menuItem, String > pageToLink, String label) { > //BookmarkablePageLink<Page> link = new > BookmarkablePageLink<Page>("link", pageToLink); > ExternalLink linkExternal = new ExternalLink("link", pageToLink, > label); > linkExternal.setBody(new Model<String>(label)); > linksMap2.put(menuItem, linkExternal); > > return this; > } > > And then in Base JAVA class: > add(new TwitterBootstrapNavBarPanel.Builder("navBar", HomePage.class, > "Example Web App", getActiveMenu()) > .withMenuItem(MenuItemEnum.CLIENTS, ClientsPage.class) > .withMenuItemAsDropdown(MenuItemEnum.PRODUCTS2, "Sample_URL", "Product > 1") > .withMenuItemAsDropdown(MenuItemEnum.PRODUCTS2, "Sample_URL", > "Product 2") > .withMenuItemAsDropdown(MenuItemEnum.PRODUCTS2, "Sample_URL", > "Product 3") > .build()); > > > Now to add a Image, I've added the code:- > > final ContextImage image=new ContextImage("image","IMAGE.png"); > ExternalLink link = new ExternalLink("link", "SAMPLE_URL"); > //Image image = new Image("img", new > SharedResourceReference(BasePage.class, > "/wicket-bootstrap/img/QuestionMark_2.png")); > link.add(image); > add(link); > > But I'm unable to add the drop down menu to this Image button. Kindly > suggest some inputs. > > Thanks in advance. > > -- > View this message in context: http://apache-wicket.1842946. > n4.nabble.com/java-wickets-menu-on-image-button-tp4675602.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >