• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jiangxincode / ApkToolBoxGUI / #1161

06 Sep 2025 01:12AM UTC coverage: 2.956% (-0.03%) from 2.985%
#1161

push

jiangxincode
Merge branch 'master' of https://github.com/jiangxincode/ApkToolBoxGUI

248 of 8389 relevant lines covered (2.96%)

0.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/edu/jiangxin/apktoolbox/swing/extend/EasyFrame.java
1
package edu.jiangxin.apktoolbox.swing.extend;
2

3
import java.awt.*;
4
import java.awt.event.WindowAdapter;
5
import java.awt.event.WindowEvent;
6
import java.util.ResourceBundle;
7

8
import javax.swing.JFrame;
9

10
import org.apache.commons.configuration2.Configuration;
11
import org.apache.logging.log4j.LogManager;
12
import org.apache.logging.log4j.Logger;
13

14
import edu.jiangxin.apktoolbox.utils.Utils;
15

16
/**
17
 * @author jiangxin
18
 * @author 2018-09-09
19
 *
20
 */
21
public class EasyFrame extends JFrame {
22
    private static final long serialVersionUID = 1L;
23
    protected Logger logger;
24
    protected Configuration conf;
25
    protected ResourceBundle bundle;
26
    protected Image image;
27

28
    public EasyFrame() throws HeadlessException {
29
        super();
×
30
        logger = LogManager.getLogger(this.getClass().getSimpleName());
×
31
        conf = Utils.getConfiguration();
×
32
        bundle = ResourceBundle.getBundle("apktoolbox");
×
33
        addWindowListener(new WindowAdapter() {
×
34
            @Override
35
            public void windowClosing(WindowEvent e) {
36
                super.windowClosing(e);
×
37
                onWindowClosing(e);
×
38
                Utils.saveConfiguration();
×
39
                logger.info("windowClosing: " + EasyFrame.this.getClass().getSimpleName());
×
40
            }
×
41
            @Override
42
            public void windowIconified(WindowEvent e) {
43
                super.windowIconified(e);
×
44
                onWindowIconified(e);
×
45
                setVisible(false);
×
46
                dispose();
×
47
                Utils.saveConfiguration();
×
48
                logger.info("windowIconified: " + EasyFrame.this.getClass().getSimpleName());
×
49
            }
×
50
        });
51
        Toolkit tk = Toolkit.getDefaultToolkit();
×
52
        image = tk.createImage(this.getClass().getResource("/icon.jpg"));
×
53
        setIconImage(image);
×
54
        logger.info("Frame start: " + this.getClass().getSimpleName());
×
55
    }
×
56

57
    public void refreshSizeAndLocation() {
58
        // use pack to resize the child component
59
        pack();
×
60
        setMinimumSize(new Dimension(800, 100));
×
61
        setResizable(false);
×
62

63
        // relocation this JFrame
64
        int windowWidth = getWidth();
×
65
        int windowHeight = getHeight();
×
66
        Toolkit kit = Toolkit.getDefaultToolkit();
×
67
        if (kit == null) {
×
68
            logger.error("kit is null");
×
69
            return;
×
70
        }
71
        Dimension screenSize = kit.getScreenSize();
×
72
        if (screenSize == null) {
×
73
            logger.error("screenSize is null");
×
74
            return;
×
75
        }
76
        int screenWidth = screenSize.width;
×
77
        int screenHeight = screenSize.height;
×
78
        setLocation(screenWidth / 2 - windowWidth / 2, screenHeight / 2 - windowHeight / 2);
×
79
    }
×
80

81
    protected void onWindowClosing(WindowEvent e) {}
×
82

83
    protected void onWindowIconified(WindowEvent e) {}
×
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc