Reja muhim voqealar haqida ma’lumotlar



Download 0,64 Mb.
Pdf ko'rish
bet4/9
Sana05.01.2021
Hajmi0,64 Mb.
#54863
1   2   3   4   5   6   7   8   9
Bog'liq
391 3 [1](1)I21

KEY_RELEASED metodi 

KEY_RELEASED : Klaviatura tugmachasi chiqarilganda ushbu turdagi kalit 

hodisalari yaratiladi. Bu farq o'zga , KEY_RELEASED tadbirlar KEY_PRESSED  

uchun bir xil  tadbirlar; ammo, quyida ko'rib chiqamiz, ular kam uchraydi. 

private void jTextField2KeyPressed(java.awt.event.KeyEvent evt) {                                        

        int keyCode = evt.getKeyCode(); 

        if (keyCode == 66) { 

        jLabel1.setText("Siz b harfini bostingiz"); 

         displayInfo(evt, "KeyPressed"); 

        } 

    }                                       

 

    private void jTextField2KeyReleased(java.awt.event.KeyEvent evt) {                                         



       int keyCode = evt.getKeyCode(); 

        if (keyCode == 67) { 

        jLabel1.setText("Siz c harfini bostingiz"); 

         displayInfo(evt, "KeyReleased"); 

        } 

    }                                        

 

    private void jTextField2KeyTyped(java.awt.event.KeyEvent evt) {                                      



        displayInfo(evt, "KeyTyped"); 

         

    }     

 

 



protected void displayInfo(KeyEvent evt, String s){ 


Dasturlash II   fanidan 9-ma’ruza

 



 

 String keystring, modstring, tmpstring, actionstring,locationstring; 

 int id=evt.getID(); 

 if (id == KeyEvent.KEY_TYPED) { 

          char c = evt.getKeyChar(); 

          keystring = "key character = '" + c + "'"; 

        } else { 

          int keyCode = evt.getKeyCode(); 

          keystring 

"key 



code 



keyCode 


(" 



KeyEvent.getKeyText(keyCode) + ")"; 

        } 

  

  int modifiers = evt.getModifiersEx(); 



        modstring = "modifiers = " + modifiers; 

        tmpstring = KeyEvent.getModifiersExText(modifiers); 

        if (tmpstring.length() > 0) { 

          modstring += " (" + tmpstring + ")"; 

        } else { 

          modstring += " (no modifiers)"; 

        } 

      


        actionstring = "action key? "; 

        if (evt.isActionKey()) { 

          actionstring += "YES"; 

        } else { 

          actionstring += "NO"; 

        } 

         

        locationstring = "key location: "; 

        int location = evt.getKeyLocation(); 

        if (location == KeyEvent.KEY_LOCATION_STANDARD) { 

          locationstring += "standard"; 

        } else if (location == KeyEvent.KEY_LOCATION_LEFT) { 

          locationstring += "left"; 

        } else if (location == KeyEvent.KEY_LOCATION_RIGHT) { 

          locationstring += "right"; 

        } else if (location == KeyEvent.KEY_LOCATION_NUMPAD) { 

          locationstring += "numpad"; 

        } else { // (location == KeyEvent.KEY_LOCATION_UNKNOWN) 

          locationstring += "unknown"; 

        } 

         

       


jTextArea1.setText(keystring+"\n"+modstring+"\n"+actionstring+"\n"+locationstri

ng); 



Dasturlash II   fanidan 9-ma’ruza

 



 

 } 


 

 

 




Download 0,64 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish