use of javax.swing.text.Document in project hackpad by dropbox.
the class ConsoleTextArea method returnPressed.
synchronized void returnPressed() {
Document doc = getDocument();
int len = doc.getLength();
Segment segment = new Segment();
try {
doc.getText(outputMark, len - outputMark, segment);
} catch (javax.swing.text.BadLocationException ignored) {
ignored.printStackTrace();
}
if (segment.count > 0) {
history.add(segment.toString());
}
historyIndex = history.size();
inPipe.write(segment.array, segment.offset, segment.count);
append("\n");
outputMark = doc.getLength();
inPipe.write("\n");
inPipe.flush();
console1.flush();
}
use of javax.swing.text.Document in project OpenAM by OpenRock.
the class TableJPanel method clearAll.
public void clearAll() {
testsjTable.setEnabled(false);
TestsTableModel model = (TestsTableModel) testsjTable.getModel();
model.removeAll();
Document doc = messagejEditorPane.getDocument();
try {
doc.remove(0, doc.getLength());
} catch (Exception ex) {
//ex.printStackTrace();
System.out.println("Exception in TableJPanel :" + ex.getMessage());
}
testsjTable.setEnabled(true);
}
use of javax.swing.text.Document in project pcgen by PCGen.
the class InfoPane method setText.
public void setText(String text) {
//This is done so the vertical scroll bar goes back up to the top when the text is changed
EditorKit kit = textPane.getEditorKit();
Document newDoc = kit.createDefaultDocument();
try {
kit.read(new StringReader(text), newDoc, 0);
} catch (IOException | BadLocationException ex) {
throw new UnreachableError(ex);
}
textPane.setDocument(newDoc);
}
use of javax.swing.text.Document in project intellij-community by JetBrains.
the class RequiredAttributesInspection method createOptionsPanel.
@Override
@Nullable
public JComponent createOptionsPanel() {
JPanel panel = new JPanel(new BorderLayout());
FieldPanel additionalAttributesPanel = new FieldPanel(InspectionsBundle.message("inspection.javadoc.html.not.required.label.text"), InspectionsBundle.message("inspection.javadoc.html.not.required.dialog.title"), null, null);
panel.add(additionalAttributesPanel, BorderLayout.NORTH);
additionalAttributesPanel.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
final Document document = e.getDocument();
try {
final String text = document.getText(0, document.getLength());
if (text != null) {
myAdditionalRequiredHtmlAttributes = text.trim();
}
} catch (BadLocationException e1) {
LOG.error(e1);
}
}
});
additionalAttributesPanel.setText(myAdditionalRequiredHtmlAttributes);
return panel;
}
use of javax.swing.text.Document in project intellij-community by JetBrains.
the class StepicStudyOptions method createUIComponents.
private void createUIComponents() {
Document doc = new PlainDocument();
myPasswordField = new JPasswordField(doc, null, 0);
}
Aggregations