Questions tagged [swingutilities]
121 questions
1
vote
1 answer
Make JTable cells perfectly square
Is there any mechanism to make a JTable's cells perfectly square? Currently I'm just overriding this method in the table's implementation:
@Override
public int getRowHeight() {
return this.getColumnModel().getColumn(0).getWidth();
}
This works…

219CID
- 340
- 5
- 15
1
vote
1 answer
Killing a thread within the SwingUtilities.invokeLater()
I have a swing application. Upon clicking a menuItem on the menu bar, I am trying to make an API call which will supposedly take some time.
I didn't want the Swing app to get stuck/hanged until the API call gives its result so I have used the…

Vamsi Emani
- 10,072
- 9
- 44
- 71
1
vote
1 answer
SwingUtilities.invokeAndWait not running
The code within the run() method is not being executed. Can anyone tell me why?
startButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
if(creator == null) {
…

Jakir00
- 2,023
- 4
- 20
- 32
1
vote
1 answer
SwingUtilities.invokeLater, SwingWorker and gif icon animation issue
I am trying to load a gif icon, while i am doing some expensive work in background. But issue is this, gif(animation) icon is not loading.
If i replace gif icon with png, it works fine.
Here is Test class code
import…

Qaisar Shabbir
- 103
- 2
- 10
1
vote
2 answers
Javafx modifying "Label" in SwingUtilities.invokeLater
I wanted to do the following:
click a button
colors a rectangle red
waits 1 sec
colors a rectangle blue
In the following code:
GraphicsContext gc;
Button myButton = new Button("Button!");
myButton.setOnAction(new EventHandler(){
…

Humble Thinker
- 111
- 2
- 10
1
vote
1 answer
IllegalArgumentException adding a window to a container.
I am new to Java swing. I do have a problem when invoking my Jframe from main class. It may be a duplicate but I cant find out why my code is not worked. So I am posting here.
Mainclass
public static void main(String[] args) {
// TODO code…

User12345
- 486
- 1
- 3
- 18
1
vote
3 answers
JTable high cpu usage on updates when minimized
UPDATE:
So I've found out what is causing this issue. When my Java window is minimized, my table is rendering every single row. Does anyone know how to prevent this?
I have a JXTable that is constantly updating, deleting, and adding row data every…

jdb1015
- 127
- 6
1
vote
1 answer
Java metal look and feel UIManager painter for the SplitPane divider
I'm having a bit of difficulty painting the JSplitPane divider with a UIManager.put(...) call. It's just not working. I'm using the "Metal" look and feel, and this change has to happen after the GUI is already created. All of my other…

user1457114
- 127
- 1
- 1
- 5
1
vote
1 answer
Child frame movement in mac
I am creating a application for window and mac. I am displaying a Dialog Box on frame. Its working fine on window but I am facing problem regarding movement of dialog on mac. When I move frame, dialog box move relative to frame . I need static…

Rajni Kant Sharma
- 104
- 3
- 13
1
vote
1 answer
Main purpose of SwingUtilities invokeLater
I have this code snippet
import javax.swing.SwingUtilities;
public class Client1 {
public static void main( String[] args ) {
SwingUtilities.invokeLater( new Runnable() {
public void run() {
//new MyWindow(…

user3698066
- 21
- 4
1
vote
1 answer
Problems with SwingWorker
This code actually works, but I think it could be written differently. I have a custom JDialog that I am using to display an indeterminate progress bar. Right I set the title, visibility, and location within my while loop. While this works, this I…

yellowman
- 15
- 1
- 5
1
vote
1 answer
What is preventing my progress bar from updating?
I'm writing a small function that will update my ProgressBar and a JLabel base on weighted random integers. The thread is sleeping correctly and the random values are coming through, however, my progress bar and jlabel are not updating.
It is also…

WilliamShatner
- 926
- 2
- 12
- 25
1
vote
1 answer
SwingUtilities.invokeLater() displaying just during one frame
I'm using Swing in order to create a little java 2D game. I only try to display an image. Since i'm not on the EDT I'm using SwingUtilities.invokeLater() to do the stuff. When I use it, image is not displayed (in fact it's displayed during few…

Pierre Criulanscy
- 8,726
- 3
- 24
- 38
1
vote
1 answer
Mouse movement inside grid
I've created a grid, and a double array of my class gridBalls.
gridBalls has an int type, and you pass to it a number to determine
what to draw in the grid, like 0 blank, 1 ball etc.
What would the code look like in my mousedragged if I wanted to…

user1426103
- 11
- 3
1
vote
1 answer
what does this method invokeOnEventDispatchThread do?
I came across the following piece of code in my code base and I dont understand how it works.I'm a bit of a novice at Swing, hence sorry if it seems like a silly question.
public static void invokeOnEventDispatchThread(Runnable r){
try{
…

Poornima Prakash
- 320
- 5
- 15