• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Moving code in netbeans

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have several buttons placed in order, but my code has one higher up in the source than I want it. I want to move it BELOW the rest of my buttons:



How do I move code? Last time I tried to do this I deleted my whole frame. =(
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've said this before but I'll keep on saying it until I'm blue in the face: a visual designer is categorically NOT a beginner's tool. It's only worth investing the time and effort to learn how to do things correctly in a visual designer if you are aiming for a career in GUI design.

Lear to program a Swing GUI the easy way: Trail: Creating a GUI With JFC/Swing

That said, the order of methods in a class doesn't affect how the code executes. If you think it does, you have other gaps in your learning that you need to make good before progressing to GUIs.
 
Anthony Schmitt
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great, but I still have autogenerated snippets of code I need to get rid of/rearrange.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Summary of Darryl's post is:

don't autogenerate code
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Anthony Schmitt wrote:I have several buttons placed in order, but my code has one higher up in the source than I want it. I want to move it BELOW the rest of my buttons:



How do I move code? Last time I tried to do this I deleted my whole frame. =(



Quick and dirty way: open the .java file in a plain text editor, then you are freely to move the code
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nam Ha Minh wrote:
Quick and dirty way: open the .java file in a plain text editor, then you are freely to move the code


...and the IDE will probably over write all the changes next time you compile/run. I have seen comments like "Do not edit, machine generated code" or something similar.
Best way is what Darryl said. Hand code.
 
Nam Ha Minh
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:
Best way is what Darryl said. Hand code.



I don't totally agree with that. In my opinion, using both IDE and hand code for UI is preferred. We should understand Java Swing well enough before using IDE for GUI. So that we can solve problems quickly if they come.
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One more point...whenever 'hand code' is mentioned, many people think of Notepad and it scars them...that is not the intention...
You can still use NetBeans IDE to 'hand code' - write code in the editor from scratch and you will still get all the help with errors, imports, method popups and so on. Just avoid the 'designer' when you are starting to learn.
 
Nam Ha Minh
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ranganathan Kaliyur Mannar wrote:One more point...whenever 'hand code' is mentioned, many people think of Notepad and it scars them...that is not the intention...
You can still use NetBeans IDE to 'hand code' - write code in the editor from scratch and you will still get all the help with errors, imports, method popups and so on. Just avoid the 'designer' when you are starting to learn.



Agree! If we understand how things are working, no matter IDE or hand coded.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nam Ha Minh wrote:We should understand Java Swing well enough before using IDE for GUI.


That's what I meant when I said a visual designer isn't a beginner's tool.
 
grapes are vegan food pellets. Eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic