how to edit grayed out area of GUI in NetBeans?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ValValVal
    New Member
    • Oct 2008
    • 27

    how to edit grayed out area of GUI in NetBeans?

    Please sorry for my dumb question but I cannot find information on how I can change settings so that in NetBeans 6.1 I can edit blue guarded areas.

    I read in FAQ NetBeans Wiki: FaqFormEditingG uardedBlocks that I had to change something in Properties->Code ,but I really can't figure out what this should be.

    Thanks in advance.
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Hey there!

    No dumb questions here:-) But I am not at leisure to help you right now, I will grab my notebook, it has NetBeans installed, then I'll have a look. The text included in your link seems quite fetching though... what happens when you try what is said?

    In a bit!
    Last edited by Dököll; Nov 25 '08, 04:23 AM. Reason: text...

    Comment

    • myusernotyours
      New Member
      • Nov 2007
      • 188

      #3
      Originally posted by ValValVal
      Please sorry for my dumb question but I cannot find information on how I can change settings so that in NetBeans 6.1 I can edit blue guarded areas.

      I read in FAQ NetBeans Wiki: FaqFormEditingG uardedBlocks that I had to change something in Properties->Code ,but I really can't figure out what this should be.

      Thanks in advance.
      The link you gave says in part...
      However, please note that you can easily write your code out of the guarded block, typically into the constructor after the initComponents( ) method call, as additional setup code that should be performed. This option is often forgotten, but it is the most eficient and easiset way to add custom code, working in most situation (e.g. except custom instantiation code).
      Have you tried that? I find it works for me all the time.
      Just put whatever you want to do after initComponents( ) then if you need to change something there, it's always a breeze.
      Or you have a special reason why you want to change the generated code directly??

      Regards,

      Alex.

      Comment

      • ValValVal
        New Member
        • Oct 2008
        • 27

        #4
        no special needs

        Hi!
        I have no special needs to edit it, but still want to know to get more knoledge about the system ,and sometimes NetBeans generates bad code. In these cases I must help him out.

        Comment

        • myusernotyours
          New Member
          • Nov 2007
          • 188

          #5
          Originally posted by ValValVal
          Hi!
          I have no special needs to edit it, but still want to know to get more knoledge about the system ,and sometimes NetBeans generates bad code. In these cases I must help him out.
          Then do as it says on your link. Right click the component go to properties then code tab.

          Here you can put your custom initialization code.
          And what do you mean NetBeans generates bad code?
          Is it that you can initialize components better?

          Regards,

          Alex.

          Comment

          • myusernotyours
            New Member
            • Nov 2007
            • 188

            #6
            Originally posted by ValValVal
            Hi!
            I have no special needs to edit it, but still want to know to get more knoledge about the system ,and sometimes NetBeans generates bad code. In these cases I must help him out.
            Then do as it says on your link. Right click the component go to properties then code tab.

            Here you can put your custom initialization code.
            And what do you mean NetBeans generates bad code?
            Is it that you can initialize components better?
            NetBeans just uses the properties you assign to components during design to init the components.

            Regards,

            Alex.

            Comment

            • ValValVal
              New Member
              • Oct 2008
              • 27

              #7
              I just want to try edit it

              So actually I cannot "edit" the code that I have now? Pity if so.
              I asked the question mainly because someone asked me about this grey code in NetBeans.

              And yes,sometimes NetBeans (I noticed it ) has code that I want to remove. E.g. when I delete a component it crashes the project because there is grey code referring to it which I would like to remove manually.
              Thanks ,Val.

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                If you delete a component that you added using Netbeans tools then Net beans should remove all grey code pointing to it.

                P.S I use eclipse.

                Comment

                • ValValVal
                  New Member
                  • Oct 2008
                  • 27

                  #9
                  It seems that it is not the case

                  Well it seems sometimes that NetBeans editor is not without flaws.
                  Val.

                  Comment

                  • myusernotyours
                    New Member
                    • Nov 2007
                    • 188

                    #10
                    Netbeans does remove generated code if a component is deleted.
                    I never encountered a situation when it din't.

                    Anyone else who encountered Val's problem?

                    Regards,

                    Alex.

                    Comment

                    • ValValVal
                      New Member
                      • Oct 2008
                      • 27

                      #11
                      Besides, after adding event listener it seems impossible to undo it.
                      The code connecting event with the form is non-editable. If I delete the code of the listener it won't compile anymore.

                      Val.

                      Comment

                      • r035198x
                        MVP
                        • Sep 2006
                        • 13225

                        #12
                        Originally posted by ValValVal
                        ...
                        The code connecting event with the form is non-editable...
                        I doubt that. There should be a TODO in that action method allowing you to put your own event handling code.
                        Perhaps you should be going through the Netbeans tutorial or Sun's introduction to Swing using Netbeans tutorial. That way there is no need for anyone to guess anything.

                        Comment

                        • myusernotyours
                          New Member
                          • Nov 2007
                          • 188

                          #13
                          Originally posted by r035198x
                          I doubt that. There should be a TODO in that action method allowing you to put your own event handling code.
                          Perhaps you should be going through the Netbeans tutorial or Sun's introduction to Swing using Netbeans tutorial. That way there is no need for anyone to guess anything.
                          I don't doubt it, I Refute it. There is a way to remove the code inside the event listener, but aside from any event handling code put there by the programmer, the generated method stub can't be deleted just by hitting the delete button.

                          @Val: do as r0 advices. Go through the netbeans tutorial.

                          Regards,

                          Alex.

                          Comment

                          • ValValVal
                            New Member
                            • Oct 2008
                            • 27

                            #14
                            I didnt say that you can't add your event listening code. It is surely possible.
                            I said that CONNECTING (initializing) code is grayed out and you cannot edit it.And the code of a listener that is not in TODO section cannot be edited as well. So when I add event listener for e.g. mouse click NetBeans adds code to treat it. I can add code in todo section but cannot edit initializing code and code of a method that is not TODO (it's grayed out).

                            Comment

                            • mcsean2163
                              New Member
                              • Apr 2009
                              • 2

                              #15
                              ValValVal

                              ValValVal,

                              Did you ever find a solution. I'm having the same issue. I can't edit the source code. sure I can insert code or edit comments but say for eg the line:

                              stringItem = new StringItem("Hel lo", "Hello, World!");

                              I can't edit the text or anthing. If this is the case netbeans is pure rubbish!

                              Comment

                              Working...