DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • How to Create Buttons in Java Applications
  • How to Create Tables in Java
  • Unraveling Lombok's Code Design Pitfalls: Exploring Encapsulation Issues
  • Leverage Lambdas for Cleaner Code

Trending

  • How to Format Articles for DZone
  • Develop a Reverse Proxy With Caching in Go
  • Scalable System Design: Core Concepts for Building Reliable Software
  • Enhancing Security With ZTNA in Hybrid and Multi-Cloud Deployments
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Top 10 Interesting NetBeans IDE Java Shortcuts I Never Knew Existed

Top 10 Interesting NetBeans IDE Java Shortcuts I Never Knew Existed

By 
Geertjan Wielenga user avatar
Geertjan Wielenga
·
Feb. 19, 10 · News
Likes (4)
Comment
Save
Tweet
Share
97.5K Views

Join the DZone community and get the full member experience.

Join For Free

I'm working on updating the NetBeans IDE Keyboard Shortcut Card (which you can always find under the "Help" menu in the IDE) and have learned about a lot of shortcuts I never knew about before. Here's a grab bag of things I have added to the shortcut card (some new, some old that hadn't been included before) that you might find interesting too.

  1. Type "fcom" (without the quotes, same as all the rest below) and then press Tab. You now have this, i.e., a brand new code fold:
    // <editor-fold defaultstate="collapsed" desc="comment">
    // </editor-fold>
  2. Type "bcom" and then press Tab to create the start of a new set of comments in your code:
    /**/
  3. Type "runn" and press Tab and you'll have all of this:
    Runnable runnable = new Runnable() {

    public void run() {

    }
    };
  4. If I have this:
    String something = "";

    ...and then below that type "forst" and press Tab, I now have this:

    String something = "";
    for (StringTokenizer stringTokenizer = new StringTokenizer(something); stringTokenizer.hasMoreTokens();) {
    String token = stringTokenizer.nextToken();

    }

    Also, experiment with "forc", "fore", "fori", "forl", and "forv"!

  5. I always knew that "sout" turns into "System.out.println("");" but did you know that (again assuming you first have a string something like above) if you type "soutv" you end up with this:
    System.out.println("something = " + something);

    Thanks Tom Wheeler for this tip.

  6. Next, here are the new shortcuts that are new from NetBeans IDE 6.9 onwards:

    • as - assert=true;
    • su - super
    • db - double
    • sh - short
    • na - native
    • tr - transient
    • vo - volatile

  7. I knew that "ifelse" would resolve to an if/else block. But did you know that if you don't need an 'else', you can simply type "iff", press Tab, and then end up with this:
    if (exp) {

    }
  8. From NetBeans IDE 6.9 onwards, the "sw" shortcut expands to the following:
    switch (var) {
    case val:

    break;
    default:
    throw new AssertionError();
    }
  9. If you're using while loops, experiment with "whileit", "whilen", and "whilexp".

  10. Always remember these: "im" expands to "implements; "ex" to "extends".

Other tips along these lines are more than welcome here on NetBeans Zone!
Integrated development environment NetBeans Java (programming language)

Opinions expressed by DZone contributors are their own.

Related

  • How to Create Buttons in Java Applications
  • How to Create Tables in Java
  • Unraveling Lombok's Code Design Pitfalls: Exploring Encapsulation Issues
  • Leverage Lambdas for Cleaner Code

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!