// Tries to connect without opening a dialog public static boolean tryConnect(Frame parent, RpcConnection rpcConn) { DbConnectDialog cd = new DbConnectDialog(parent, rpcConn, true); try { return cd.tryConnect(); } catch (MsfException mex) { // on error connecting, show dialog } return false; }
// Opens dialog to get options public static boolean connect(Frame parent, RpcConnection rpcConn) { DbConnectDialog cd = new DbConnectDialog(parent, rpcConn, true); try { if (cd.tryConnect()) return true; } catch (MsfException mex) { // on error connecting, show dialog } cd.setVisible(true); return cd.success; }