private boolean loadGraphFile(File graphFile) { Properties properties = new Properties(); try { InputStream inputStream = new FileInputStream(graphFile); properties.load(inputStream); inputStream.close(); for (int i = 0; i < 4; i++) { Param.GraphEnb[i] = Boolean.valueOf(properties.getProperty("GraphEnb" + String.valueOf(i))); Param.GraphAxisText[i] = properties.getProperty("GraphAxisText" + String.valueOf(i)); Param.LineNum[i] = Integer.parseInt(properties.getProperty("LineNum" + String.valueOf(i))); } Param.GraphTitle = properties.getProperty("GraphTitle"); Param.comBaud = Integer.parseInt(properties.getProperty("comBaud")); Param.comPort = properties.getProperty("comPort"); if (Param.Subghz_Tab_Enb == true) { SettingFrame.setSelectedIndex(Integer.parseInt(properties.getProperty("selectedTab"))); } Param.subghzBaud = Integer.parseInt(properties.getProperty("subghzBaud")); Param.subghzStrTxaddr = properties.getProperty("subghzStrTxaddr"); Param.subghzPwr = Integer.parseInt(properties.getProperty("subghzPwr")); Param.subghzPanid = properties.getProperty("subghzPanid"); Param.subghzChannel = Integer.parseInt(properties.getProperty("subghzChannel")); graphSetting.setParam(); tabCom.setParam(); tabSubGHz.setParam(); } catch (Exception ex) { System.out.println(ex.getMessage()); } return true; }
private void GraphOpen() { graphStart.setEnabled(false); graphSetting.getParam(); tabCom.getParam(); Param.selectedTabIndex = SettingFrame.getSelectedIndex(); if (Param.selectedTabIndex == 0) { } else if ((Param.selectedTabIndex == 1) && (tabSubGHz.getParam(true) == true)) { } else { graphStart.setEnabled(true); return; } chart = new ComChart(graphStart); chart.pack(); RefineryUtilities.centerFrameOnScreen(chart); chart.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); chart.setVisible(true); chart.addWindowListener( new WindowAdapter() { public void windowClosing() { LazuriteGraph.GraphClose(); } }); }
private boolean writeGraphFile(File graphFile) { graphSetting.getParam(); tabCom.getParam(); tabSubGHz.getParam(); Properties properties = new Properties(); properties.setProperty("selectedTab", String.valueOf(SettingFrame.getSelectedIndex())); for (int i = 0; i < 4; i++) { properties.setProperty("GraphEnb" + String.valueOf(i), Boolean.toString(Param.GraphEnb[i])); properties.setProperty("GraphAxisText" + String.valueOf(i), Param.GraphAxisText[i]); properties.setProperty("LineNum" + String.valueOf(i), Integer.toString(Param.LineNum[i])); } properties.setProperty("GraphTitle", Param.GraphTitle); properties.setProperty("comBaud", Integer.toString(Param.comBaud)); if (Param.comPort == null) { Param.comPort = ""; } properties.setProperty("comPort", Param.comPort); properties.setProperty("subghzBaud", Integer.toString(Param.subghzBaud)); properties.setProperty("subghzStrTxaddr", Param.subghzStrTxaddr); properties.setProperty("subghzPwr", Integer.toString(Param.subghzPwr)); properties.setProperty("subghzPanid", Param.subghzPanid); properties.setProperty("subghzChannel", Integer.toString(Param.subghzChannel)); try { FileOutputStream outputStream = new FileOutputStream(graphFile); properties.store(outputStream, "store test"); // 書き込み outputStream.close(); } catch (Exception ex) { System.out.println(ex.getMessage()); } return true; }
// reset panel private void FileNew() { initParam(); graphSetting.setParam(); tabCom.setParam(); tabSubGHz.setParam(); }