This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how to achieve a code using jdk doc? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to achieve a code using jdk doc?" Watch "how to achieve a code using jdk doc?" New topic
Author

how to achieve a code using jdk doc?

Jhovarie Guiang
Greenhorn

Joined: Jul 13, 2011
Posts: 15
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jul 13, 2011
Posts: 15
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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
Marshal

Joined: Mar 22, 2005
Posts: 41133
    
  45

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.


Ping & DNS - my free Android networking tools app
Jhovarie Guiang
Greenhorn

Joined: Jul 13, 2011
Posts: 15
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

Joined: Jul 13, 2011
Posts: 15
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

Joined: Oct 13, 2005
Posts: 38044
    
  22
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

Joined: Jul 13, 2011
Posts: 15
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Jul 13, 2011
Posts: 15
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

Joined: Oct 27, 2005
Posts: 19655
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to achieve a code using jdk doc?
 
Similar Threads
Returning a byte-array after performing an XSLT
Framing within GridBagLayout
Smiley
refresh a JPanel automatically as time changes
IS there fake components to add to flow layout so I can create fake space?