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

jiangxincode / ApkToolBoxGUI / #733

19 May 2024 01:15PM UTC coverage: 3.151% (-0.001%) from 3.152%
#733

push

jiangxincode
merge some menu to settings menu

0 of 128 new or added lines in 11 files covered. (0.0%)

5 existing lines in 5 files now uncovered.

236 of 7490 relevant lines covered (3.15%)

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/help/settings/DependencyPathPanel.java
1
package edu.jiangxin.apktoolbox.help.settings;
2

3
import edu.jiangxin.apktoolbox.swing.extend.EasyChildTabbedPanel;
4
import edu.jiangxin.apktoolbox.utils.Constants;
5

6
import javax.swing.*;
7
import java.awt.*;
8
import java.io.File;
9
import java.io.IOException;
10
import java.net.URI;
11
import java.net.URISyntaxException;
12

NEW
13
public class DependencyPathPanel extends EasyChildTabbedPanel {
×
14

15
    private static final long serialVersionUID = 1L;
16

17
    @Override
18
    public void createUI() {
NEW
19
        BoxLayout boxLayout = new BoxLayout(this, BoxLayout.Y_AXIS);
×
NEW
20
        setLayout(boxLayout);
×
21

NEW
22
        createPathPanel(this, "Path of 7ZIP(e.g.\"C:/Program Files/7-Zip/7z.exe\")", "https://www.7-zip.org/", Constants.SEVEN_ZIP_PATH_KEY);
×
NEW
23
        add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
×
24

NEW
25
        createPathPanel(this, "Path of RAR(e.g.\"C:/Program Files/WinRAR/Rar.exe\")", "https://www.win-rar.com/", Constants.RAR_PATH_KEY);
×
NEW
26
        add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
×
27

NEW
28
        createPathPanel(this, "Path of RAR(e.g.\"C:/Program Files/WinRAR/WinRAR.exe\")", "https://www.win-rar.com/", Constants.WIN_RAR_PATH_KEY);
×
NEW
29
    }
×
30

31
    private void createPathPanel(JPanel panel, String label, String website, String confKey) {
NEW
32
        JPanel pathPanel = new JPanel();
×
NEW
33
        pathPanel.setLayout(new BoxLayout(pathPanel, BoxLayout.Y_AXIS));
×
NEW
34
        panel.add(pathPanel);
×
35

NEW
36
        JPanel firstLinePanel = new JPanel();
×
NEW
37
        firstLinePanel.setLayout(new BoxLayout(firstLinePanel, BoxLayout.X_AXIS));
×
38

NEW
39
        JLabel pathLabel = new JLabel(label);
×
40

NEW
41
        JButton visitWebsiteButton = new JButton(bundle.getString("download.button"));
×
42

NEW
43
        firstLinePanel.add(pathLabel);
×
NEW
44
        firstLinePanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
×
NEW
45
        firstLinePanel.add(visitWebsiteButton);
×
NEW
46
        firstLinePanel.add(Box.createHorizontalGlue());
×
47

NEW
48
        JPanel secondLinePanel = new JPanel();
×
NEW
49
        secondLinePanel.setLayout(new BoxLayout(secondLinePanel, BoxLayout.X_AXIS));
×
50

NEW
51
        JTextField pathTextField = new JTextField();
×
NEW
52
        pathTextField.setText(conf.getString(confKey));
×
53

NEW
54
        JButton pathButton = new JButton(bundle.getString("choose.file.button"));
×
55

NEW
56
        secondLinePanel.add(pathTextField);
×
NEW
57
        secondLinePanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
×
NEW
58
        secondLinePanel.add(pathButton);
×
59

NEW
60
        pathPanel.add(firstLinePanel);
×
NEW
61
        pathPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
×
NEW
62
        pathPanel.add(secondLinePanel);
×
63

64

NEW
65
        visitWebsiteButton.addActionListener(e -> {
×
66
            URI uri;
67
            try {
NEW
68
                uri = new URI(website);
×
NEW
69
                Desktop.getDesktop().browse(uri);
×
NEW
70
            } catch (URISyntaxException ex) {
×
NEW
71
                logger.error("URISyntaxException", ex);
×
NEW
72
            } catch (IOException ex) {
×
NEW
73
                logger.error("IOException", ex);
×
NEW
74
            }
×
NEW
75
        });
×
76

NEW
77
        pathButton.addActionListener(e -> {
×
NEW
78
            JFileChooser jfc = new JFileChooser();
×
NEW
79
            jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
×
NEW
80
            jfc.setDialogTitle("select a file");
×
NEW
81
            int ret = jfc.showDialog(new JLabel(), null);
×
NEW
82
            switch (ret) {
×
83
                case JFileChooser.APPROVE_OPTION:
NEW
84
                    File file = jfc.getSelectedFile();
×
NEW
85
                    pathTextField.setText(file.getAbsolutePath());
×
NEW
86
                    conf.setProperty(confKey, pathTextField.getText());
×
NEW
87
                    break;
×
88
                default:
89
                    break;
90
            }
NEW
91
        });
×
NEW
92
    }
×
93
}
94

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