CloneSet133


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
28230.968method_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
12843
E:/TSE/Projects-CloneDR/columba-1.4-src/core/src/main/java/org/columba/core/gui/base/MnemonicSetter.java
22885
E:/TSE/Projects-CloneDR/columba-1.4-src/core/src/main/java/org/columba/core/gui/base/MnemonicSetter.java
Next
Last
Clone Instance
1
Line Count
28
Source Line
43
Source File
E:/TSE/Projects-CloneDR/columba-1.4-src/core/src/main/java/org/columba/core/gui/base/MnemonicSetter.java

/**
 * Sets the text of a menu, menuitem, button or checkbox. If a & character
 * is found, it is used to define the mnemonic. Else the text is set just as
 * if the setText method of the component was called.
 * 
 * @param component
 *            Menu, menuitem, button or checkbox to handle
 * @param text
 *            Displaytext, possibly including & for mnemonic specification
 */
public static void setTextWithMnemonic(AbstractButton component, String text) {
  // search for mnemonic
  int index = text.indexOf("&");
  if ((index != -1) && ((index + 1) < text.length())) {
    // mnemonic found
    // ...and not at the end of the string (which doesn't make sence)
    char mnemonic = text.charAt(index + 1);
    StringBuffer buf = new StringBuffer();
    // if mnemonic is first character of this string
    if (index == 0) {
      buf.append(text.substring(1));
    }
    else {
      buf.append(text.substring(0, index));
      buf.append(text.substring(index + 1));
    }
    // set display text
    component.setText(buf.toString());
    // set mnemonic
    component.setMnemonic(mnemonic);
    component.setDisplayedMnemonicIndex(index);
  }
  else {
    // no mnemonic found - just set the text on the menu item
    component.setText(text);
  }
}


First
Previous
Clone Instance
2
Line Count
28
Source Line
85
Source File
E:/TSE/Projects-CloneDR/columba-1.4-src/core/src/main/java/org/columba/core/gui/base/MnemonicSetter.java

/**
 * Sets the text of a label including mnemonic. <br>
 * Same functionality as
 * 
 * @see setTextWithMnemonic
 * 
 * @param label
 *            Label to handle
 * @param text
 *            Displaytext, possibly including & for mnemonic specification
 */
public static void setTextWithMnemonic(JLabel label, String text) {
  // search for mnemonic
  int index = text.indexOf("&");
  if ((index != -1) && ((index + 1) < text.length())) {
    // mnemonic found
    // ...and not at the end of the string (which doesn't make sence)
    char mnemonic = text.charAt(index + 1);
    StringBuffer buf = new StringBuffer();
    // if mnemonic is first character of this string
    if (index == 0) {
      buf.append(text.substring(1));
    }
    else {
      buf.append(text.substring(0, index));
      buf.append(text.substring(index + 1));
    }
    // set display text
    label.setText(buf.toString());
    // set mnemonic
    label.setDisplayedMnemonic(mnemonic);
    label.setDisplayedMnemonicIndex(index);
  }
  else {
    // no mnemonic found - just set the text on the menu item
    label.setText(text);
  }
}


Clone AbstractionParameter Count: 3Parameter Bindings

/**
         * Sets the text of a label including mnemonic. <br>
         * Same functionality as
         * 
         * @see setTextWithMnemonic
         * 
         * @param label
         *            Label to handle
         * @param text
         *            Displaytext, possibly including & for mnemonic specification
         */
/**
         * Sets the text of a menu, menuitem, button or checkbox. If a & character
         * is found, it is used to define the mnemonic. Else the text is set just as
         * if the setText method of the component was called.
         * 
         * @param component
         *            Menu, menuitem, button or checkbox to handle
         * @param text
         *            Displaytext, possibly including & for mnemonic specification
         */
public static void setTextWithMnemonic( [[#variablef3cf480]]  [[#variablef3c7300]], String text) {
  // search for mnemonic
  int index = text.indexOf("&");
  if ((index != -1) && ((index + 1) < text.length())) {
    // mnemonic found
    // ...and not at the end of the string (which doesn't make sence)
    char mnemonic = text.charAt(index + 1);
    StringBuffer buf = new StringBuffer();
    // if mnemonic is first character of this string
    if (index == 0) {
      buf.append(text.substring(1));
    }
    else {
      buf.append(text.substring(0, index));
      buf.append(text.substring(index + 1));
    }
     [[#variablef3c7300]].setText(buf.toString());
     [[#variablef3c7300]]. [[#variablef3cf500]](mnemonic);
     [[#variablef3c7300]].setDisplayedMnemonicIndex(index);
  }
  else {
     [[#variablef3c7300]].setText(text);
  }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#f3cf480]]
AbstractButton 
12[[#f3cf480]]
JLabel 
21[[#f3c7300]]
component 
22[[#f3c7300]]
label 
31[[#f3cf500]]
setMnemonic 
32[[#f3cf500]]
setDisplayedMnemonic