Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would create a custom-built modal JDialog for this. You could use DocumentListeners that are added to your text components to enable and disable the JButtons on the dialog.</p> <hr> <p><strong>Edit</strong><br> You state:</p> <blockquote> <p>hummm, in the way it is, can a create a KeyListenner to the textfields to check if the typed is number??? if its number, make the OK button visibile, but how can i access the button? its not a Jbutton</p> </blockquote> <p>It <strong><em>is</em></strong> a JButton if you follow my suggestions above and make your own JDialog and don't use a JOptionPane. And no, you should almost never use a KeyListener with Swing applications. If you want to verify the input, use a JFormattedTextField or a DocumentFilter or an InputVerifier.</p> <hr> <p><strong>Edit 2</strong><br> You state: </p> <blockquote> <p>hummm, understand, i will read something about creating a modal Jdialog, thannk you :) this will work like "Jframe" isnt it? so i i will add components to it and will be possible to get Components events, property etc..</p> </blockquote> <p>A JDialog is similar to a JFrame in that it's a top-level window, and like a JFrame you would load up a JPanel with all the components that it will display, then add the JPanel to the JDialog's contentPane, <code>pack()</code> it and set it visible, but it's different from a JFrame in that its constructors are different. You will need to pass in the parent window (here the main JFrame), a String title and a Dialog.ModalityType, likely APPLICATION_MODAL. Like a JOptionPane, once you set it to visible, all code from the calling code halts and waits for the dialog to no longer be visible prior to resuming.</p>
    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. 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.
    3. 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