设置JOptionPane.showMessageDialog show front

时间:2016-08-27 19:33:11

标签: java swing joptionpane

我有Joption但它显示在浏览器的后面

public class LoginInterceptor extends AbstractInterceptor {

private static final long serialVersionUID = 1L;
private static final Logger LOG = Logger.getLogger(LoginInterceptor.class);

@Override
public String intercept(ActionInvocation invocation) throws Exception {

    Map<String, Object> session = invocation.getInvocationContext().getSession();

    if (session != null && session.get("idUser") != null) {
        LOG.warn("session not expired");
        LOG.info("");
        return invocation.invoke();
    } else {
        LOG.warn("session expired");

        //this`s my joption dialog
        javax.swing.JOptionPane.showMessageDialog(null, "Session Expired");
        return "login";
    }
}
}

任何人都可以知道如何将它带到前面。谢谢你的帮助...

1 个答案:

答案 0 :(得分:0)

我添加了这个,现在解决了

        JFrame frame = new JFrame();            
        javax.swing.JOptionPane.showMessageDialog(frame,"Session Expired");