Here you can find the source of clear(JTextComponent... fields)
public static void clear(JTextComponent... fields)
//package com.java2s; //License from project: Open Source License import javax.swing.JLabel; import javax.swing.text.JTextComponent; public class Main { public static void clear(JTextComponent... fields) { for (JTextComponent field : fields) { field.setText(""); }/*from w w w .j a v a 2 s . co m*/ } public static void clear(JLabel... fields) { for (JLabel field : fields) { field.setText(""); } } }