296
297 super.revalidate();
298 }
299
300 private void createActions() {
301 connectAction = new AbstractAction(Messages.CONNECT) {
302 /* init */ {
303 putValue(Action.MNEMONIC_KEY, Resources.getMnemonicInt(Messages.CONNECT));
304 }
305
306 public void actionPerformed(ActionEvent ev) {
307 if (!isEnabled() || !isVisible()) {
308 return;
309 }
310 setVisible(false);
311 statusBar.setText("");
312
313 if (remoteRadioButton.isSelected()) {
314 String txt = remoteTF.getText().trim();
315 String userName = userNameTF.getText().trim();
316 userName = userName.equals("") ? null : userName;
317 String password = passwordTF.getText();
318 password = password.equals("") ? null : password;
319 try {
320 if (txt.startsWith(JConsole.ROOT_URL)) {
321 String url = txt;
322 jConsole.addUrl(url, userName, password, false);
323 remoteTF.setText(JConsole.ROOT_URL);
324 return;
325 } else {
326 String host = remoteTF.getText().trim();
327 String port = "0";
328 int index = host.lastIndexOf(':');
329 if (index >= 0) {
330 port = host.substring(index + 1);
331 host = host.substring(0, index);
332 }
333 if (host.length() > 0 && port.length() > 0) {
334 int p = Integer.parseInt(port.trim());
335 jConsole.addHost(host, p, userName, password);
336 remoteTF.setText("");
337 userNameTF.setText("");
338 passwordTF.setText("");
|
296
297 super.revalidate();
298 }
299
300 private void createActions() {
301 connectAction = new AbstractAction(Messages.CONNECT) {
302 /* init */ {
303 putValue(Action.MNEMONIC_KEY, Resources.getMnemonicInt(Messages.CONNECT));
304 }
305
306 public void actionPerformed(ActionEvent ev) {
307 if (!isEnabled() || !isVisible()) {
308 return;
309 }
310 setVisible(false);
311 statusBar.setText("");
312
313 if (remoteRadioButton.isSelected()) {
314 String txt = remoteTF.getText().trim();
315 String userName = userNameTF.getText().trim();
316 userName = userName.isEmpty() ? null : userName;
317 String password = passwordTF.getText();
318 password = password.isEmpty() ? null : password;
319 try {
320 if (txt.startsWith(JConsole.ROOT_URL)) {
321 String url = txt;
322 jConsole.addUrl(url, userName, password, false);
323 remoteTF.setText(JConsole.ROOT_URL);
324 return;
325 } else {
326 String host = remoteTF.getText().trim();
327 String port = "0";
328 int index = host.lastIndexOf(':');
329 if (index >= 0) {
330 port = host.substring(index + 1);
331 host = host.substring(0, index);
332 }
333 if (host.length() > 0 && port.length() > 0) {
334 int p = Integer.parseInt(port.trim());
335 jConsole.addHost(host, p, userName, password);
336 remoteTF.setText("");
337 userNameTF.setText("");
338 passwordTF.setText("");
|