Java tutorial
//package com.java2s; import java.awt.Component; import javax.swing.AbstractButton; import javax.swing.JToolBar; public class Main { /** * Turns on display of text in all child buttons within the * {@link JToolBar}. * * @param toolBar * @param show */ public static void showText(JToolBar toolBar, boolean show) { for (Component comp : toolBar.getComponents()) { if (comp instanceof AbstractButton) { ((AbstractButton) comp).putClientProperty("hideActionText", Boolean.valueOf(show)); } } toolBar.revalidate(); } }