public void actionPerformed(ActionEvent e) { String defaultHost = Parameters.getParameter("telnet.defaultHost", "localhost"); String hostname = JOptionPane.showInputDialog(Edit.getFrame(), "Hostname:", defaultHost); if (hostname != null) { Edit.openFile("telnet://" + hostname); } }
public void actionPerformed(ActionEvent e) { ETextArea target = (ETextArea) getFocusedComponent(); try { Document document = target.getDocument(); int position = target.getCaretPosition(); String whitespace = target.getIndentationOfLineAtOffset(position); String prefix = "{\n" + whitespace + Parameters.getParameter("indent.string"); String suffix = "\n" + whitespace + "}"; document.insertString(position, prefix + suffix, null); target.setCaretPosition(position + prefix.length()); } catch (BadLocationException ex) { ex.printStackTrace(); } }