HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

Java Tutorial : Auto-Suggesting & Auto-Completing JTextField in JAVA | Java Swing

10,091 views November 15, 2018 6:13

Watch on YouTube
ChannelUnpossible POG

Description from the creator

Please avoid or flag spams/hateful comments. And do not spam. Enjoy :)

Code :-
unpossiblepog.blogspot.com/2018/06/java-tutoria…

Subscribe my Channel:-
youtube.com/user/SanketRooney?sub_confirmation=1

Facebook Page:-
facebook.com/UnpossibleNS

Twitter Account:-
twitter.com/UnpossiblePOG

Blog Account :-
unpossiblepog.blogspot.in/


Hey guys, this is unpossible pog, today I shall show you how to create auto completing jtextfield in java using netbeans IDE.
You have to follow my steps, ok?
Create new project and Select JAVA applications.
Just remove this basic class.
We shall add jframe class.
Now add textfield from palette.
Now go to Source, Call set class after the class creation, dont forget to import java.util package.
Inside constructor, call s, that is variable of set and create if as new treeset of string.
Now you can add strings in set which will be auto suggested by jtextfield.
You can also add it from database. Jst rotate add function in loop.
Now go to design tab, and select key, then key_released event.
Lets check the variable name of jtextfield which is jtextfield 1.
Lets run the project.
Slect the main class.
Now, just follow my steps.
We shall need 2 nested for loops.
We need if conditions because,we have to check whatever we type matches with the data in set.
If it matches, then u have to settext that data in textfield.
SetSelectedStart and setSelectedEnd are used for highlighting text, that is for auto completing.
Then break the loop.
As you can see, textfield is autosuggesting based on what we type, but the problem is I am currently pressing backspace, but still it won’t delete text.
So we have to create create if else.
Include out code in else and leave if as empty.
Import awt.KeyEvent.
Now lets check the output.
As you can see, it is auto completing without any problem, if you press enter, what suggesting text will be completely added in textfield.
So thats it guys, if you want code, then the link is in the description.
don’t forget to Like,share and subscribe. Thank you for watching, bye.

About this tutorial

Unpossible POG published this 6:13 video tutorial on November 15, 2018. It has been watched 10,091 times on YouTube.

Category
Education
Duration
6:13
Published
November 15, 2018
Views
10,091
Likes
124

Tags

Share

This tutorial in other languages