Coverage Report - org.jtheque.core.managers.view.impl.components.filthy.FilthyTextField
 
Classes in this File Line Coverage Branch Coverage Complexity
FilthyTextField
0 %
0/19
N/A
1
 
 1  
 package org.jtheque.core.managers.view.impl.components.filthy;
 2  
 
 3  
 import org.jtheque.utils.ui.PaintUtils;
 4  
 
 5  
 import javax.swing.JTextField;
 6  
 import java.awt.Graphics;
 7  
 import java.awt.Graphics2D;
 8  
 
 9  
 /*
 10  
  * This file is part of JTheque.
 11  
  *
 12  
  * JTheque is free software: you can redistribute it and/or modify
 13  
  * it under the terms of the GNU General Public License as published by
 14  
  * the Free Software Foundation, either version 3 of the License.
 15  
  *
 16  
  * JTheque is distributed in the hope that it will be useful,
 17  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 19  
  * GNU General Public License for more details.
 20  
  *
 21  
  * You should have received a copy of the GNU General Public License
 22  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 23  
  */
 24  
 
 25  
 /**
 26  
  * A filthy text field.
 27  
  *
 28  
  * @author Baptiste Wicht
 29  
  */
 30  
 public final class FilthyTextField extends AbstractFilthyField {
 31  
     private JTextField textField;
 32  
 
 33  
     /**
 34  
      * Construct a new <code>FilthyTextField</code>.
 35  
      */
 36  
     public FilthyTextField() {
 37  0
         this(10);
 38  0
     }
 39  
 
 40  
     /**
 41  
      * Construct a new <code>FilthyTextField</code>.
 42  
      *
 43  
      * @param columns The number of columns.
 44  
      */
 45  
     public FilthyTextField(int columns) {
 46  0
         super();
 47  
 
 48  0
         textField.setColumns(columns);
 49  0
     }
 50  
 
 51  
     @Override
 52  
     void initComponent() {
 53  0
         textField = new JTextField();
 54  
         
 55  0
         makeFilthy(textField);
 56  
 
 57  0
         add(textField);
 58  0
     }
 59  
 
 60  
     @Override
 61  
     public void setEnabled(boolean enabled) {
 62  0
         super.setEnabled(enabled);
 63  
 
 64  0
         textField.setEnabled(enabled);
 65  0
     }
 66  
 
 67  
     /**
 68  
      * Return the entered text.
 69  
      *
 70  
      * @return The entered text.
 71  
      */
 72  
     public String getText() {
 73  0
         return textField.getText();
 74  
     }
 75  
 
 76  
     /**
 77  
      * Set the text.
 78  
      *
 79  
      * @param t The text.
 80  
      */
 81  
     public void setText(String t) {
 82  0
         textField.setText(t);
 83  0
     }
 84  
 
 85  
     /**
 86  
      * Return the text field.
 87  
      *
 88  
      * @return The text field.
 89  
      */
 90  
     public JTextField getTextField() {
 91  0
         return textField;
 92  
     }
 93  
 
 94  
     @Override
 95  
     public void paint(Graphics g) {
 96  0
         PaintUtils.initHints((Graphics2D) g);
 97  
 
 98  0
         super.paint(g);
 99  0
     }
 100  
 }