Questions tagged [jtextcomponent]

JTextComponent is the base class for swing text components. It tries to be compatible with the java.awt.TextComponent class where it can reasonably do so. Also provided are other services for additional flexibility (beyond the pluggable UI and bean support).

149 questions
0
votes
1 answer

Better choice: TextLayout or JTextComponent for an "ellipse with editable text" component?

If you've ever used Visio or a UML class diagram editor, you have an idea of what I'm trying to accomplish: Within a JFrame, users can add ellipses that enclose a small editable text field. These ellipses can be repositioned within the frame when…
Orolo
  • 119
  • 7
0
votes
1 answer

JTextPane has overlapping text when highlighted and scrolled upon

My issue is that whenever my JTextPane is highlighted by the user or the user scrolls, the text within the JTextPane overlaps itself many times and the color frequently changes. I've tried looking for other answers but my current code allows the…
Tyler
  • 21
  • 6
0
votes
0 answers

Swing: How to code "set colors" for the text from the user side?

I must do project for studies (homework) where We upgrade utilities. One my feature is "coloring text". I never did It, but I have small idea. I want to bind for example $0 to $9 with colors: BLUE,RED,BLACK,WHITE... (screen shot). When I confirm…
user10665228
0
votes
0 answers

How to log info to JTextArea from different places using log4j

I would ask you how to log information to JTextArea from different places(from exception and for successfully run program) using log4j in java.swing package. Example: I have app which it have 3 checkboxes and when i check one of them and click on…
George
  • 75
  • 1
  • 10
0
votes
0 answers

Java TextComponent Document real time updating

I am writing a simple UI debug console to be used for my software, games, etc. Currently it prints out the lines in bulk. By which I mean if I were to make a for loop counting to 5000 and print a line each time, it would count to some number, say…
BossLetsPlays
  • 121
  • 1
  • 14
0
votes
1 answer

How to set my request focus event listener thread safe?

I m using the the focus event listener to implement a placeholder solution for all JTextComponents (JTextField, JTextArea ...) my implementation is as below public class PlaceHolderDecorator { public static void decorate(JTextField field, String…
0
votes
1 answer

JTextComponent : how to update an existing StyledDocument elements

I wrote a two panes diff class using two DefaultStyledDocument. Now I would like to let the user change, in place, the colours (and, say, boldness) used to show the deletions and insertions, without re-diffing nor keeping the intermediate diff…
Laurent G
  • 397
  • 8
  • 16
0
votes
1 answer

Connecting ONLY the screen keyboard to a JTextComponent

I've connected Vladimir Petrenko's screen keyboard (1.0) to my apps JTextComponent and it works well. Alas, the hardware keyboard continues to provide input characters and I'd like to have the ONLY input come from the screen keyboard. Petrenko's…
user3594510
  • 99
  • 1
  • 1
  • 4
0
votes
1 answer

Improving performances of JTextField

Title itself sounds strange but i wanted to see if there's actual way of improving performances of "setText" method of regular Java JTextField. I have app that's used for calculating some scientific data. Results of the calculation are being…
guest86
  • 2,894
  • 8
  • 49
  • 72
0
votes
1 answer

KeyStroke with keys 1-9 does not work with JTextComponent's Keymap

For some unknown reason, this code doesn't work. JTextComponent component = new JTextArea(); Keymap keymap = component.getKeymap(); keymap.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_1, InputEvent.ALT_DOWN_MASK), myAction); It never…
user3838784
0
votes
1 answer

How to highlight matching words from two text files?

I have two text files which I'm trying to compare, i.e., find matching words and highlight the matching words. The code below takes the two files, finds matching words and prints them out: public class Test { static MyHighlightPainter…
Love
  • 43
  • 2
  • 10
0
votes
1 answer

Swing: Global keyboard shorcuts

So Swing text components provide a way to ahve global keyboard shorcuts. JTextComponent.getKeyMap(JTextComponent.DEFAULT_KEYMAP) provides a way to modify the global, default keymap inherited by all Swing text components. But do other components have…
craigmiller160
  • 5,751
  • 9
  • 41
  • 75
0
votes
2 answers

Prompt Text With JTextPane

I am using JtextPane as a JTextField to make use of Html for styling..but I cant implement prompt text functionality..here is my code... JTextPane txtNm = new JTextPane(); txtNm.setContentType("text/html"); txtNm.addFocusListener(new…
0
votes
1 answer

Trigger event while typing in a JTextComponent java

I have a Settings class that should provide interface for retrieving settings and saving them to a file. My settings are supposed to update whenever I change input values (rather than after clicking Save button). This is why I added this method to…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
0
votes
1 answer

How to setText for a text Field in a class from another class

I want to access JTextField of a class from another class , From the new class i want to setText to the textField. from class patient_details i want to access the JTextField present in class Admission_screen. This is code which i used in…
dheena
  • 85
  • 3
  • 6
  • 15