如何将两个或多个确认对话框合并到一个确认对话框中?

How do I combine two or more confirmation dialog in a single confirmation dialog?

谁能帮我解决这个问题。

这里我查看了Issuance with Premium的标志,写了确认对话框

这里我查看了claimhandling with premium的标志,并写了确认对话框

需要:我在一个确认对话框中需要两者,而不是像上面图片中提到的那样分开。

这是我的代码:

if(issuance !=null && prem.compareTo(totalzero) == 1 && issuance.compareTo(totalzero) == -1) {
   ConfirmationDialog.showConfirmationDialog(this,
       "the value of issuance has a different sign to the sign of premium");
}
if(claimhandling !=null && prem.compareTo(totalzero) == 1 && claimhandling.compareTo(totalzero) == -1) { 
   ConfirmationDialog.showConfirmDialog(this,
       "the value of claimhandling has a different sign to the sign of premium");
}

如果 "if" 两个条件都为真,那么我需要将两个确认对话框合并为一个对话框。

只需连接消息并确保它们显示为两行。 我不知道您的 ConfirmationDialog 实际使用的是哪种 Swing 组件,但大多数 Swing 文本组件只支持 HTML 标签进行格式化,因此下面的示例使用 <br> 来创建新行。

String message = "";
if (issuance !=null && prem.compareTo(totalzero) == 1 && issuance.compareTo(totalzero) == -1) {
  message = "the value of issuance has a different sign to the sign of premium";
}

if (claimhandling != null && prem.compareTo(totalzero) == 1 && claimhandling.compareTo(totalzero) == -1) { 
  if (message.length() > 0) {
    message += "<br>";
  }
  message += "the value of claimhandling has a different sign to the sign of premium";
}

if (message.length() > 0) {
  ConfirmationDialog.showConfirmationDialog(this, "<html>" + message+ "</html>");
}