Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Listen Event of Another Class

  Asked By: Kaua    Date: Nov 15    Category: Java    Views: 1047

Can anyone help me in the following:

I have two Jframes, MainScreen and PropertyWindow. MainScreen
contains some labels and textboxes. PropertyWindow contains a JTable
which contains all the properties of TextBoxes and Labels etc
(Something like VB Form). What I want to do is:

If I change the width and height of a Label from PropertyWindow,
Label should change. Right now it does everything but doesnt call the
repaint method. How can I call the repaint of MainScreen when the
Properties change in JTable.



2 Answers Found

Answer #1    Answered By: Hehet Chalthoum     Answered On: Nov 15

You need to pass the MainScreen instance to the PropertyWindow and
invoke the repaint method  from the appropriate table listener.

Answer #2    Answered By: Maria Miller     Answered On: Nov 15

Well, about ur question of how to repaint  he mainFrame, I don't know how to make
it using event  listener, but I have a work around for that problem.

Try the following:
1. pass a refrence to the mainFrame while opening the propertyFrame.
2. make an action listener in the propertyFrame that will invoke a method  in the
mainFrame using the refrence to repaint the mainFrame on property change..

Didn't find what you were looking for? Find more on Listen Event of Another Class Or get search suggestion and latest updates.