150 questions
1
vote
1
answer
91
views
How can I disable middle-click paste in a Java Swing application?
I am using the middle mouse button for an autoscroller in a Java Swing application. However, when I middle-click on a text component, on Linux it pastes the last selected text, which is unwanted. How ...
-1
votes
2
answers
104
views
Add text color while print - Python [closed]
I want to add text color while print output. How to do that ?
Example: Print('Hello Everyone.') I want output text
Hello Everyone will highlighted red color.
Thanks you!
0
votes
0
answers
52
views
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,...
1
vote
2
answers
2k
views
How to re-position cursor in JTextArea
I have set some text in JTextArea. The cursor is in the 5th line. Now I want to set some text in the first line.
So is it possible to re-position the cursor to the desired line?
0
votes
1
answer
317
views
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 {
...
-2
votes
1
answer
61
views
Linking two jtextarea with one scrollbar
I'm trying to have to jtextcompontes with one scrollbar. when I scroll I want the other jtextcomponte to scroll too.
Here's a screenshot:
0
votes
1
answer
31
views
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 ...
2
votes
1
answer
1k
views
Text component displaying lines in reverse order
Alright, I do not know how to fix this and only ran into this problem after trying to put in some longer text on a UI Text component. I have tried both pasting a value into its Text attribute through ...
-4
votes
1
answer
52
views
How to resize my text box?
Main reason for exception message is display only one line but my exception message is contains more than 4 lines.
How can i resize my text box?
0
votes
1
answer
1k
views
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 ...
0
votes
1
answer
295
views
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 ...
0
votes
2
answers
91
views
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....
1
vote
2
answers
900
views
Press TAB to next Java in Vertical axis component
I have a panel null layout and have the following code
int k=130;
int h=10;
for (int i=0; i<22; ++i) {
jTextFieldArray[i] = new JTextField();
jTextFieldArray[i].setBounds(k, h, 120, 25);
...
0
votes
1
answer
4k
views
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 ...
0
votes
1
answer
1k
views
How to add JTextArea to JScrollPane?
I am trying to create a simple text editor, and I have run into a problem trying to take my JTextArea and make it scroll-able via a JScrollPane.
The conventional methods I know of have not worked, ...
0
votes
0
answers
21
views
UIError after extending JTextComponent [duplicate]
I got this error after I extended JTextComponent
UIDefaults.getUI() failed: no ComponentUI class for: com.mypackage.components.FlowComponent[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,...
0
votes
1
answer
178
views
Splitting StyledDocument
I am currently writing a program that accepts styled text in a JTextPane and also displays the same styled text in a non-editable JTextPane. The problem is that I actually want to parse the documents ...
0
votes
1
answer
216
views
Getting Component by name and JTextComponent
I have jTextField named "startTextBox1"
And i use below methods can call it by name;
Creating Hashmap in class.
private HashMap componentMap;
Fill hashmap with components name.
private void ...
0
votes
1
answer
673
views
Swing insert image via ContentType("text/html");
I have coded the following code:
JDialog helpDialog = new JDialog();
helpDialog.setTitle("Help");
helpDialog.setResizable(false);
helpDialog.setAlwaysOnTop(true);
helpDialog.setSize(393, 43);
help....
5
votes
1
answer
757
views
DocumentFilter: Why is replace() invoked and not insertString()?
I've implemented a DocumentFilter subclass, and when I type text into the JTextComponent, the replace() method of the filter is invoked, and not insertString() (which is never invoked). Any idea why ...
1
vote
1
answer
72
views
Off-Screen JTextComponent
I am making a paint program and I'm coming across some trouble figuring out how to make a text tool. What I want to do is click and drag to make a textbox appear on the canvas. The problem is that I ...
1
vote
1
answer
2k
views
How to trigger keyReleased event in java swing
i am trying to trigger key released event in java swing.
txtEmailId.addKeyListener(new KeyAdapter() {
// override keyReleased listener on the Email TextField
@Override
...
0
votes
2
answers
313
views
How to display a Set<String> in a Swing JText Label.
I have a Set words that I would like to display in the Swing JTextField/ or JTextArea. Only these components only accept strings. How do I convert this Set into a String?
1
vote
1
answer
69
views
Add formatted text [closed]
im stuck on a simple question, i want to display formatted text in a swing control and keep on adding new values into it, i don't want to use .setText(.getText + text) for personal reasons, (something ...
2
votes
1
answer
475
views
How do I override JTextPane's selection behavior when Swing D&D is disabled?
Background: I am using custom AWT D&D in my (heavily) customized JTextPane subclass. In other words, I have disabled Swing's D&D with pane.setDragEnabled(false) and I use my own DragSource, ...