Here you can find the source of setMenuText(AbstractButton item, String text, boolean useMnemonic)
Parameter | Description |
---|---|
item | DOCUMENT ME! |
text | DOCUMENT ME! |
useMnemonic | DOCUMENT ME! |
public static void setMenuText(AbstractButton item, String text, boolean useMnemonic)
//package com.java2s; /*/*from w w w . ja v a2 s. c o m*/ * 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; public class Main { /** * 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)); } } } }