JPanel buttons = new JPanel(); buttons.setLayout(new BoxLayout(buttons,BoxLayout.X_AXIS)); buttons.setBorder(new EmptyBorder(12,0,0,0)); buttons.add(Box.createGlue()); ok = new JButton(jEdit.getProperty("common.ok")); ok.addActionListener(actionListener); getRootPane().setDefaultButton(ok); buttons.add(ok); buttons.add(Box.createHorizontalStrut(6)); cancel = new JButton(jEdit.getProperty("common.cancel")); cancel.addActionListener(actionListener); buttons.add(cancel); buttons.add(Box.createGlue()); content.add(BorderLayout.SOUTH,buttons); //}}} pack(); setLocationRelativeTo(view); setVisible(true);
JPanel buttons = new JPanel(); buttons.setLayout(new BoxLayout(buttons,BoxLayout.X_AXIS)); buttons.setBorder(new EmptyBorder(12,0,0,0)); buttons.add(Box.createGlue()); ok = new JButton(jEdit.getProperty("common.ok")); ok.addActionListener(new ActionHandler()); getRootPane().setDefaultButton(ok); buttons.add(ok); buttons.add(Box.createHorizontalStrut(6)); cancel = new JButton(jEdit.getProperty("common.cancel")); cancel.addActionListener(new ActionHandler()); buttons.add(cancel); buttons.add(Box.createGlue()); content.add(BorderLayout.SOUTH,buttons); pack(); setLocationRelativeTo(getParent()); setVisible(true);
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/BufferOptions.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/FontSelector.java
Method name: void BufferOptions(View, Buffer) Method name: void init(Font)
Number of AST nodes: 17 Number of AST nodes: 17
1
JPanel buttons = new JPanel();
1
JPanel buttons = new JPanel();
2
		buttons.setLayout(new BoxLayout(buttons,BoxLayout.X_AXIS));
2
		buttons.setLayout(new BoxLayout(buttons,BoxLayout.X_AXIS));
3
		buttons.setBorder(new EmptyBorder(12,0,0,0));
3
		buttons.setBorder(new EmptyBorder(12,0,0,0));
4
		buttons.add(Box.createGlue());
4
		buttons.add(Box.createGlue());
5
		ok = new JButton(jEdit.getProperty("common.ok"));
5
		ok = new JButton(jEdit.getProperty("common.ok"));
6
		ok.addActionListener(actionListener);
6
		ok.addActionListener(new ActionHandler());
7
		getRootPane().setDefaultButton(ok);
7
		getRootPane().setDefaultButton(ok);
8
		buttons.add(ok);
8
		buttons.add(ok);
9
		buttons.add(Box.createHorizontalStrut(6));
9
		buttons.add(Box.createHorizontalStrut(6));
10
		cancel = new JButton(jEdit.getProperty("common.cancel"));
10
		cancel = new JButton(jEdit.getProperty("common.cancel"));
11
		cancel.addActionListener(actionListener);
11
		cancel.addActionListener(new ActionHandler());
12
		buttons.add(cancel);
12
		buttons.add(cancel);
13
		buttons.add(Box.createGlue());
13
		buttons.add(Box.createGlue());
14
		content.add(BorderLayout.SOUTH,buttons);
14
		content.add(BorderLayout.SOUTH,buttons);
15
		//}}}
16

17
		pack();
15
		pack();
18
		setLocationRelativeTo(view);
16
		setLocationRelativeTo(getParent());
19
		setVisible(true);
17
		setVisible(true);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes having the same super class
Number of node comparisons132
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements15
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    67
    JPanel buttons = new JPanel();
    35
    JPanel buttons = new JPanel();
    68
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    36
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    69
    buttons.setBorder(new EmptyBorder(12, 0, 0, 0));
    37
    buttons.setBorder(new EmptyBorder(12, 0, 0, 0));
    70
    buttons.add(Box.createGlue());
    38
    buttons.add(Box.createGlue());
    71
    ok = new JButton(jEdit.getProperty("common.ok"));
    39
    ok = new JButton(jEdit.getProperty("common.ok"));
                                                                                                
    40
    ok.addActionListener(new ActionHandler());
    72
    ok.addActionListener(actionListener);
    72
    ok.addActionListener(actionListener);
    49
    pack();
    Differences
    Expression1Expression2Difference
    addActionListenerpackMETHOD_INVOCATION_NAME_MISMATCH
    ok.addActionListener(actionListener)pack()ARGUMENT_NUMBER_MISMATCH
    okMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression ok.addActionListener(actionListener) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ok.addActionListener(actionListener) is a void method call, and thus it cannot be parameterized
    Expression pack() is a void method call, and thus it cannot be parameterized
    Expression ok.addActionListener(actionListener) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ok.addActionListener(actionListener) is a void method call, and thus it cannot be parameterized
    Expression pack() is a void method call, and thus it cannot be parameterized
    49
    pack();
    73
    getRootPane().setDefaultButton(ok);
    41
    getRootPane().setDefaultButton(ok);
    74
    buttons.add(ok);
    42
    buttons.add(ok);
    75
    buttons.add(Box.createHorizontalStrut(6));
    43
    buttons.add(Box.createHorizontalStrut(6));
    76
    cancel = new JButton(jEdit.getProperty("common.cancel"));
    44
    cancel = new JButton(jEdit.getProperty("common.cancel"));
                                                                                                        
    45
    cancel.addActionListener(new ActionHandler());
    77
    cancel.addActionListener(actionListener);
                                                                                              
    78
    buttons.add(cancel);
    46
    buttons.add(cancel);
    79
    buttons.add(Box.createGlue());
    47
    buttons.add(Box.createGlue());
    80
    content.add(BorderLayout.SOUTH, buttons);
    48
    content.add(BorderLayout.SOUTH, buttons);
    81
    pack();
    81
    pack();
    51
    setVisible(true);
    Differences
    Expression1Expression2Difference
    packsetVisibleMETHOD_INVOCATION_NAME_MISMATCH
    pack()setVisible(true)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression pack() is a void method call, and thus it cannot be parameterized
    Expression setVisible(true) is a void method call, and thus it cannot be parameterized
    Expression pack() is a void method call, and thus it cannot be parameterized
    Expression setVisible(true) is a void method call, and thus it cannot be parameterized
    51
    setVisible(true);
    82
    setLocationRelativeTo(view);
    82
    setLocationRelativeTo(view);
    50
    setLocationRelativeTo(getParent());
    Differences
    Expression1Expression2Difference
    viewgetParent()TYPE_COMPATIBLE_REPLACEMENT
    50
    setLocationRelativeTo(getParent());
    83
    setVisible(true);
                                              
    Precondition Violations (10)
    Row Violation
    1Expression ok.addActionListener(actionListener) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ok.addActionListener(actionListener) is a void method call, and thus it cannot be parameterized
    3Expression pack() is a void method call, and thus it cannot be parameterized
    4Expression ok.addActionListener(actionListener) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression ok.addActionListener(actionListener) is a void method call, and thus it cannot be parameterized
    6Expression pack() is a void method call, and thus it cannot be parameterized
    7Expression pack() is a void method call, and thus it cannot be parameterized
    8Expression setVisible(true) is a void method call, and thus it cannot be parameterized
    9Expression pack() is a void method call, and thus it cannot be parameterized
    10Expression setVisible(true) is a void method call, and thus it cannot be parameterized