Changeset 351:d3c00f1a44cb in finroc_tools_gui-java


Ignore:
Timestamp:
15.07.2019 07:52:49 (2 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
default
Phase:
public
Message:

Ensures that updates to status bar GUI components are always done by AWT Thread

File:
1 edited

Legend:

Unmodified
Added
Removed
  • StatusBar.java

    r206 r351  
    3232import javax.swing.JLabel; 
    3333import javax.swing.JPanel; 
     34import javax.swing.SwingUtilities; 
    3435import javax.swing.border.EtchedBorder; 
    3536 
     
    7273 
    7374    public void setStatus(List<ExternalConnection> connections) { 
     75        if (SwingUtilities.isEventDispatchThread()) { 
     76            setStatusInternal(connections); 
     77        } else { 
     78            SwingUtilities.invokeLater(new Runnable() { 
     79                @Override 
     80                public void run() { 
     81                    setStatusInternal(connections); 
     82                } 
     83            }); 
     84        } 
     85    } 
     86 
     87    private void setStatusInternal(List<ExternalConnection> connections) { 
     88        assert(SwingUtilities.isEventDispatchThread()); 
    7489 
    7590        // left part: basic status 
Note: See TracChangeset for help on using the changeset viewer.