Cov txheej txheem:

Dab tsi yog null hauv JOptionPane showMessageDialog?
Dab tsi yog null hauv JOptionPane showMessageDialog?

Video: Dab tsi yog null hauv JOptionPane showMessageDialog?

Video: Dab tsi yog null hauv JOptionPane showMessageDialog?
Video: Leng Yang - Yog Vim Dab Tsi (Official Full Song | Nkauj Tawm Tshiab) 2020/05/24 2024, Kaum ib hlis
Anonim

Hla null rau nws tsuas yog qhia tias tsis muaj qhov cuam tshuam "niam txiv" dialog - piv txwv li, lub dialog raug tso tawm tsis yog rau lwm lub dialog. Hloov chaw, koj tuaj yeem siv lub npe overloaded thiab hu nws zoo li no: showInputDialog (Object message)

Ua li no, koj siv JOptionPane showMessageDialog li cas?

Thawj qhov yuav tsum tau ua yog siv lub tsev qiv ntawv uas peb xav siv:

  1. import javax.
  2. Txhawm rau kom tau txais lub thawv ntawv uas tus neeg siv tuaj yeem ntaus rau hauv, peb tuaj yeem siv txoj kev showInputDialog ntawm JOptionPane.
  3. String first_name;
  4. Ob npaug nias showInputDialog.
  5. Txoj hlua family_name;
  6. Txoj hlua full_name;
  7. JOptionPane.showMessageDialog(null, full_name);

Ib tug kuj yuav nug, ua li cas koj paub meej tias dialog ntawm JOptionPane? Tsim ib tug paub meej dialog box hauv Java, siv lub Java Swing JOptionPane . showConfirmDialog() txoj kev, uas tso cai rau koj los tsim ib tug dialog box uas nug kev lees paub los ntawm tus neeg siv. Rau piv txwv , Koj puas xav rov pib dua lub kaw lus?, "Cov ntaub ntawv no muaj tus kab mob, Koj puas xav tseem rub tawm?", thiab lwm yam.

Ib sab saum toj no, JOptionPane showMessageDialog hauv Java yog dab tsi?

Cov Txheej Txheem ntawm JOptionPane class Nws yog siv los tsim cov ntaub ntawv-lus dialog hu ua "Xov". static void showMessageDialog (Cov ntsiab lus parentComponent, Object message, String title, int messageType) Nws yog siv los tsim cov lus sib tham nrog lub npe thiab hom lus.

Koj ua JOptionPane li cas?

Tsim ib JOptionPane: JOptionPane Dialog « Swing « Java

  1. Tso cov lus (los ntawm kev siv cov txheej txheem showMessageDialog)
  2. Nug rau tus neeg siv qhov kev pom zoo (siv cov txheej txheem showConfirmDialog)
  3. Tau txais tus neeg siv cov tswv yim (siv cov txheej txheem showInputDialog)
  4. Ua qhov sib xyaw peb saum toj no (siv cov txheej txheem showOptionDialog)

Pom zoo: