Here you can find the source of createButton(String text, boolean parse)
Parameter | Description |
---|---|
text | DOCUMENT ME! |
parse | DOCUMENT ME! |
public static JButton createButton(String text, boolean parse)
//package com.java2s; /*/*w ww .ja va 2s . com*/ * Copyright (c) 2001-2002, Marco Hunsicker. All rights reserved. * * This software is distributable under the BSD license. See the terms of the * BSD license in the documentation provided with this software. */ import javax.swing.AbstractButton; import javax.swing.JButton; public class Main { /** * Creates a new button with the given text. * * @param text DOCUMENT ME! * @param parse DOCUMENT ME! * * @return new button with the given text. * * @since 1.0b9 */ public static JButton createButton(String text, boolean parse) { JButton button = new JButton(); if (parse) { setMenuText(button, text, true); } else { button.setText(text); } return button; } /** * Creates a new button with the given text. * * @param text DOCUMENT ME! * * @return new button with the given text. * * @since 1.0b9 */ public static JButton createButton(String text) { return createButton(text, true); } /** * DOCUMENT ME! * * @param item DOCUMENT ME! * @param text DOCUMENT ME! * @param useMnemonic DOCUMENT ME! */ public static void setMenuText(AbstractButton item, String text, boolean useMnemonic) { int i = text.indexOf('&'); if (i < 0) { item.setText(text); } else { item.setText(text.substring(0, i) + text.substring(i + 1)); if (useMnemonic) { item.setMnemonic(text.charAt(i + 1)); } } } }