File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Displaying data in a table that lies in a container tree. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Displaying data in a table that lies in a container tree." Watch "Displaying data in a table that lies in a container tree." New topic
Author

Displaying data in a table that lies in a container tree.

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
Here the structure is



When I do jAllPanel.jMainTabbedPanel.getComponent(1)
I can't get down one more level by getComponent(1) again by auto name completion in Java.

How do I get to that level by Name? is it a protected field by default?
Thanks
Jack
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Jack Luk wrote:I can't get down one more level by getComponent(1) again by auto name completion in Java.

Java doesn't have anything resembling auto name completion. Is this a question about some feature of a particular IDE? TellTheDetails


luck, db
There are no new questions, but there may be new answers.
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
Darryl Burke wrote:
Jack Luk wrote:I can't get down one more level by getComponent(1) again by auto name completion in Java.

Java doesn't have anything resembling auto name completion. Is this a question about some feature of a particular IDE? TellTheDetails


As I did the design visually, I did not inherit JPanel whatsoever.

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

Jack Luk wrote:
Darryl Burke wrote:Java doesn't have anything resembling auto name completion. Is this a question about some feature of a particular IDE? TellTheDetails


As I did the design visually, I did not inherit JPanel whatsoever.

Java -- the standard JDK -- doesn't include any features to allow you do design visually. Once again, is this a question about some feature of a particular IDE? TellTheDetails
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
Detailed description of problem
what you did

* I am developing a time-attendance system, I am using the MVC methodology, It is being developed by JDK and netbeans. As I have asked somewhere else, JDK wasn't designed to let users create user interfaces visually in mind, so I have to ask here.
I established a Main Object and inside it, there are SmartCard and Database and View, the view has to update the screen. The screen was designed visually, that's what we have now. I want to update the screen (Frame) inside the view class.

what you expected to happen
* I want to get ContentPane() out of JFrame and then I getCompoents() of the Container. I expect the "intelli-sense" would let me reference the controls inside controls.
and in fact it is not coming out.

why you expected it to happen
* That's what my logical sense tells me. But I can't visualize SWING easily.

why you need it to happen
* Updating screen inside view

what actually happened instead and
* No controls reference coming out.

why what happened is a problem to you
* How come I can't do getComponents(1).getComponents(1)... etc
* going down one level by one level

Error message
Version numbers of relevant libraries, JDK, tools, operating system etc.
* JDK 1.7, Win7 SP1, Netbeans

Code snippets



Stack trace
--------- Nil
What else you tried/what worked/what didn't work
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
Dear Experts,
If nothing can be done, I would resort to the conventional way of development - building the GUI using statements.
Thanks
Jack
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4664
    
    5

* How come I can't do getComponents(1).getComponents(1)... etc

First off, getComponents() doesn't take a parameter. You are probably referring to getComponent(int n) -- what is the return type of that method? Does that class have a getComponent(...) or getComponents() method? Are you aware of casting? Not that casting is a good idea here; if more than one method requires access to a Component, that Component should be an instance field.

If nothing can be done, I would resort to the conventional way of development - building the GUI using statements.

Much better, and easier. A visual designer is not a beginners' tool.

Oh, and auto-completion is not "intelli-sense"
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
Darryl Burke wrote:
* How come I can't do getComponents(1).getComponents(1)... etc

First off, getComponents() doesn't take a parameter. You are probably referring to getComponent(int n) -- what is the return type of that method? Does that class have a getComponent(...) or getComponents() method? Are you aware of casting? Not that casting is a good idea here; if more than one method requires access to a Component, that Component should be an instance field.

If nothing can be done, I would resort to the conventional way of development - building the GUI using statements.

Much better, and easier. A visual designer is not a beginners' tool.

Oh, and auto-completion is not "intelli-sense"


Dear Expert,
These are the methods that are available after calling getComponent(1)
http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/Component.html
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
it's not getComponent(1) that is being queried, it's the plural version that you are using
getComponents(1)
from this line
* How come I can't do getComponents(1).getComponents(1)... etc

you may be better off using SwingUtilities to burrow down to what you want

here's a simple demo of accessing a JLabel that has no variable name
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying data in a table that lies in a container tree.