Coverage Report - de.glossmaker.gui.gloss.main.TopPanelFocusListener
 
Classes in this File Line Coverage Branch Coverage Complexity
TopPanelFocusListener
0%
0/9
0%
0/2
1,333
 
 1  
 package de.glossmaker.gui.gloss.main;
 2  
 
 3  
 import java.awt.event.FocusEvent;
 4  
 import java.awt.event.FocusListener;
 5  
 
 6  
 import javax.swing.text.JTextComponent;
 7  
 
 8  
 /**
 9  
  * This class selects the text in the JTextComponent if the component gains the focus.
 10  
  * 
 11  
  * @author Markus Flingelli
 12  
  *
 13  
  */
 14  
 public class TopPanelFocusListener implements FocusListener {
 15  
 
 16  0
         private JTextComponent mComponent = null;
 17  
         
 18  0
         public TopPanelFocusListener(JTextComponent component) {
 19  0
                 mComponent = component;
 20  0
         }
 21  
         
 22  
 
 23  
         @Override
 24  
         public void focusGained(FocusEvent e) {
 25  0
                 mComponent.setFocusable(mComponent.isEditable());
 26  0
                 if (mComponent.isFocusable()) {
 27  0
                         mComponent.selectAll();
 28  
                 }
 29  0
         }
 30  
 
 31  
         @Override
 32  0
         public void focusLost(FocusEvent e) {}
 33  
 
 34  
 }