Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class zatwierdzanie_stylu implements ListSelectionListener{
- public void valueChanged(ListSelectionEvent e){
- ListSelectionModel wybrany_styl=(ListSelectionModel)e.getSource();
- if(!wybrany_styl.isSelectionEmpty()){
- // Find out which indexes are selected.
- int minIndex=wybrany_styl.getMinSelectionIndex();
- int maxIndex=wybrany_styl.getMaxSelectionIndex();
- for(int i=minIndex; i<=maxIndex; i++){
- if(wybrany_styl.isSelectedIndex(i)){
- styl_czcionki=i;
- if(styl_czcionki==0){
- textArea2.setFont(textArea2.getFont().deriveFont(Font.PLAIN));
- }
- else if(styl_czcionki==1){
- textArea2.setFont(textArea2.getFont().deriveFont(Font.BOLD));
- }
- else{
- textArea2.setFont(textArea2.getFont().deriveFont(Font.ITALIC));
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement