Q: Calling Methods from Outside Object?

I am an old VB programmer trying to convert to JAVA.

I use a Jframe with a listbox to display and store general messages about the program status, etc. It is like a console or running log of events and messages. In VB, I know the form name and just call the function to add strings (frmDisplay.addString("HELP"). What is the best way in JAVA to send messages to this frame object even though the frame does not inherit or extend any of the other objects in the application? I must be missing something basic.

Thanks,

Scott

fskjunk@hotmail.com

[594 byte] By [fskennedy4] at [2007-9-26 1:35:18]
# 1

1) You can extend JFrame and simply add a method public void addString(String s)

that does what you want to.

2) If you want to add something to the list on the Frame you can keep the name of the listbox and directly add to it.

3) You can extend Frame like in 1 but this time you add a variable

public listbox (or whatever) lb;

then you can access it via <framename>.lb and basically use 2) again.

arcosh at 2007-6-29 2:19:29 > top of Java-index,Archived Forums,Java Programming...