JPopupTextPane.java

1
/*******************************************************************************
2
 * Copyhacked (H) 2012-2025.
3
 * This program and the accompanying materials
4
 * are made available under no term at all, use it like
5
 * you want, but share and discuss it
6
 * every time possible with every body.
7
 *
8
 * Contributors:
9
 *      ron190 at ymail dot com - initial implementation
10
 *******************************************************************************/
11
package com.jsql.view.swing.text;
12
13
import javax.swing.*;
14
import java.awt.*;
15
import java.awt.event.FocusAdapter;
16
import java.awt.event.FocusEvent;
17
18
/**
19
 * A JTextArea decorated with popup menu and border.
20
 */
21
public class JPopupTextPane extends JPopupTextComponent<JTextPane> implements DecoratorJComponent<JTextPane> {
22
    
23
    /**
24
     * Build new instance of JTextField to decorate.
25
     */
26
    public JPopupTextPane(String placeholder) {
27
        this(new JTextPanePlaceholderConsole(placeholder) {
28
            @Override
29
            public boolean isEditable() {
30 1 1. isEditable : replaced boolean return with true for com/jsql/view/swing/text/JPopupTextPane$1::isEditable → NO_COVERAGE
                return false;
31
            }
32
        });
33
    }
34
35
    /**
36
     * Build new instance of JTextArea to decorate.
37
     */
38
    public JPopupTextPane(JTextPane proxy) {
39
        super(proxy);
40
41 1 1. <init> : removed call to javax/swing/JTextPane::addFocusListener → NO_COVERAGE
        this.getProxy().addFocusListener(new FocusAdapter() {
42
            @Override
43
            public void focusGained(FocusEvent focusEvent) {
44 1 1. focusGained : removed call to javax/swing/text/Caret::setVisible → NO_COVERAGE
                JPopupTextPane.this.getProxy().getCaret().setVisible(true);
45 1 1. focusGained : removed call to javax/swing/text/Caret::setSelectionVisible → NO_COVERAGE
                JPopupTextPane.this.getProxy().getCaret().setSelectionVisible(true);
46
            }
47
        });
48 1 1. <init> : removed call to javax/swing/JTextPane::setBorder → NO_COVERAGE
        this.getProxy().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
49 1 1. <init> : removed call to javax/swing/JTextPane::setCursor → NO_COVERAGE
        this.getProxy().setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
50
    }
51
}

Mutations

30

1.1
Location : isEditable
Killed by : none
replaced boolean return with true for com/jsql/view/swing/text/JPopupTextPane$1::isEditable → NO_COVERAGE

41

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JTextPane::addFocusListener → NO_COVERAGE

44

1.1
Location : focusGained
Killed by : none
removed call to javax/swing/text/Caret::setVisible → NO_COVERAGE

45

1.1
Location : focusGained
Killed by : none
removed call to javax/swing/text/Caret::setSelectionVisible → NO_COVERAGE

48

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JTextPane::setBorder → NO_COVERAGE

49

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JTextPane::setCursor → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.18.2