Hello dear steemit friends,
today i am going to show you how to create small java application for coin market. first you need to small things.
1.small java knowledge
2.java development kit ( JDK ) you can download
3.IDE ( i am using netbeans )
4.small brain
5.1 laptop
6.2 hand
7.jsoup library
ok guys, now we are ready for do that.
install netbeans ide and after
- file >> New project >> Java >> Java application >> project name and path >> finish
fisrt you need to design this user interface using netbeans ide or another ide.
THIS IS VERY IMPORTENT : add jsoup libry to you project. google " how to add libry to netbeans project"
and we are going to code our application. no no it is not complicated. too easy .
double click "start market button" or right click Event >> action >> action performed
then code like this.
javax.swing.Timer t;
t = new javax.swing.Timer(1000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Document doc;
try {
String y=a.getText();
// need http protocol
doc = Jsoup.connect("https://coinmarketcap.com/currencies/digibyte/").get();
Elements divTag = doc.getElementsByClass("text-gray");
System.out.println(divTag.text());
String x = divTag.text().toString();
String fi = "";
for (int i = 0; i < 11; i++) {
char c = x.charAt(i);
fi = fi + c;
}
System.out.println(fi);
ta.setText(fi);
if (ta.getText().equals(a.getText())) {
System.out.println("yes");
Toolkit.getDefaultToolkit().beep();
}
} catch (java.net.UnknownHostException rt) {
JOptionPane.showMessageDialog(createRootPane(),"not a internet connection");
System.exit(0);
} catch (IOException d) {
}
}
});
t.start();
thats it. now you can run your java application. and click start market button its will gave values.
ohhh its working.....
![Screenshot_3.png](https://steemitimages.com/DQmcmJQsYU4sN9ZigjQRF8HDVHD1UU5wdvzZbfdgVdbswru/Screenshot_3.png)
now i can do small explain in code. look at this line.
" doc = Jsoup.connect("https://coinmarketcap.com/currencies/digibyte/").get();"
you can change this link to other currancy. like this.
" doc = Jsoup.connect("https://coinmarketcap.com/currencies/dash/").get();"
i think you are enjoying this article. i hope to another tutorial for crypto application.
you can develop this application. this is too small.
hope you learn something.
Good Luck!