private void showOperation(OperationItemId id, OperationInfo op) { final OperationItemId finalId = id; final OperationInfo finalInfo = op; // check if the panel was already added i.e. some input was being entered // check if that input is saved or not if (TableUtil.checkIfExists(rightPanel, addOperationPanel)) { checkNewOperationSave(addOperationPanel); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { rightPanel.remove(addOperationPanel); rightPanel.add(displayDataPanel); } }); } else if (TableUtil.checkIfExists(rightPanel, displayDataPanel)) { checkDisplayOperationSave(displayDataPanel); } else { rightPanel.add(displayDataPanel); } SwingUtilities.invokeLater( new Runnable() { @Override public void run() { displayDataPanel.populate(finalId, finalInfo); rightPanel.revalidate(); rightPanel.repaint(); } }); }
private void addOperation() { if (TableUtil.checkIfExists(rightPanel, displayDataPanel)) { rightPanel.remove(displayDataPanel); checkDisplayOperationSave(displayDataPanel); } rightPanel.add(addOperationPanel); rightPanel.revalidate(); rightPanel.repaint(); }