Questions tagged [javax.swing.text]

Package javax.swing.text provides classes and interfaces that deal with editable and non editable text components.

Examples of text components are text fields and text areas, of which password fields and document editors are special instantiations. Features that are supported by this package include selection/highlighting, editing, style, and key mapping.

15 questions
6
votes
1 answer

How to implement in JEditorPane on text changed

How to implement in JEditorPane on text changed method ( get text on every character added or deleted ) ?
Damir
  • 54,277
  • 94
  • 246
  • 365
2
votes
1 answer

How to create a custom Swing Document structure

I have a JEditorPane holding a custom EditorKit and a custom Document (derived from DefaultStyledDocument). The following is an example for the content of the JEditorPane: first paragraph second paragraph For the example above I get a…
Andre
  • 599
  • 1
  • 6
  • 20
2
votes
1 answer

Javax.swing.text, Lowagie, HTMLWriter adding image (Not from file)

I am trying to create a document with htmlWriter in com.lowagie.text in Java. What I do, is that I create an image (from qr-code) and try to add it to the document. The document is connected to an ByteArrayOutputStream, and then I write it out to a…
TorK
  • 567
  • 2
  • 10
  • 27
1
vote
1 answer

How do I add the javax.swing.* packages to my libs for my android project?

First of all I'd like to mention I am very new to Java programming. This Android project is my first experience with Java. So for one task I need to strip HTML tags from a string. I was thinking about using this answer Remove HTML tags from a…
user147862
1
vote
4 answers

Restrict Input of JTextField to Double Numbers?

In java , i am trying to make simple currency converter, but for that i need a text field which can restrict input to numbers only and more importantly double numbers. I tried using JFormatedTextField but it only format the input after you have done…
Zulqurnain Jutt
  • 298
  • 3
  • 20
1
vote
1 answer

Insert one DefaultStyledDocument into another DefaultStyledDocument

I want to insert one DefaultStyledDocument into another DefaultStyledDocument. How do I do this? I know of this method: AbstractDocument.insertString(int offs, String str, AttributeSet a) What I…
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
1
vote
1 answer

Parse Exception MaskFormatter

I'm trying to use MaskFormatter with JFormattedTextField. Inside my class I have this line of code JFormattedTextField jtfCNP=new JFormattedTextField(new MaskFormatter(formatCNP)); When I compile, I get the ParseException. The only way around it I…
0
votes
1 answer

Java Swing Thumbnail View of Images to select image

How To Generate or Show thumbnail view of images in a tab of JTabbedPane in java and allow user to click on that image to be display in other tab of a JTabbedpane ? import javax.swing.*; import java.awt.*; import java.awt.Event.*; …
Jony
  • 1,035
  • 7
  • 17
  • 43
0
votes
2 answers

How to read last word or last line in DocumenListener

I implement DocumentListener for JEditorPane ( need help with method insertUpdate(DocumentEvent e) ). How to read last word or last line (lines are separated by '\n' and words are separated by ' ' ) ?
Damir
  • 54,277
  • 94
  • 246
  • 365
0
votes
3 answers

What is best control in Java for simple editor

I need to implement light editor ( recognize part of key words, syntax highlight and suggest all of word in dropdown list if user type part with same prefix). What is best control in Java for this task ?
Damir
  • 54,277
  • 94
  • 246
  • 365
0
votes
0 answers

Editing RTF files

I have been able to read RTF files with RTFEditorKit but I want something more. I want to be able to change text to bold or italic and to change font size just like MS Word does. I want to be able to edit the RTF and changes made should be visible…
0
votes
1 answer

Printing the text when checkbox is clicked

I have a doubt regarding Swing application. In this image, if the check box is checked and next button is clicked, it need to show the printed text in the next frame as "enter the movie name". Could anyone please help me with this? Code: private…
Mahesh
  • 1
  • 3
0
votes
2 answers

DefaultStyledDocument.styleChanged(Style style) may not run in a timely manner?

I'm experiencing an intermittent problem with a class that extends javax.swing.text.DefaultStyledDocument. This document is being sent to a printer. Most of the time the formatting of the document looks correct, but once in a while it doesn't. It…
Paul Reiners
  • 8,576
  • 33
  • 117
  • 202
0
votes
2 answers

Trying to create a GUI using java but not able to implement them the way i wanted

import javax.swing.*; import java.awt.*; public class SQlUI { public static void main(String[] args){ SQlUI user=new SQlUI(); user.go(); } public void go(){ //Creating a Frame JFrame frame=new JFrame(); //Creating three Panels JPanel panel0=new…
Shantanu Nandan
  • 1,438
  • 8
  • 30
  • 56
0
votes
1 answer

jlabel icon right alignment and text left alignment

It is possible to create a jlabel with an icon so that the icon is aligned right ( right justified ) and the text is left justified. That means, in same label component i want the text to appear at the very left end of label and the icon at the far…
C graphics
  • 7,308
  • 19
  • 83
  • 134