File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to achieve a code using jdk doc?

 
Jhovarie Guiang
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys i dont now how to use jdk docs from here could any one teach me? for example in JPanel see this code



how to achieve that code using jdk docs? step by step plss im trying this link http://download.oracle.com/javase/6/docs/api/javax/swing/JPanel.html but it never helps me.

i ask this question because jdk docs never helps me on writing java code may be some one who know how to use it and thanks in advance.
 
Paul Clapham
Sheriff
Pie
Posts: 20155
23
MySQL Database
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you were expecting to be able to learn how to use a complex class like JPanel just by reading the API documentation, you are right, that is a very difficult thing to do. However if you start reading at the very beginning,
The API documentation wrote:For examples and task-oriented documentation for JPanel, see How to Use Panels, a section in The Java Tutorial.


So there's a link to a tutorial. Reading that tutorial is a much more practical way to learn. And you will find that most of the major Swing classes have an associated tutorial. I recommend reading them. And downloading their example code and fiddling around with it to see what you can do.
 
Jhovarie Guiang
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
looks like jdk docs is just a list of class, identifier, method, field etc.. and also explain what their function but it doest not help me to write java code. some times it helps me but from the code that i already know.

see this http://forums.oracle.com/forums/thread.jspa?messageID=9738467
 
Paul Clapham
Sheriff
Pie
Posts: 20155
23
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting the link to your cross-post, where it looks like a good discussion has taken place.

However I am astonished by your statement that you can't find a link to the tutorial, when I specifically told you right here exactly where to find that link.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This is a bad idea for any I/O code; you simply must handle exceptions, even if it's nothing more than print a message as to what happened someplace where you'll notice it.
 
Jhovarie Guiang
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:If you were expecting to be able to learn how to use a complex class like JPanel just by reading the API documentation, you are right, that is a very difficult thing to do. However if you start reading at the very beginning,
The API documentation wrote:For examples and task-oriented documentation for JPanel, see How to Use Panels, a section in The Java Tutorial.


So there's a link to a tutorial. Reading that tutorial is a much more practical way to learn. And you will find that most of the major Swing classes have an associated tutorial. I recommend reading them. And downloading their example code and fiddling around with it to see what you can do.



:jumpingjoy: yeh... from this link http://download.oracle.com/javase/6/docs/api/index.html?javax/swing/JPanel.html

there is a text saying that JPanel is a generic lightweight container. For examples and task-oriented documentation for JPanel, see How to Use Panels, a section in The Java Tutorial.

and it brings me to this link http://download.oracle.com/javase/tutorial/uiswing/components/panel.html

now i know how to use jdk docs and i love it now. :thumbup:
 
Jhovarie Guiang
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
This is a bad idea for any I/O code; you simply must handle exceptions, even if it's nothing more than print a message as to what happened someplace where you'll notice it.


so what is the good idea about that?
 
Campbell Ritchie
Sheriff
Pie
Posts: 47216
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jhovarie Guiang wrote: . . . so what is the good idea about that?
Ulf has already told you what the right thing to do is.
 
Jhovarie Guiang
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
Jhovarie Guiang wrote: . . . so what is the good idea about that?
Ulf has already told you what the right thing to do is.


i mean that give me the good sample code about that.
 
Paul Clapham
Sheriff
Pie
Posts: 20155
23
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:you simply must handle exceptions, even if it's nothing more than print a message as to what happened someplace where you'll notice it.


Are you seriously asking for sample code for "print a message"?
 
Jhovarie Guiang
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah... i understand what Ulf is saying

like what i did in my try catch i must add ex.printStackTrace() or System.out.println(ex);



i just miss understand the post of Ulf a while ago.
 
Rob Spoor
Sheriff
Pie
Posts: 20368
43
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Printing the stack trace is preferred over simply printing the exception, because the stack trace also tells you where the exception occurred, not only what exception occurred.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic