• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
* 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
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic