D
D
dayz7772014-10-12 11:22:06
Java
dayz777, 2014-10-12 11:22:06

How to access an object of a class?

There is class A, on which JFrame is located, and on it JLabel, in class B there is a printText function for writing text on JLabel. There is a class B. How to call the printText function from class B?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mamkaololosha, 2014-10-12
@mamkaololosha

Either make B public static final and call it like B::printText.
Either create object B in class A.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question