This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to instantiate a TTreeViewWidget, from the Jexer library

 
Greenhorn
Posts: 18
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to generate a treeview, from a TreeViewWidge class, with these lines

...
...
...
...




, but the compiler keeps telling me that addTreeViewWidget isn't found ("No candidates found for method call")


This is inside a main method, called from Groovy.


The docs regarding the TTreeViewWidget widget are here:


https://jexer.sourceforge.io/apidocs/api/jexer/ttree/TTreeViewWidget.html



Constructors


TTreeViewWidget​(TWidget parent, int x, int y, int width, int height)
Public constructor.

TTreeViewWidget​(TWidget parent, int x, int y, int width, int height, TAction action)
Public constructor.


addTreeViewWidget is a public final method in the TWidget class:






 
Saloon Keeper
Posts: 10639
83
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to give it a TWidget object in front of the method name
 
Don Campbell
Greenhorn
Posts: 18
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Carey,

Unfortunately, TWidget is an abstract class.  I can't seem to find any examples in the source, where it's implemented in the way that I need.

But besides, in some of the source examples addTreeViewWidget is just called, without any explicit instantiated object reference.



But it looks like a derivative project, TJIde (a text-mode java IDE), has some demo code that calls some of the Treeview methods.

If you have any more suggestions, please let me know, thanks Carey.  Otherwise, thanks for the input, which was much sooner than I expected.



Carey Brown wrote:You have to give it a TWidget object in front of the method name

 
Marshal
Posts: 4468
567
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Don Campbell wrote:But besides, in some of the source examples addTreeViewWidget is just called, without any explicit instantiated object reference.


Do the classes of those examples extend something which implement addTreeViewWidget?
 
Don Campbell
Greenhorn
Posts: 18
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Possibly.  Been searching, but so far have not seen it defined, other than in TWidget itself.  

And that's a final method, so I don't see that we would even have to implement it.  Since TWidget is imported, I would expect that the final method would be automatically recognized by the IDE.

https://gitlab.com/AutumnMeowMeow/jexer/-/tree/master/src/jexer

https://gitlab.com/AutumnMeowMeow/jexer/-/blob/master/src/jexer/TWidget.java

https://jexer.sourceforge.io/apidocs/api/jexer/ttree/TTreeViewWidget.html


Ron McLeod wrote:

Don Campbell wrote:But besides, in some of the source examples addTreeViewWidget is just called, without any explicit instantiated object reference.


Do the classes of those examples extend something which implement addTreeViewWidget?

 
Carey Brown
Saloon Keeper
Posts: 10639
83
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may not need to Override the method but if you don't extend something you have no "this" object to tie into the method.
 
Don Campbell
Greenhorn
Posts: 18
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the class that I'm using, I extend TWindow.

It looks like this is more complex than I thought.  It seems as if we can't call a TreeViewWindow in isolation, even though that's the only feature I'm trying to experiment with.

It appears that we need to create a TApplication first as a container, and set up the TreeView inside that.
 
Carey Brown
Saloon Keeper
Posts: 10639
83
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
 
Ron McLeod
Marshal
Posts: 4468
567
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

https://gitlab.com/AutumnMeowMeow/jexer/-/blob/master/src/jexer/TWindow.java wrote:public class TWindow extends TWidget


 
Carey Brown
Saloon Keeper
Posts: 10639
83
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then we'd need to see more of your code, including import, extends, methods, and call to the problem method.
 
Carey Brown
Saloon Keeper
Posts: 10639
83
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please don't needlessly quote previous post. It only adds clutter.
 
Don Campbell
Greenhorn
Posts: 18
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Carey/Ron,

Thanks, I'll continue tomorrow.  Starting to doze off, and will start making dumb mistakes.

T & R,
 
Greenhorn
Posts: 27
1
IBM DB2 Netbeans IDE Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don, I think you are correct, you need the TApplication which will contain the TWindow which contains the TTreeViewWidget.
Similar to below...

 
Don Campbell
Greenhorn
Posts: 18
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mike, thanks.  You just saved me hours or days of time, trying to distill multiple demo modules into a few lines, in order to experiment with.

 
reply
    Bookmark Topic Watch Topic
  • New Topic