public void search() { hilit.removeAllHighlights(); String s = entry.getText(); if (s.length() <= 0) { message("Nothing to search"); return; } String content = textArea.getText(); int index = content.indexOf(s, 0); if (index >= 0) { try { int end = index + s.length(); hilit.addHighlight(index, end, painter); textArea.setCaretPosition(end); entry.setBackground(entryBg); message("'" + s + "' found. Press ESC to end search"); } catch (BadLocationException e) { e.printStackTrace(); } } else { entry.setBackground(ERROR_COLOR); message("'" + s + "' found. Press ESC to start a new search"); } }
public void actionPerformed(ActionEvent e) { // Handle open button action. if (e.getSource() == openButton) { int returnVal = fc.showOpenDialog(FileChooserDemo.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); // This is where a real application would open the file. log.append("Opening: " + file.getName() + "." + newline); } else { log.append("Open command cancelled by user." + newline); } log.setCaretPosition(log.getDocument().getLength()); // Handle save button action. } else if (e.getSource() == saveButton) { int returnVal = fc.showSaveDialog(FileChooserDemo.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); // This is where a real application would save the file. log.append("Saving: " + file.getName() + "." + newline); } else { log.append("Save command cancelled by user." + newline); } log.setCaretPosition(log.getDocument().getLength()); } }
/** The listener method. */ public void actionPerformed(ActionEvent event) { Object source = event.getSource(); if (source == b1) // click button { try { String message = tf.getText(); server.sendPrivateMessage(parent, selfIdentity, message); ta.append("<" + parent.getUserName() + ">: " + message + lineSeparator); ta.setCaretPosition(ta.getText().length()); tf.setText(""); } catch (RemoteException ex) { System.out.print("Exception encountered while sending" + " private message."); } } if (source == tf) // press return { try { String message = tf.getText(); server.sendPrivateMessage(parent, selfIdentity, message); ta.append("<" + parent.getUserName() + ">: " + message + lineSeparator); ta.setCaretPosition(ta.getText().length()); tf.setText(""); } catch (RemoteException ex) { System.out.print("Exception encountered while sending" + " private message."); } } if (source == jMenuItem3) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Choose or create a new file to store the conversation"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setDoubleBuffered(true); fileChooser.showOpenDialog(this); File file = fileChooser.getSelectedFile(); try { if (file != null) { Writer writer = new BufferedWriter(new FileWriter(file)); writer.write(ta.getText()); writer.flush(); writer.close(); } } catch (IOException ex) { System.out.println("Can't write to file. " + ex); } } if (source == jMenuItem4) { selfRemove(); this.dispose(); } }
static void log(String message) { if (resetFlag){ logArea.setText(""); miniLogArea.setText(""); } resetFlag = (message.length() == 0); logArea.append(message + "\n"); miniLogArea.append(message + "\n"); logArea.setCaretPosition(logArea.getDocument().getLength()); miniLogArea.setCaretPosition(miniLogArea.getDocument().getLength()); }
public synchronized void run() { byte[] buffer = new byte[BUFFER_SIZE]; for (; ; ) { try { this.wait(100); } catch (InterruptedException ie) { } int len = 0; try { int noBytes = pin.available(); if (noBytes > 0) { len = pin.read(buffer, 0, Math.min(noBytes, BUFFER_SIZE)); if (len > 0) { jTextArea.append(new String(buffer, 0, len)); jTextArea.setCaretPosition(jTextArea.getText().length()); } } } catch (IOException ioe) { throw new UIError("Unable to read from input stream! " + ioe.getMessage()); } } }
@Override public synchronized void write(byte[] ba, int str, int len) { try { curLength += len; if (bytesEndWith(ba, str, len, LINE_SEP)) { lineLengths.addLast(new Integer(curLength)); curLength = 0; if (lineLengths.size() > maxLines) { textArea.replaceRange(null, 0, lineLengths.removeFirst().intValue()); } } for (int xa = 0; xa < 10; xa++) { try { textArea.append(new String(ba, str, len)); break; } catch ( Throwable thr) { // sometimes throws a java.lang.Error: Interrupted attempt to aquire write // lock if (xa == 9) { thr.printStackTrace(); } } } textArea.setCaretPosition(textArea.getText().length()); } catch (Throwable thr) { CharArrayWriter caw = new CharArrayWriter(); thr.printStackTrace(new PrintWriter(caw, true)); textArea.append(System.getProperty("line.separator", "\n")); textArea.append(caw.toString()); } }
public void valueChanged(ListSelectionEvent event) { if (table.getSelectedRow() == -1) textArea.setText(null); else { TableItem item = table.getTableItemAt(table.getSelectedRow()); textArea.setText(item.toString()); } textArea.setCaretPosition(0); }
/** * Add a line of text to the transcript area. * * @param message text to be added; two line feeds is added at the end. */ private void postMessage(String message) { transcript.append(message + "\n\n"); // The following line is a nasty kludge that was the only way I could find to force // the transcript to scroll so that the text that was just added is visible in // the window. Without this, text can be added below the bottom of the visible area // of the transcript. transcript.setCaretPosition(transcript.getDocument().getLength()); }
public void actionPerformed(ActionEvent evt) { String text = textField.getText(); textArea.append(text + newline); textField.selectAll(); // Make sure the new text is visible, even if there // was a selection in the text area. textArea.setCaretPosition(textArea.getDocument().getLength()); }
public LicenseDialog(Component parent) { setTitle("Licensing information"); pnlButtons.add(bttnOk); cbLang.addItem("English"); cbLang.addItem("Eesti"); FlowLayout fl = new FlowLayout(); fl.setAlignment(FlowLayout.LEFT); pnlHeader.setLayout(fl); pnlHeader.add(lblLang); pnlHeader.add(cbLang); pnlMain.setLayout(new BorderLayout()); pnlMain.add(pnlHeader, BorderLayout.NORTH); pnlMain.add(scrollPane, BorderLayout.CENTER); pnlMain.add(pnlButtons, BorderLayout.SOUTH); taLicenseText.setText(getLicenseText()); taLicenseText.setCaretPosition(0); taLicenseText.setLineWrap(true); taLicenseText.setEditable(false); taLicenseText.setWrapStyleWord(true); getContentPane().add(pnlMain); setPreferredSize(new Dimension(500, 600)); setLocationRelativeTo(parent); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); bttnOk.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { if (evt.getSource() == bttnOk) { dispose(); } } // end actionPerformed }); // end bttnOk Action Listener cbLang.addItemListener( new ItemListener() { public void itemStateChanged(final ItemEvent event) { if (event.getSource() == cbLang && event.getStateChange() == ItemEvent.SELECTED && cbLang.getItemCount() > 0) { taLicenseText.setText(getLicenseText()); taLicenseText.setCaretPosition(0); } } }); // end cbLang item listener pack(); setVisible(true); } // PortPropertiesDialog
/** * Updates all of the components in the panel to match that of the associated Artifact. * * @see #ArtifactView(Artifact, DataProvider) */ public void rebuild() { title.setText(SHTML + TITLE + elem.title + EHTML); donor.setText(SHTML + DONOR + elem.donor + EHTML); subDate.setText(SHTML + SUB_DATE + elem.subDate.toString() + EHTML); objDate.setText(SHTML + OBJ_DATE + elem.objDate.toString() + EHTML); medium.setText(SHTML + MEDIUM + elem.medium + EHTML); accNum.setText(SHTML + ACC_NUM + elem.accNum + EHTML); descView.setText(elem.desc); descView.setCaretPosition(0); validate(); }
private void breakpointHit(char pc) { registersModel.fireUpdate(); memoryModel.fireUpdate(0, RAM_SIZE - 1); // TODO optimize Integer srcline = asmMap.bin2src(pc); if (srcline != null) { try { sourceTextarea.requestFocus(); sourceTextarea.setCaretPosition(sourceTextarea.getLineStartOffset(srcline - 1)); } catch (BadLocationException e) { e.printStackTrace(); } } }
public static void goToLineColumm(JTextArea component, int line, int column) { Element root = component.getDocument().getDefaultRootElement(); int offset = 0; int lineStart; if (line < component.getLineCount()) { lineStart = root.getElement(line - 1).getStartOffset(); offset = lineStart + (column - 1); } else { // in case we're asking to jump to a line that doesn't exist lineStart = root.getElement(component.getLineCount() - 1).getStartOffset(); offset = lineStart; } component.setCaretPosition(offset); }
private void showHelp(String help[]) { txtCommand.setText(help[0]); bHelp = true; pResult.removeAll(); pResult.add(txtResultScroll, BorderLayout.CENTER); pResult.doLayout(); txtResult.setText(help[1]); pResult.repaint(); txtCommand.requestFocus(); txtCommand.setCaretPosition(help[0].length()); }
/** * Post a message to the assembler display * * @param message String to append to assembler display text */ public void postMarsMessage(String message) { assemble.append(message); // can do some crude cutting here. If the document gets "very large", // let's cut off the oldest text. This will limit scrolling but the limit // can be set reasonably high. if (assemble.getDocument().getLength() > MAXIMUM_SCROLLED_CHARACTERS) { try { assemble.getDocument().remove(0, NUMBER_OF_CHARACTERS_TO_CUT); } catch (BadLocationException ble) { // only if NUMBER_OF_CHARACTERS_TO_CUT > MAXIMUM_SCROLLED_CHARACTERS } } assemble.setCaretPosition(assemble.getDocument().getLength()); setSelectedComponent(assembleTab); }
/** * Appends each string in the new_strings parameter as a new line in the text area. Sets the caret * is set to the beginning of the text. * * @param new_strings The strings to add. Each entry is added to a new line. This method performs * no action if this parameter is empty or null. */ public void appendStrings(String[] new_strings) { if (new_strings != null) if (new_strings.length != 0) { // Append the text for (int i = 0; i < new_strings.length; i++) { if (i == 0) { if (!text_area.getText().equals("")) text_area.append("\n"); } else text_area.append("\n"); text_area.append(new_strings[i]); } // Reset the caret position text_area.setCaretPosition(0); } }
public void actionPerformed(ActionEvent e) { // Handle open button action. if (e.getSource() == openButton) { int returnVal = fc.showOpenDialog(DirectorySize.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); // This is where a real application would open the file. ListSubDirectorySizes(file); } else { log.append("Open command cancelled by user." + newline); } log.setCaretPosition(log.getDocument().getLength()); // Handle save button action. } else if (e.getSource() == saveButton) { log.setText(""); // reset } }
/** * The constructor. * * @param parent The parent window. * @param idata The installation data. */ public InfoPanel(InstallerFrame parent, InstallData idata) { super(parent, idata, new IzPanelLayout()); // We load the text. loadInfo(); // The info label. add( LabelFactory.create( parent.langpack.getString("InfoPanel.info"), parent.icons.getImageIcon("edit"), LEADING), NEXT_LINE); // The text area which shows the info. JTextArea textArea = new JTextArea(info); textArea.setCaretPosition(0); textArea.setEditable(false); JScrollPane scroller = new JScrollPane(textArea); add(scroller, NEXT_LINE); // At end of layouting we should call the completeLayout method also they do nothing. getLayoutHelper().completeLayout(); }
private JPanel createPreviewPanel() { JPanel panel; YBoxPanel headerPanel; JScrollPane scroll; panel = new JPanel(new BorderLayout()); panel.setBorder(BorderFactory.createTitledBorder(Translator.get("preview"))); headerPanel = new YBoxPanel(); headerPanel.add(new JLabel(Translator.get("run_dialog.run_command_description") + ":")); headerPanel.add(historyPreview = new EditableComboBox(new JTextField("mucommander -v"))); historyPreview.addItem("mucommander -v"); historyPreview.addItem("java -version"); headerPanel.addSpace(10); headerPanel.add(new JLabel(Translator.get("run_dialog.command_output") + ":")); panel.add(headerPanel, BorderLayout.NORTH); shellPreview = new JTextArea(15, 15); panel.add( scroll = new JScrollPane( shellPreview, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); scroll.getViewport().setPreferredSize(shellPreview.getPreferredSize()); shellPreview.append(RuntimeConstants.APP_STRING); shellPreview.append("\nCopyright (C) "); shellPreview.append(RuntimeConstants.COPYRIGHT); shellPreview.append( " Maxence Bernard\nThis is free software, distributed under the terms of the GNU General Public License."); // shellPreview.setLineWrap(true); shellPreview.setCaretPosition(0); setForegroundColors(); setBackgroundColors(); return panel; }
/** Update the merged BibtexEntry with source and preview panel everytime something is changed */ private void updateAll() { if (!doneBuilding) { // If we've not done adding everything, do not do anything... return; } // Check if the type is changed if (!identical[0]) { if (rb[0][0].isSelected()) { mergedEntry.setType(one.getType()); } else { mergedEntry.setType(two.getType()); } } // Check all fields for (int i = 0; i < joint.size(); i++) { if (!identical[i + 1]) { if (rb[0][i + 1].isSelected()) { mergedEntry.setField(jointStrings[i], one.getField(jointStrings[i])); } else if (rb[2][i + 1].isSelected()) { mergedEntry.setField(jointStrings[i], two.getField(jointStrings[i])); } else { mergedEntry.setField(jointStrings[i], null); } } } // Update the PreviewPanel pp.setEntry(mergedEntry); // Update the Bibtex source view StringWriter sw = new StringWriter(); try { new BibtexEntryWriter(new LatexFieldFormatter(), false).write(mergedEntry, sw); } catch (IOException ex) { LOGGER.error("Error in entry" + ": " + ex.getMessage(), ex); } jta.setText(sw.getBuffer().toString()); jta.setCaretPosition(0); }
public boolean loadSourceFile(File file) { boolean result = false; selectedPath = file.getParent(); BufferedReader sourceFile = null; String directoryPath = file.getParent(); String sourceName = file.getName(); int idx = sourceName.lastIndexOf("."); fileExt = idx == -1 ? "" : sourceName.substring(idx + 1); baseName = idx == -1 ? sourceName.substring(0) : sourceName.substring(0, idx); String basePath = directoryPath + File.separator + baseName; DataOptions.directoryPath = directoryPath; sourcePath = file.getPath(); AssemblerOptions.sourcePath = sourcePath; AssemblerOptions.listingPath = basePath + ".lst"; AssemblerOptions.objectPath = basePath + ".cd"; String var = System.getenv("ROPE_MACROS_DIR"); if (var != null && !var.isEmpty()) { File dir = new File(var); if (dir.exists() && dir.isDirectory()) { AssemblerOptions.macroPath = var; } else { AssemblerOptions.macroPath = directoryPath; } } else { AssemblerOptions.macroPath = directoryPath; } DataOptions.inputPath = AssemblerOptions.objectPath; DataOptions.outputPath = basePath + ".out"; DataOptions.readerPath = null; DataOptions.punchPath = basePath + ".pch"; DataOptions.tape1Path = basePath + ".mt1"; DataOptions.tape2Path = basePath + ".mt2"; DataOptions.tape3Path = basePath + ".mt3"; DataOptions.tape4Path = basePath + ".mt4"; DataOptions.tape5Path = basePath + ".mt5"; DataOptions.tape6Path = basePath + ".mt6"; this.setTitle("EDIT: " + sourceName); fileText.setText(sourcePath); if (dialog == null) { dialog = new AssemblerDialog(mainFrame, "Assembler options"); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension dialogSize = dialog.getSize(); dialog.setLocation( (screenSize.width - dialogSize.width) / 2, (screenSize.height - dialogSize.height) / 2); } dialog.initialize(); AssemblerOptions.command = dialog.buildCommand(); sourceArea.setText(null); try { sourceFile = new BufferedReader(new FileReader(file)); String line; while ((line = sourceFile.readLine()) != null) { sourceArea.append(line + "\n"); } sourceArea.setCaretPosition(0); optionsButton.setEnabled(true); assembleButton.setEnabled(true); saveButton.setEnabled(true); setSourceChanged(false); undoMgr.discardAllEdits(); result = true; } catch (IOException ex) { ex.printStackTrace(); } finally { try { if (sourceFile != null) { sourceFile.close(); } } catch (IOException ignore) { } } return result; }
public SwingUpdaterUI(String oldBuildDesc, String newBuildDesc, InstallOperation operation) { myOperation = operation; myProcessTitle = new JLabel(" "); myProcessProgress = new JProgressBar(0, 100); myProcessStatus = new JLabel(" "); myCancelButton = new JButton(CANCEL_BUTTON_TITLE); myConsole = new JTextArea(); myConsole.setLineWrap(true); myConsole.setWrapStyleWord(true); myConsole.setCaretPosition(myConsole.getText().length()); myConsole.setTabSize(1); myConsolePane = new JPanel(new BorderLayout()); myConsolePane.add(new JScrollPane(myConsole)); myConsolePane.setBorder(BUTTONS_BORDER); myConsolePane.setVisible(false); myCancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { doCancel(); } }); myFrame = new JFrame(); myFrame.setTitle(TITLE); myFrame.setLayout(new BorderLayout()); myFrame.getRootPane().setBorder(FRAME_BORDER); myFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); myFrame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { doCancel(); } }); JPanel processPanel = new JPanel(); processPanel.setLayout(new BoxLayout(processPanel, BoxLayout.Y_AXIS)); processPanel.add(myProcessTitle); processPanel.add(myProcessProgress); processPanel.add(myProcessStatus); processPanel.add(myConsolePane); for (Component each : processPanel.getComponents()) { ((JComponent) each).setAlignmentX(Component.LEFT_ALIGNMENT); } JPanel buttonsPanel = new JPanel(); buttonsPanel.setBorder(BUTTONS_BORDER); buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS)); buttonsPanel.add(Box.createHorizontalGlue()); buttonsPanel.add(myCancelButton); myProcessTitle.setText("<html>Updating " + oldBuildDesc + " to " + newBuildDesc + "..."); myFrame.add(processPanel, BorderLayout.CENTER); myFrame.add(buttonsPanel, BorderLayout.SOUTH); myFrame.setMinimumSize(new Dimension(500, 50)); myFrame.pack(); myFrame.setLocationRelativeTo(null); myFrame.setVisible(true); myQueue.add( new UpdateRequest() { @Override public void perform() { doPerform(); } }); startRequestDispatching(); }
void appendRoom(String str) { chat.append(str); chat.setCaretPosition(chat.getText().length() - 1); }
void appendEvent(String str) { event.append(str); event.setCaretPosition(chat.getText().length() - 1); }
/* * @param String s - send s to output textArea */ public void setOutput(String s) { // if (debugBoardPanel) { bottomText.append("\n" + s); bottomText.setCaretPosition(bottomText.getDocument().getLength()); // } }
public void setup() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); title = new JLabel(SHTML + TITLE + elem.title + EHTML); gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.gridy = 4; gbc.gridx = 0; gbc.gridwidth = 2; gbc.gridheight = 1; gbc.weighty = 1.0; add(title, gbc); donor = new JLabel(SHTML + DONOR + elem.donor + EHTML); gbc.gridy = 5; add(donor, gbc); subDate = new JLabel(SHTML + SUB_DATE + elem.subDate.toString() + EHTML); gbc.gridy = 6; add(subDate, gbc); objDate = new JLabel(SHTML + OBJ_DATE + elem.objDate.toString() + EHTML); gbc.gridy = 7; add(objDate, gbc); medium = new JLabel(SHTML + MEDIUM + elem.medium + EHTML); gbc.gridy = 8; add(medium, gbc); accNum = new JLabel(SHTML + ACC_NUM + elem.accNum + EHTML); gbc.gridy = 9; add(accNum, gbc); desc = new JLabel(SHTML + DESC + EHTML); // gbc.anchor = GridBagConstraints.PAGE_START; gbc.insets = new Insets(0, 50, 0, 0); gbc.gridy = 4; gbc.gridx = 2; add(desc, gbc); descView = new JTextArea(); descView.setLineWrap(true); descView.setWrapStyleWord(true); descView.setEditable(false); descView.setText(elem.desc); descView.setFont(new Font("Times New Roman", Font.PLAIN, 13)); JScrollPane scrollPane = new JScrollPane(descView); scrollPane.setPreferredSize(new Dimension(225, 100)); // scrollPane.setBorder(null); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); descView.setCaretPosition(0); gbc.gridy = 5; gbc.gridheight = 4; gbc.gridx = 2; add(scrollPane, gbc); gbc.insets = null; gbc.gridy = 0; gbc.gridx = 0; gbc.gridwidth = 4; gbc.gridheight = 4; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 0, 10, 0); vpan = new V3DPanel(elem, provider); vpan.setPreferredSize(new Dimension(500, 300)); setBackground(BACKGROUND); add(vpan, gbc); validate(); }
public void actionPerformed(ActionEvent e) { saveOld(); area1.setText(""); resetArea2(); try { clientSocket = new Socket(ipaddress.getText(), Integer.parseInt(portNumber.getText())); Random r = new Random(); serverport = 10000 + r.nextInt(8999); // random port :D serverSocket = new ServerSocket(serverport); active = true; editor.setTitleToListen(); connected = true; ObjectOutputStream output = new ObjectOutputStream(clientSocket.getOutputStream()); ObjectInputStream input = new ObjectInputStream(clientSocket.getInputStream()); output.writeObject(new JoinNetworkRequest(serverport)); ConnectionData data = getConnectionData(clientSocket, input); lc = new LamportClock(data.getId()); lc.setMaxTime(data.getTs()); dec = new DocumentEventCapturer(lc, editor); er = new EventReplayer(editor, dec, lc); ert = new Thread(er); ert.start(); Peer peer = new Peer( editor, er, data.getHostId(), clientSocket, output, input, lc, clientSocket.getInetAddress().getHostAddress(), data.getPort()); dec.addPeer(peer); Thread thread = new Thread(peer); thread.start(); er.setAcknowledgements(data.getAcknowledgements()); er.setEventHistory(data.getEventHistory()); er.setCarets(data.getCarets()); er.addCaretPos(lc.getID(), 0); for (PeerWrapper p : data.getPeers()) { Socket socket; try { socket = connectToPeer(p.getIP(), p.getPort()); ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream()); ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream()); outputStream.writeObject( new NewPeerDataRequest(lc.getID(), serverSocket.getLocalPort(), 0)); Peer newPeer = new Peer( editor, er, p.getId(), socket, outputStream, inputStream, lc, p.getIP(), p.getPort()); dec.addPeer(newPeer); Thread t = new Thread(newPeer); t.start(); } catch (IOException ex) { continue; } } Thread t1 = new Thread( new Runnable() { @Override public void run() { waitForConnection(); } }); t1.start(); area1.setText(data.getTextField()); area1.setCaretPosition(0); setDocumentFilter(dec); dec.sendObjectToAllPeers(new UnlockRequest(lc.getTimeStamp())); changed = false; Connect.setEnabled(false); Disconnect.setEnabled(true); Listen.setEnabled(false); Save.setEnabled(false); SaveAs.setEnabled(false); } catch (NumberFormatException | IOException e1) { setTitle("Unable to connect"); } }
public void setBodyText(String text) { mailBodyArea.setText(text); mailBodyArea.setCaretPosition(0); }
// called by the Client to append text in the TextArea void append(String str) { chatArea.append(str); chatArea.setCaretPosition(chatArea.getText().length() - 1); }
/* Add a message to the message area, auto-scroll to end */ public synchronized void message(String s) { mssgArea.append(s + "\n"); mssgArea.setCaretPosition(mssgArea.getDocument().getLength()); }