Questions tagged [swingutilities]
121 questions
2
votes
2 answers
Unable to select "text with number and underscore" on DoubleClick in JTextPane
I have a text like, "test_1_another_2_test3" in my JTextPane. When I double click on the text, it does not select the whole text (sometimes, it selects only one character or number or the text between underscores). I can implement a…

Narayan Panda
- 23
- 3
2
votes
1 answer
Cannot call method from the event dispatcher thread
I'm writing a program that records user mouse movement and clicks, and the plays them using the Robot class.
I am running into this error:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalThreadStateException: Cannot call method from the…

yehyaawad
- 126
- 1
- 11
2
votes
3 answers
Get Location of JTable Header in JFrame
Here is an image of my application:
As you can see, there is a JTable in there. I need to get the location of the headers of the JTable relative to the JFrame that it is in.
Why might I be doing this? I am adding a help feature that explains what…

user489041
- 27,916
- 55
- 135
- 204
2
votes
1 answer
Is javax.swing.SwingUtilities.invokeLater nesessary?
So I have seen countless different GUI tutorials, and all of them have said to use this code:
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
…

Groudonzora
- 23
- 3
2
votes
1 answer
Does SwingUtilities.updateComponentTreeUI() method set the current L&F to all super and sub components?
Background:
From the documentation, the method SwingUtilities.updateComponentTreeUI() ask to each component in the tree (What tree?) to update their own UI properties calling the method updateUI().
SwingUtilities.updateComponentTreeUI() is strictly…

user14312287
- 72
- 2
- 14
2
votes
1 answer
Why cannot invokeLater method be used autonomously (using import javax.swing.SwingUtilities)?
The following code executes fine:
public static void main(String [] args) {
Runnable r = new Runnable() {
public void run() {
createGUI();
}
} ;
…

Buras
- 3,069
- 28
- 79
- 126
2
votes
3 answers
MultiThreading locking up Java Swing GUI
I'm working on a project for a multiple user paint program and I have run into a problem with my GUI locking up.
I have most of the program done except for this error, it is a rather large program so I tried to reproduce the error in a smaller…

Lucas
- 567
- 1
- 8
- 21
2
votes
2 answers
Closing parent element of a JPanel
Is it possible to close parent element of a component .. probably a JFrame/JInternalFrame from a JPanel? if yes how it can be done?

c.pramod
- 606
- 1
- 8
- 22
2
votes
2 answers
SwingUtilities.invokeLater : Issues
I never understood SwingUtilities.invokeLater,that is the reason i kept avoiding it until now.But its very important to make Swing Thread safe.
Well please excuse me, as this is my first time with this.
I am trying to Close the window after some…

joey rohan
- 3,505
- 5
- 33
- 70
2
votes
4 answers
Updating a textfield using SwingUtilities.invokeLater()
My program consists of a simple gui and a class that extends thread!
i am trying to learn how to use SwingUtilities.invokeLater() in order to use it to update a textfield in my GUI but how do i reach the textfield in my gui without making static?…

Marc Rasmussen
- 19,771
- 79
- 203
- 364
2
votes
4 answers
Does system.out.println have to be on edt?
I was running some code that did a printout in a swingworker. I was not getting printouts so I used SwingUtilities.invokeLater and now it works. I did not expect this result, how did this happen? I would have thought System.out.println could run…

smuggledPancakes
- 9,881
- 20
- 74
- 113
1
vote
1 answer
Best way to find real bounds of font
I was looking for a way to find the bounds on rendered text and encountered the FontMetrics getStringBounds method. This seems to ignore some font's descent and has an exaggerated ascent so that it returns a bounds that doesn't let me align…

bittramp
- 121
- 2
- 15
1
vote
2 answers
How to let the JPanel fill the complete JFrame (while in maximized state) with the "Windows Decoration" kept ON?
Full image of my window
The grey border of JFrame visible
Problem:
I want my application to run on full screen (maximized) by default (but the maximum resolution varies by default from laptop to laptop). I am using a background image which scales…

kingrishabdugar
- 38
- 7
1
vote
0 answers
Where can I get javafx.embed.swing.SwingFXUtils for Maven Java 18 in IntelliJ?
I'm trying to add a feature to my JavaFX application to save a PNG image. The solution I've seen almost everywhere to convert a JavaFX Image to a writable buffer consists in using SwingFXUtils.fromFXImage(...).
After a few hours of research, the…

Gael-Bernard
- 11
- 1
1
vote
0 answers
Creating GUI and populating later the DefaultComboBoxModel of a JComboBox using SwingUtilities still freeze JFrame while populating thread is running
I try to create and show a GUI and to populate later a DefaultComboBoxModel using SwingUtilities.invokeLater(...).
But the UI is still freezing and components are not displayed until the loading thread has completed.
The main frame is instantiated…

Philippe Fery
- 120
- 5