2

I need to add a popup menu to the JFrame, but when I drop that component there it just dissappears. I can see it in code, but there is no way to edit anything about it. Is there a way I can edit it like say menu bar? I use Netbeans 7.2.1 if that is important.

PS - Yes, I tried googling and found only this, but it is not helping...

Community
  • 1
  • 1
NewProger
  • 2,945
  • 9
  • 40
  • 58
  • @jzd it is not helping. Instead of bringing your great wisdom, I would rather wish to get an actual answer. – NewProger Nov 15 '13 at 15:15
  • 1
    Just trying to help you out. Trust me, visual editors are fine for quick demo, but for actual working code you want to completely avoid them. You spend more time trying to customize the ugly code it generates then if you would have just written it directly. – jzd Nov 15 '13 at 15:26
  • 1
    @jzd This is a proper question. Many people including myself choose to use visual builder for a reason. I can decide for myself if I should use visual editor or design everything by hand and when. Thank you for your suggestion, but it has nothing to do with the actual question. – NewProger Nov 15 '13 at 15:28
  • 1
    I disagree -- it has *everything* to do with the actual question. From my experience here (and likely that of @jzd) the visual designer inhibits your learning the rudiments of Swing. If you instead built the program by hand, you'd understand what you're doing and would be much more adept at your Swing coding. – Hovercraft Full Of Eels Nov 30 '13 at 15:37

1 Answers1

3

Okay, I figured it out by myself.

  1. Open Windows -> Navigation -> Navigator it will show a navigator window with all components currently on jFrame.
  2. In that navigator window then click Other components.
  3. In there all non visual components including jPopopMenu will be listed.
  4. By clicking on any of these components it is possible to edit their properties.
  5. Editing the popup menu visually is possible by double clicking on it. It will then bring up visual menu builder.
NewProger
  • 2,945
  • 9
  • 40
  • 58
  • +1 for this option. So you were right, there is in fact a way to do this visually. – dic19 Nov 15 '13 at 17:56
  • @dic19 yup. And it is a nice way to do it too, as it save a whole lot of time. – NewProger Nov 16 '13 at 11:44
  • Yes it does! Honestly I used GUI builder for almost 4 years to save time and mostly to forget about components layout. But now I do my GUI by hand because the code is cleaner and shorter and it allows me learn about the things NetBeans did for me in the past. About `LayoutManagers` there are very good suggestions **[here](http://stackoverflow.com/questions/18745072/grouplayout-autogenerated-code-in-netbeans)**. I became a fan of `DesignGridLayout` which is so simple and there are plenty of examples in the official site. – dic19 Nov 16 '13 at 12:29
  • Whereas it is good to be able to write this code yourself it iw really tedious. I use NetBeans, partly because the generated code is generally straighforward and easy to understand. Sometimes you want to take control. Netbeans designer allows you to add custom code to its generated components via it's 'Code' windows. You a stenographer? – Mark Ainsworth Apr 16 '15 at 21:27