private void threatUIlogInfo(Threat threat) { String threatText = LogWindow.txtPane_threatsTab.getText(); final StringBuilder bldStr2 = new StringBuilder(); if (threatText.isEmpty()) { bldStr2 .append("Threat ") .append(threat.getIndex()) .append(" received by Attacker ") .append(attacker.getIndex()) .append(" [") .append(DmCommons.getOneM2mTimeStamp()) .append("]") .append("\n"); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { LogWindow.txtPane_threatsTab.setText(bldStr2.toString()); } }); } else { bldStr2.append(threatText).append("\n"); bldStr2 .append("Threat ") .append(threat.getIndex()) .append(" received by Attacker ") .append(attacker.getIndex()) .append(" [") .append(DmCommons.getOneM2mTimeStamp()) .append("]") .append("\n"); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { LogWindow.txtPane_threatsTab.setText(bldStr2.toString()); } }); } LogWindow.jTabbedPane1.setSelectedIndex(0); }
private void obstacleUIlogInfo(Obstacle obstacle) { String text = LogWindow.txtPane_obstablesTab.getText(); final StringBuilder bldStr = new StringBuilder(); if (text.isEmpty()) { bldStr .append("Obstacle ") .append(obstacle.getIndex()) .append(" received by Attacker ") .append(attacker.getIndex()) .append(" [") .append(DmCommons.getOneM2mTimeStamp()) .append("]") .append("\n"); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { LogWindow.txtPane_obstablesTab.setText(bldStr.toString()); } }); } else { bldStr.append(text).append("\n"); bldStr .append("Obstacle ") .append(obstacle.getIndex()) .append(" received by Attacker ") .append(attacker.getIndex()) .append(" [") .append(DmCommons.getOneM2mTimeStamp()) .append("]") .append("\n"); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { LogWindow.txtPane_obstablesTab.setText(bldStr.toString()); } }); } LogWindow.jTabbedPane1.setSelectedIndex(1); }