Java GUI Framework Question:

Download Job Interview Questions and Answers PDF

How to draw a tree?

Java GUI Framework Interview Question
Java GUI Framework Interview Question

Answer:

This seems to be a common homework question, so please have a look at the "Which topics are not welcome in the newsgroup?" to understand why this answer is intentionally vague.

If the fixed layout of JTree suits your needs, you could start reading the JTree API documentation.

Or you could use a simple (recursive) algorithm. E.g

x(node) = K * level(node), and
y(node) = M * inorder_rank(node).

gives very ugly trees, but trees. If this doesn't get you started, ask your professor or tutor for more hints. Consult your text book about (inorder) tree traversal, and consult

http://home.earthlink.net/~patricia_shanahan/beginner.html

Download Java GUI Framework Interview Questions And Answers PDF

Previous QuestionNext Question
How to draw lines between JLabels on a JPanel?How to do this JavaScript thing on my web site?