Java tutorial
//package com.java2s; import java.awt.Cursor; import java.awt.Insets; import javax.swing.JButton; public class Main { /** * Configures a button as if it was an hyperlink. * * @param button * the button to configure. */ public static void configureButtonAsHyperlink(JButton button) { if (button == null) { return; } StringBuffer html = new StringBuffer(); html.append("<html><font color=\"blue\"><u>"); html.append(button.getText()); html.append("</u></font></html>"); button.setText(html.toString()); button.setMargin(new Insets(0, 0, 0, 0)); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); button.setFocusPainted(false); button.setBorderPainted(false); button.setContentAreaFilled(false); } }