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 Multiple files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Multiple files?" Watch "Multiple files?" New topic
Author

Multiple files?

James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

I am working on a notepad like project and we have a single file that we are wanting to split up into multiple files. The problem I am having is that I cannot get parts of the program that display information into textboxes to work after I place them into a separate file. How do I get classes to reference parts of the GUI from another class?


Visit my blog! http://jameshambrick.com
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

Or is that even possible?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

This isn't really a GUI problem - it's an OO design problem. You just have to pass references to revelant component objects to the new class.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

Like:---This is a rough sketch and some syntax is probably wrong, I dont have the code in front of me.

[ November 28, 2007: Message edited by: James Hambrick ]
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Unsure if this is correct because the code sample was short - but something like this:



For this specific example - it might make more sense to use a CaretListener - though I'm still unsure how finding the caret position in the textArea can give you the columns...
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

The answer to that is on another post where I was shown how to do this on antoher post. I will try that idea on the code when I get a chance to get back to my home computer. With Christmas getting close Ive been running around alot.
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

how is that code going to work with a caret listener?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Since the comment inside the LineColumnCount.getColumnCount() was


I thought it might make more sense to use a CaretListener.
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282



This is the relevant code that I have, I was wanting to make a class that calculates the line number and column number.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple files?