Note that there are some explanatory texts on larger screens.

plurals
  1. POJFrame text alert as result
    primarykey
    data
    text
    <p>im working on a little swing application to deal with some multithreading / synchronization, but that besides the point. I basically have 3 horses racing and when one finishes a box will pop up and say that <em>_</em> horse won.This is what I have right now because i couldn't figure out just a plain window to display the winner.</p> <pre><code> if(horsea.getX()&gt;=415){ PausableThread.pause(); String result=JOptionPane.showInputDialog("Horse #1 Wins!"); PausableThread.unpause(); setReset(true); PausableThread.pause(); } else if(horseb.getX()&gt;=415){ PausableThread.pause(); String result=JOptionPane.showInputDialog("Horse #2 Wins!"); PausableThread.unpause(); setReset(true); PausableThread.pause(); } else if(horsec.getX()&gt;=415){ PausableThread.pause(); String result=JOptionPane.showInputDialog("Horse #3 Wins!"); PausableThread.unpause(); setReset(true); PausableThread.pause(); } </code></pre> <p>I know that is a dialog box, and i know there are other methods that are like showMessageDialog or something but idk what the parameters for those are,</p> <p>thanks for any help!</p> <p><strong>EDIT:</strong></p> <p>so this is what I want to use but in mine im not sure what "frame" is.</p> <pre><code> else if(horseb.getX()&gt;=415){ PausableThread.pause(); String result=JOptionPane.showMessageDialog(frame, "Horse 2 is the winner", "We Have A Winner!", JOptionPane.PLAIN_MESSAGE); PausableThread.unpause(); setReset(true); PausableThread.pause(); } </code></pre> <p>That is the kind of message I want to display, but there is an error under where frame is</p> <p><strong>EDIT:</strong></p> <p>got it by using this!</p> <pre><code>JOptionPane.showMessageDialog(getRootPane(),"Horse 2 is the winner", "We Have A Winner!", JOptionPane.PLAIN_MESSAGE); </code></pre> <p>thanks for the help Eels!</p>
    singulars
    1. This table or related slice is empty.
    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. 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