1

I installed NetBeans 8.0.2 recently, and tried to set null layout for a JFrame. Tried to proceed but RIGHT CLICK on the frame didn't work. I am actually trying to set a background image for a frame.

Someone has already posted cannot right click on Jframe or Jpanel in netbeans 8.0 but it has no answers.

How to fix this problem? Hope that someone has found a solution.

Community
  • 1
  • 1
Rahul Padalkar
  • 125
  • 1
  • 11
  • 1
    *"set null layout for .."* ..lots of problems, is what that usually results in. 1) Java GUIs have to work on different OS', screen size, screen resolution etc. using different PLAFs in different locales. As such, they are not conducive to pixel perfect layout. Instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556) along with layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556). 2) For better help sooner, post a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). .. – Andrew Thompson Sep 29 '15 at 16:21
  • .. 3) *"Someone has already posted the same question here but with no answers."* What question? Link to it. 'Here' is a big place. I think they were recently celebrating their 10 millionth question. – Andrew Thompson Sep 29 '15 at 16:23
  • Here's a link to that question: http://stackoverflow.com/questions/26245098/cannot-right-click-on-jframe-or-jpanel-in-netbeans-8-0 – Rahul Padalkar Sep 29 '15 at 16:27
  • From that question: *"whenever I right click on JFrame or JPanel **in design mode"*** Oh so you mean it is specifically in design mode in netbeans that this problem occurs? – Andrew Thompson Sep 29 '15 at 16:29
  • Yep.It works in eariler versions on netbeans but i think after netbeans 8.0.It stopped working. – Rahul Padalkar Sep 29 '15 at 16:31
  • So what happens when you right click on the JFrame in the UI designer? –  Sep 29 '15 at 16:33
  • Nothing! It doesn't show anything! – Rahul Padalkar Sep 29 '15 at 16:35
  • *"It works in eariler versions on netbeans but i think after netbeans 8.0.It stopped working."* Hopefully they decided to stop *trying* to provide support for `null` layouts. ;) Use a layout (or layouts) for the components and a background image painting component (an extension of `JPanel`) for the BG image. – Andrew Thompson Sep 29 '15 at 16:36
  • *"Nothing! It doesn't show anything!"* Tip: Add @a_horse_with_no_name (or whoever, the `@` is important) to *notify* the person of a new comment. – Andrew Thompson Sep 29 '15 at 16:37
  • Atleast it should show something after right clicking on the JFrame.There were many other options apart from "setLayout". – Rahul Padalkar Sep 29 '15 at 16:41
  • Can you right click in the **Navigator** window (where the structure of the dialog is displayed)? –  Sep 29 '15 at 16:41
  • I can.Just an addition: here's an error which i get everytime i open netbeans "NullPointerException at org.netbeans.modules.form.palette.PaletteUtils.getCategoryNodes".Its tagged as "Unexpected Error"@a_horse_with_no_name @Andrew Thompson – Rahul Padalkar Sep 29 '15 at 16:46
  • Oh I don't provide support for IDEs, I'll leave it to @a_horse_with_no_name .. – Andrew Thompson Sep 29 '15 at 16:48

1 Answers1

1

It works for me to right-click on a JFrame and use Set Layout -> Null Layout with Netbeans 8.02. They did not remove it as an option. My guess would be that it is a problem specific to your configuration and/or installation.

Close Netbeans, delete your user configuration directory and cache directory ( see http://wiki.netbeans.org/FaqWhatIsUserdir ) and reopen Netbeans. If the problem persists use View -> IDE Log and add the Error messages from the log to your question. After opening Netbeans, only try one thing and then copy the log so you don't have a bunch of irrelevant error messages in the log.

WillShackleford
  • 6,918
  • 2
  • 17
  • 33