public void run () { ui.textArea.append("" + c); ui.textArea.setCaretPosition(ui.textArea.getDocument().getLength()); } });
public void run () { ui.textArea.append(text + "\n"); ui.textArea.setCaretPosition(ui.textArea.getDocument().getLength()); } });
public void setText(@NotNull String data) { if (data.length() > 0 && data.charAt(data.length() - 1) == '\n') { data = data.substring(0, data.length() - 1); } myText.setText(data); myText.setCaretPosition(0); if (data.length() > 0) { activate(); } }
@Override public void valueChanged(ListSelectionEvent e) { if (table.getSelectedRow() == -1) { // Clear the messageTextArea since there is none packet selected messageTextArea.setText(null); } else { // Set the detail of the packet in the messageTextArea messageTextArea.setText( (String) table.getModel().getValueAt(table.getSelectedRow(), 0)); // Scroll up to the top messageTextArea.setCaretPosition(0); } } }
private void populateResultArea() { int[] selectionIndices = resultsTable.getSelectedRows(); TableModel model = resultsTable.getModel(); List<Match> selections = new ArrayList<>(selectionIndices.length); for (int i = 0; i < selectionIndices.length; i++) { selections.add((Match) model.getValueAt(selectionIndices[i], 99)); } String report = new SimpleRenderer(trimLeadingWhitespace).render(selections.iterator()); resultsTextArea.setText(report); resultsTextArea.setCaretPosition(0); // move to the top }
@Override public void setBody(byte[] body, ContentType type) { // Call the super method super.setBody(body, type); // Set the hex display value jta.setText(HexDump.getHexDataDumpAsString(body)); jta.setCaretPosition(0); }
@Override public void run() { errorWindow.getContentPane().removeAll(); JTextArea textArea = new JTextArea(); textArea.setEditable(false); StringBuilder text = new StringBuilder(); text.append("An exceptional error occurred!\nYou can try to continue or exit the application.\n\n"); text.append("Please tell us about this here:\nhttp://www.4thline.org/projects/mailinglists-cling.html\n\n"); text.append("-------------------------------------------------------------------------------------------------------------\n\n"); Writer stackTrace = new StringWriter(); throwable.printStackTrace(new PrintWriter(stackTrace)); text.append(stackTrace.toString()); textArea.setText(text.toString()); JScrollPane pane = new JScrollPane(textArea); errorWindow.getContentPane().add(pane, BorderLayout.CENTER); JButton exitButton = new JButton("Exit Application"); exitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(1); } }); errorWindow.getContentPane().add(exitButton, BorderLayout.SOUTH); errorWindow.pack(); Application.center(errorWindow); textArea.setCaretPosition(0); errorWindow.setVisible(true); } });
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); contentPanel.add(stackTraceScrollPane, BorderLayout.CENTER); stackTraceTextArea.setCaretPosition(0); // Scroll to top JPanel buttonPanel = new JPanel(new GridLayout(1, 0)); JButton closeButton = new JButton(new AbstractAction("Close") {
jta_trace.setCaretPosition(0); jsp_jta_trace.setPreferredSize(d);
private void loadFromFile(File f) { if(f != null){ try{ String content = FileUtil.getContentAsString(f, Charsets.UTF_8); Dimension d = jsp_in.getPreferredSize(); jta_in.setText(content); jta_in.setCaretPosition(0); jsp_in.setPreferredSize(d); } catch(IOException ex){ ui.getView().showError(Util.getStackTrace(ex)); } } }
= constraintMatchTotalList.get(selectedRow); detailTextArea.setText(buildConstraintMatchSetText(constraintMatchTotal)); detailTextArea.setCaretPosition(0);
void showMessage(final String title, final String message){ messageDialog.setTitle(title); jta_error.setText(message); jta_error.setCaretPosition(0); messageDialog.setLocationRelativeTo(ui.getFrame()); jb_ok.requestFocus(); messageDialog.setVisible(true); }
textArea.setCaretPosition(pos + findLength); textArea.moveCaretPosition(pos);
private CheckBoxTree createCheckBoxTree() { final CheckBoxTree resultCheckBoxTree = new CheckBoxTree(initBenchmarkHierarchy(true)); resultCheckBoxTree.addTreeSelectionListener(e -> { TreePath treeSelectionPath = e.getNewLeadSelectionPath(); if (treeSelectionPath != null) { DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) treeSelectionPath.getLastPathComponent(); MixedCheckBox checkBox = (MixedCheckBox) treeNode.getUserObject(); detailTextArea.setText(checkBox.getDetail()); detailTextArea.setCaretPosition(0); renameNodeButton.setEnabled(checkBox.getBenchmarkResult() instanceof PlannerBenchmarkResult || checkBox.getBenchmarkResult() instanceof SolverBenchmarkResult); } }); resultCheckBoxTree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { // Enable button if checked singleBenchmarkResults exist generateReportButton.setEnabled(!resultCheckBoxTree.getSelectedSingleBenchmarkNodes().isEmpty()); } }); checkBoxTree = resultCheckBoxTree; return resultCheckBoxTree; }
/** * Set selection. */ public void select() { pModel.findSelectionPositions(); editor.setSelectedTextColor(Color.blue); editor.requestFocusInWindow(); editor.setCaretPosition(pModel.getSelectionStart()); editor.moveCaretPosition(pModel.getSelectionEnd()); }
body = data; jta.setText(HexDump.getHexDataDumpAsString(data)); jta.setCaretPosition(0);
@Override public void write(int b) throws IOException { // redirects data to the text area textArea.append(String.valueOf((char)b)); // scrolls the text area to the end of data textArea.setCaretPosition(textArea.getDocument().getLength()); } }
private void checkScrollWindow() { // Console output. DefaultCaret caret = (DefaultCaret)consoleTextArea.getCaret(); if (scrollWindowCheckBox.isSelected()) { caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); consoleTextArea.setCaretPosition(consoleTextArea.getDocument().getLength()); } else { caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); } // Command table. this.commandTable.setAutoWindowScroll(scrollWindowCheckBox.isSelected()); }
private void checkScrollWindow() { // Console output. DefaultCaret caret = (DefaultCaret)consoleTextArea.getCaret(); if (scrollWindowMenuItem.isSelected()) { caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); consoleTextArea.setCaretPosition(consoleTextArea.getDocument().getLength()); } else { caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); } }
public void showDialog(String title, String message) { this.setTitle(title); this.lblMessage.setText(message); this.lblMessage.setCaretPosition(0); this.pack(); this.revalidate(); this.repaint(); this.setModal(true); this.setVisible(true); }