Java tutorial
//package com.java2s; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.SwingConstants; public class Main { public static JLabel createLabel(String text) { return createLabel(text, SwingConstants.LEADING); } public static JLabel createLabel(String text, int align) { final JLabel b = new JLabel(text, align); configureActiveComponent(b); return b; } private static JComponent configureActiveComponent(JComponent c) { // if (benchRuns == 0) { // c.addMouseMotionListener(toolTipListener); // c.addMouseListener(constraintListener); // } return c; } }