Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Putting a JTable inside a JTree  (Read 2725 times)
0 Members and 2 Guests are viewing this topic.
Offline SteveJohnson

JGO n00b
*

Posts: 15


Java games rock!


« on: 2003-10-25 23:01:04 »

Hello,

 Does anyone have any experience with the subject line. I am creating an object viewer that uses reflection to display all the fields of a selected Object.  Object type fields will be a tree node that can be expanded and will just have the name of the field as a JLabel.  All the primitive data types will be a single tree node as a JTable that can be edited.  I am currently having two problems:

1.) The table is being partially displayed, I can see all the data but the left and top border of the table is missing

2.) I can't select anything, it seems to me that cells can
be highlighted by default on a JTable usually.

I could probably solve everything by making a custom table using JPanels,JLabels,JTextBox, and GridLayout but just wondering if I am missing anything obvious(which is usually the case!). This may not seem related to game development but I am creating an application so that I can view my simple scenegraph and change values on the fly to see the result.

Thanks,
Steve
Offline SteveJohnson

JGO n00b
*

Posts: 15


Java games rock!


« Reply #1 on: 2003-10-25 23:44:57 »

Hello,

 How come everytime I post a question somewhere I always find what I am looking for and I usually find my original question is a stupid one Roll Eyes  .  I found the answer to number 2 (set editable on the tree and write a TreeCellEditor) however number 1 is still a problem.

Thanks,
Steve
Offline duncanIdaho

Jr. Member
**

Posts: 62


invert mouse


« Reply #2 on: 2003-11-06 15:34:03 »

have you tried putting all the JTables on JPanels?  My first and only thought is to add the table to a panel ( BorderLayout.CENTER ), throw those in the tree, and see how it looks.

I would try this if I felt I had time to screw around with it ... curious component composition.

If you get this working I'd love to see a screen shot and hear how ya did it.  :-)

Games published by our own members! Go get 'em!
Offline blahblahblahh

JGO Kernel
*****

Posts: 4575


http://t-machine.org


« Reply #3 on: 2003-11-06 23:48:12 »

Quote
Hello,

 Does anyone have any experience with the subject line.


IIRC do a google for "JTableTree" and "JTreeTable". There was an article/tutorial a very long time ago on the JDC, or swing-pages, or one of the other semi-official java places about implementing a file-system-browser by combining Table and Tree. So, it's probably exactly what you want Smiley.

Whenever I need something similar, I just go and look up that article/tutorial/etc. I don't think it's part of any of the Swing trails though I could be wrong...

malloc will be first against the wall when the revolution comes...
Offline sma

Jr. Member
**

Posts: 98



« Reply #4 on: 2003-11-07 00:41:04 »

Quote

IIRC do a google for "JTableTree" and "JTreeTable". There was an article/tutorial a very long time ago on the JDC

It was on "The Swing Connection": http://java.sun.com/products/jfc/tsc/articles/treetable1/

.: Truth Until Paradox!
Offline duncanIdaho

Jr. Member
**

Posts: 62


invert mouse


« Reply #5 on: 2003-11-07 09:53:57 »

Nice!  It looks much more useful than I had imagined.

Not that this site is hard to find, but it taught me a lot about getting Swing to jump through hoops ( despite being low on comments ).

http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
Offline Golthar

Jr. Member
**

Posts: 85


;)


« Reply #6 on: 2003-11-07 12:36:17 »

I have trouble imagining what it would look like  Grin

Somebody post pictures please

come visit us: http://www.otf1337.com
Offline duncanIdaho

Jr. Member
**

Posts: 62


invert mouse


« Reply #7 on: 2003-11-07 12:56:23 »

just click sma's link.  Wink
Offline blahblahblahh

JGO Kernel
*****

Posts: 4575


http://t-machine.org


« Reply #8 on: 2003-11-09 08:22:56 »

FYI a much more detailed and performance-sensitive look at tabletrees (starting with 40 slides on Jtree and Jtable) can be found here:

http://servlet.java.sun.com/javaone/javaone2000/pdfs/TS-1136.pdf

You need to understand quite a bit about standard patterns in order to make sense of the slides, and clearly it would be a LOT easier to follow if you had the text of the presentation, but it's got some good content in there (and covers the "mutual-selection infinite recursive loop" problem that bites a lot of people in the ass Smiley).

malloc will be first against the wall when the revolution comes...
Offline SteveJohnson

JGO n00b
*

Posts: 15


Java games rock!


« Reply #9 on: 2003-11-13 18:01:46 »

Hello,

 Thanks for the replys.  I haven't made any progress other than getting the editing working a bit.  Works not bad though, handy to be able to change values on the fly and see what happens. Anyways, I am in the Navy and just got back from a couple of weeks at sea so I wasn't ignoring you guys.

Thanks,
Steve
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.089 seconds with 19 queries.