Java Swing/GUI Tutorial: Create a Password Field- Password Protecting Program

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
25,337
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 27, 2009

This tutorial will show you how to create a Password field in Java.

A password field can be useful if you only want certain users gaining access to some parts of your program. If you hide the source code or store the password in a different file, then the user cannot see the password by looking at your source code.

  • likes, 3 dislikes

Link to this comment:

Share to:

Uploader Comments (MrJavaHelp)

  • im having a problem when i use this in my program,

    for some reason it wont show the controls on my program until i resize the window,

    and the window is big enough for the controls. I think its something to do with the pack method cause i didnt use pack and when i do it gives me an error saying i cant use non-static method with static main, and when i try to call the pack method from another instance of the class it gives me same error, any ideas ne1? :)

  • @enrichedd Hi, to fix this problem, simply add a line of code at the bottom of your program, just before the main method ends that says: frame.validate();

Top Comments

  • Fucking unbelievable, going to implement this into my video game ASAP.

  • Oh fuck it. fuck java, fuck my carrer fuck everthing imma live in te woods D:

see all

All Comments (24)

Sign In or Sign Up now to post a comment!
  • @Irvvn

    I hope you actually did that, I'm thinking of doing the same!

  • it doesn't show the insert space, it only shows the enter password, what did i miss?

  • There's one line I don't understand, what does the part in parenthesis mean? "JPasswordField input = (JPasswordField) e.getSource();"

  • hey can u help me out? im a little new to java but i want to make a password protecting system for a program....if thy get pass right it opens program and if wrong it doesnt open program...i also want to know how to hide my sources for the game as i modded it and i dont want my mods to be leaked

  • @Irvvn I had to sign in to comment on this LMBOOOOOOOOOO!!!! im in school tryna sneak on youtube and I read this. omg tooooo funny. looool.

  • @MrJavaHelp

    hey thanks for the response, i ended up just taking the main method out and made a new instance containing the pack method

  • @enrichedd HAHAHA.... i know i was just having some hard time :D but i made it :D

  • thanks

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more