Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li>your GUI should not have more than one JFrame displaying.</li> <li>Your problem more generally is simply how to update the state of one object from another. Often calling setter methods should work. Sure this trivializes the question, but without further information from you, that's about the most we can tell you.</li> <li>When to do an update of the object may be a more difficult issue to tackle, and here using a observer pattern often is helpful. Examples of this include using ActionListeners or ChangeListeners or PropertyChangeListeners.</li> </ol> <p>For help in greater depth, consider giving us greater depth on your question.</p> <hr> <p><strong>Edit</strong><br> You state:</p> <blockquote> <p>The other JFrame is in another class. If you click a JButton the JFrame in another class will popup and it will update the JLabel in there. the 2 jframes is not in the same class. </p> </blockquote> <ul> <li>The second "JFrame" should be a JDialog, not a JFrame, and likely a <em>modal</em> dialog. This way you will know when the user has completed work on it, since when it is no longer visible, code flow will resume to the code that made the dialog visible. </li> <li>Again, transferring information from one "class" to another (really this is from one <em>object</em> to another) is often done via setter methods.</li> </ul> <p>If you're still confused, then please create a small compilable and runnable program that shows us your problem, an <a href="http://sscce.org" rel="nofollow noreferrer">sscce</a>.</p> <hr> <p><strong>Edit 2</strong><br> For an example of just what I'm suggesting, please see my answers and code here: </p> <ul> <li><a href="https://stackoverflow.com/a/7017147/522444">Passing values between JFrames</a>.</li> <li><a href="https://stackoverflow.com/a/4914063/522444">One JFrame opening another</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload