小编Ala*_*wan的帖子

如何在GUI上获取主板序列号(J​​ava)

我确实想在文本字段(GUI面板)中显示主板序列号。我创建了一个文本字段和操作按钮。我在操作按钮中编写了此代码。我在此代码中犯了什么错误?

try {
        Process p = Runtime.getRuntime().exec("wmic baseboard get serialnumber");
        BufferedReader inn = new BufferedReader(new InputStreamReader(p.getInputStream()));

        while (true) {

            String line = inn.readLine();
            if (line == null) {
                break;
            }
            motherboard.setText(line);
        }
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, "Sorry could not found motherboard serial!");
    }
Run Code Online (Sandbox Code Playgroud)

java user-interface motherboard

5
推荐指数
1
解决办法
6431
查看次数

标签 统计

java ×1

motherboard ×1

user-interface ×1