| | |
| | | private void initializeUI() { |
| | | setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
| | | |
| | | // 氝樓梓ワ統杅砐 |
| | | // 氝樓梓ワ統杅砐 |
| | | String[][] parameters = { |
| | | {"14.", "imu.idle.time"}, |
| | | {"1C.", "uwb.switch.status"}, |
| | |
| | | } |
| | | |
| | | private void addParameterField(JPanel panel, String address, String paramKey, int index) { |
| | | JPanel paramPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); // 党蜊潔擒峈5砉匼 |
| | | JPanel paramPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); // 党蜊潔擒峈5砉匼 |
| | | |
| | | labels[index] = new JLabel(address + " " + mainFrame.getString(paramKey)); |
| | | labels[index].setPreferredSize(new Dimension(140, 25)); |
| | |
| | | paramPanel.add(labels[index]); |
| | | paramPanel.add(textFields[index]); |
| | | |
| | | // 氝樓潔擒 |
| | | // 氝樓潔擒 |
| | | paramPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 35)); |
| | | panel.add(paramPanel); |
| | | } |
| | | |
| | | public void updateLanguage() { |
| | | // 載陔垀衄梓ワ腔恅掛 |
| | | // 載陔垀衄梓ワ腔恅掛 |
| | | String[][] parameters = { |
| | | {"14.", "imu.idle.time"}, |
| | | {"1C.", "uwb.switch.status"}, |
| | |
| | | repaint(); |
| | | } |
| | | |
| | | // 新增:获取文本框数组的方法 |
| | | // 新增:获取文本框数组的方法 |
| | | public JTextField[] getTextFields() { |
| | | return textFields; |
| | | } |
| | | /** |
| | | * 更新标签面板字段 |
| | | * 更新标签面板字段 |
| | | */ |
| | | public void updateFields(DellTag55AA03.ParseResult result) { |
| | | if (result == null) { |
| | |
| | | |
| | | |
| | | try { |
| | | // 根据参数顺序更新对应的文本框 |
| | | // 根据参数顺序更新对应的文本框 |
| | | if (textFields.length > 0 && result.dizhi0x14 != null) { |
| | | textFields[0].setText(String.valueOf(result.dizhi0x14)); // IMU静止时间 |
| | | textFields[0].setText(String.valueOf(result.dizhi0x14)); // IMU静止时间 |
| | | } |
| | | |
| | | if (textFields.length > 1 && result.dizhi0x1C != null) { |
| | | textFields[1].setText(String.valueOf(result.dizhi0x1C)); // UWB开关状态 |
| | | textFields[1].setText(String.valueOf(result.dizhi0x1C)); // UWB开关状态 |
| | | } |
| | | |
| | | if (textFields.length > 2 && result.dizhi0x20 != null) { |
| | | textFields[2].setText(String.valueOf(result.dizhi0x20)); // 振动时长 |
| | | textFields[2].setText(String.valueOf(result.dizhi0x20)); // 振动时长 |
| | | } |
| | | |
| | | if (textFields.length > 3 && result.dizhi0x38 != null) { |
| | | textFields[3].setText(String.valueOf(result.dizhi0x38)); // 加速度计阈值 |
| | | textFields[3].setText(String.valueOf(result.dizhi0x38)); // 加速度计阈值 |
| | | } |
| | | |
| | | if (textFields.length > 4 && result.dizhi0x3A != null) { |
| | | textFields[4].setText(String.valueOf(result.dizhi0x3A)); // 空闲休眠时间 |
| | | textFields[4].setText(String.valueOf(result.dizhi0x3A)); // 空闲休眠时间 |
| | | } |
| | | |
| | | if (textFields.length > 5 && result.dizhi0x3C != null) { |
| | | textFields[5].setText(String.valueOf(result.dizhi0x3C)); // 振动使能 |
| | | textFields[5].setText(String.valueOf(result.dizhi0x3C)); // 振动使能 |
| | | } |
| | | |
| | | if (textFields.length > 6 && result.dizhi0x3E != null) { |
| | | textFields[6].setText(String.valueOf(result.dizhi0x3E)); // 加速度计使能 |
| | | textFields[6].setText(String.valueOf(result.dizhi0x3E)); // 加速度计使能 |
| | | } |
| | | |
| | | if (textFields.length > 7 && result.dizhi0x40 != null) { |
| | | textFields[7].setText(String.valueOf(result.dizhi0x40)); // 标签配置状态 |
| | | textFields[7].setText(String.valueOf(result.dizhi0x40)); // 标签配置状态 |
| | | } |
| | | |
| | | if (textFields.length > 8 && result.dizhi0x42 != null) { |
| | | textFields[8].setText(String.valueOf(result.dizhi0x42)); // 加速度计时长 |
| | | textFields[8].setText(String.valueOf(result.dizhi0x42)); // 加速度计时长 |
| | | } |
| | | |
| | | if (textFields.length > 9 && result.dizhi0x44 != null) { |
| | | textFields[9].setText(result.dizhi0x44); // 设备激活状态 |
| | | textFields[9].setText(result.dizhi0x44); // 设备激活状态 |
| | | } |
| | | |
| | | if (textFields.length > 10 && result.dizhi0x48 != null) { |
| | | textFields[10].setText(String.valueOf(result.dizhi0x48)); // 速度滤波限值 |
| | | textFields[10].setText(String.valueOf(result.dizhi0x48)); // 速度滤波限值 |
| | | } |
| | | |
| | | if (textFields.length > 11 ) { |
| | | textFields[11].setText(String.valueOf(result.dizhi0x50)); // 压力校准 |
| | | textFields[11].setText(String.valueOf(result.dizhi0x50)); // 压力校准 |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | // 重新验证和重绘面板 |
| | | // 重新验证和重绘面板 |
| | | revalidate(); |
| | | repaint(); |
| | | } |
| | | public String getdizhi0x14() { |
| | | return textFields.length > 0 ? textFields[0].getText() : ""; |
| | | }//IMU静止时间 |
| | | }//IMU静止时间 |
| | | |
| | | public String getdizhi0x1C() { |
| | | return textFields.length > 1 ? textFields[1].getText() : ""; |
| | | }//UWB开关状态 |
| | | }//UWB开关状态 |
| | | |
| | | public String getdizhi0x20() { |
| | | return textFields.length > 2 ? textFields[2].getText() : ""; |
| | | }//振动时长 |
| | | }//振动时长 |
| | | |
| | | public String getdizhi0x38() { |
| | | return textFields.length > 3 ? textFields[3].getText() : ""; |
| | | }//加速度计阈值 |
| | | }//加速度计阈值 |
| | | |
| | | public String getdizhi0x3A() { |
| | | return textFields.length > 4 ? textFields[4].getText() : ""; |
| | | }//空闲休眠时间 |
| | | }//空闲休眠时间 |
| | | |
| | | public String getdizhi0x3C() { |
| | | return textFields.length > 5 ? textFields[5].getText() : ""; |
| | | }//振动使能 |
| | | }//振动使能 |
| | | |
| | | public String getdizhi0x3E() { |
| | | return textFields.length > 6 ? textFields[6].getText() : ""; |
| | | }//加速度计使能 |
| | | }//加速度计使能 |
| | | |
| | | public String getdizhi0x40() { |
| | | return textFields.length > 7 ? textFields[7].getText() : ""; |
| | | }//标签配置状态 |
| | | }//标签配置状态 |
| | | |
| | | public String getdizhi0x42() { |
| | | return textFields.length > 8 ? textFields[8].getText() : ""; |
| | | }//加速度计时长 |
| | | }//加速度计时长 |
| | | |
| | | public String getdizhi0x44() { |
| | | return textFields.length > 9 ? textFields[9].getText() : ""; |
| | | }//设备激活状态 |
| | | }//设备激活状态 |
| | | |
| | | public String getdizhi0x48() { |
| | | return textFields.length > 10 ? textFields[10].getText() : ""; |
| | | }//速度滤波限值 |
| | | }//速度滤波限值 |
| | | |
| | | public String getdizhi0x50() { |
| | | return textFields.length > 11 ? textFields[11].getText() : ""; |
| | | }//压力校准 |
| | | }//压力校准 |
| | | } |