Questions tagged [jtextpane]

A Java Swing text component that can be marked up with attributes that are represented graphically.

A Java Swing text component that can be marked up with attributes that are represented graphically. You can find how-to information and examples of using text panes in Using Text Components, a section in The Java Tutorial.

1014 questions
-1
votes
1 answer

JPanel doesnt show components after the second button click

I want to put a JTextPane component in a JPanel with a GridBagLayout when I click on button. My code works fine for the first button click, But after, the next components are not displayed. Here is my code: import java.awt.*; import…
Ramses
  • 602
  • 2
  • 6
  • 25
-1
votes
1 answer

JTextPane StyleConstants double spacing

I am trying to get my java application to add a double spacing feature, using StyleDocs and StyleConstants. So far this is what I have. void doSpace(){ StyleConstants.setLineSpacing(style, 5); try { doc.insertString(doc.getLength(), "…
user1924782
  • 33
  • 1
  • 6
-1
votes
1 answer

JScrollBar not functioning the way i want

so i have a scrollbar, a JTextPane and code to push text to the next line when it hits the edge, however there are several issues. The JScrollBar won't grow any further than a specific size, any text that extends greater than that is no longer…
tommy knocker
  • 261
  • 1
  • 6
  • 18
-1
votes
1 answer

Save JTextPane, and Open it Java

I'm trying to save a file using JFileChooser, but I cant seem to get it to actually save. I've tried a couple of different methods, but I want the user to able to save on desired location. When I hit the "Save" button it says that it's saved. But…
-1
votes
2 answers

JTextPane change the font of a certain starting point

How to change the font of a certain starting point? I have a button, switch the font at certain point. Example: somtext | Press the button sometext boldedtext| So I made the event key release but I can see the changing font a ever key released…
-1
votes
2 answers

How do I set the contents of a JTextPane or JTextArea to a String array?

How do I set the contents of a JTextPane to a String array? I'm making a memorization application that removes random words that a user enters in a JTextPane and replaces it with underscores. I want to convert what the user enters to a string array…
Col1107
  • 363
  • 2
  • 5
  • 21
-1
votes
1 answer

Select text in JTextPane

I am creating a text editor using JTextPane that allows the user to bold, color and align the text by highlighting the text then selecting the option to either bold, color or align. After the adjustment is made, the selection goes away, but I want…
smith8ar
  • 71
  • 1
  • 7
-1
votes
1 answer

Colouring text based on color codes in a JTextPane dynamicly

I'm trying to make a textpane using a StyledDocument where when doc.insertString(doc.getLength(), text + "\n", keyWord); it replaces all instances of "§" then a number (so like "§1") with the colour and should remove the code its self after and…
woder
  • 15
  • 6
-1
votes
1 answer

Content Assistant in JAVA

I am trying to create a xml editor which must have a content assistant. I am new in java so my code isn't working properly. I am trying to change a text color while typing (words between '<' and '>' including '<' and '>' must be blue), my non…
Student22b
  • 49
  • 2
  • 10
-1
votes
1 answer

StyleConstants Text Background, Alignment Not Working Together

Consider the code, Question #1 StyledDocument doc=textPane.getStyledDocument(); SimpleAttributeSet attrib=new SimpleAttributeSet(); attrib.addAttribute(StyleConstants.CharacterConstants.Alignment,StyleConstants.ALIGN_RIGHT); doc.insertString(0,"This…
JavaTechnical
  • 5,807
  • 8
  • 40
  • 79
-1
votes
3 answers

Save location in flow layout

I have created a frame and two panels. Jpanel pane11=new JPanel(); Jpanel pane12=new JPanel(); Added the panel2 to the panel1 panel1.add(panel2); getContentPane().add(panel1); Now I set the panel2 background white and it is working correctly I…
-1
votes
1 answer

How to drag more than one JTextPane

I have created a frame with null layout, and I have 6 small JTextPanes in it. My intention is when I clicked a particular textpane, it has to get dragged by mouse wherever I want in the frame.
Ananth
  • 41
  • 1
  • 7
-1
votes
3 answers

Java - How can I add make a JTextPane split in 3 colums?

I'm working on a chat client and I have this problem: What I want to do is divide the JTextPane in 3 colums so that in the first one it puts out the name of the user, in the second the message and the date in the third. I tried to do this by…
martin
  • 917
  • 2
  • 14
  • 31
-1
votes
1 answer

JTextPane and HTML

I am making a text editor roughly like a microsoft word and I am using a textpane with HTML. After doing some research I found a way to apply html to a highlighted section on using StyleConstants and then a method that goes…
rortega92
  • 19
  • 1
-1
votes
1 answer

How to create a JTable like header, and use it as JTexPane header?

I need a JTextPane which has a header on top just like the one in a JTable. Basically I need a one row/column multiline JTable without having to go through all trouble crating renderes and editors. I tried adding a JLabel and JTextpane in a JPanel,…
Igor
  • 1,414
  • 4
  • 21
  • 43
1 2 3
67
68