Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.13 KB | None | 0 0
  1.     class zatwierdzanie_stylu implements ListSelectionListener{
  2.         public void valueChanged(ListSelectionEvent e){
  3.             ListSelectionModel wybrany_styl=(ListSelectionModel)e.getSource();
  4.  
  5.             if(!wybrany_styl.isSelectionEmpty()){
  6.                 // Find out which indexes are selected.
  7.                 int minIndex=wybrany_styl.getMinSelectionIndex();
  8.                 int maxIndex=wybrany_styl.getMaxSelectionIndex();
  9.                 for(int i=minIndex; i<=maxIndex; i++){
  10.                     if(wybrany_styl.isSelectedIndex(i)){
  11.                         styl_czcionki=i;
  12.                         if(styl_czcionki==0){
  13.                             textArea2.setFont(textArea2.getFont().deriveFont(Font.PLAIN));
  14.                         }
  15.                         else if(styl_czcionki==1){
  16.                             textArea2.setFont(textArea2.getFont().deriveFont(Font.BOLD));
  17.                         }
  18.                         else{
  19.                             textArea2.setFont(textArea2.getFont().deriveFont(Font.ITALIC));
  20.                         }
  21.                     }
  22.                 }
  23.             }
  24.         }
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement