Changeset 130 in tmcsimulator-scriptbuilder for trunk/src/event/editor/AudioPanel.java


Ignore:
Timestamp:
10/23/2017 08:58:34 AM (9 years ago)
Author:
bmcguffin
Message:

Changed implementation of save function for event editor panels. Instead of updating their model objects whenever the enter key is pressed, panels are now notified when the window is closed and update their information then.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/event/editor/AudioPanel.java

    r92 r130  
    2323    { 
    2424        initComponents(); 
    25  
    2625    } 
    2726 
     
    3231        audioFileText.setText(event.audioPath); 
    3332        audioLengthText.setText(event.audioLength.toString()); 
    34         audioFileText.addKeyListener(new KeyListener() 
    35         { 
    36  
    37             public void keyTyped(KeyEvent e) 
    38             { 
    39             } 
    40  
    41             public void keyPressed(KeyEvent e) 
    42             { 
    43                 if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    44                 { 
    45                     event.audioPath = audioFileText.getText(); 
    46                 } 
    47             } 
    48  
    49             public void keyReleased(KeyEvent e) 
    50             { 
    51             } 
    52         }); 
    53         audioLengthText.addKeyListener(new KeyListener() 
    54         { 
    55  
    56             public void keyTyped(KeyEvent e) 
    57             { 
    58             } 
    59  
    60             public void keyPressed(KeyEvent e) 
    61             { 
    62                 if (e.getKeyCode() == KeyEvent.VK_ENTER) 
    63                 { 
    64                     try 
    65                     { 
    66                         event.audioLength = Integer.parseInt(audioLengthText.getText()); 
    67                     } 
    68                     catch (Exception ex) 
    69                     { 
    70  
    71                     } 
    72                 } 
    73             } 
    74  
    75             public void keyReleased(KeyEvent e) 
    76             { 
    77             } 
    78         } 
    79         ); 
    8033    } 
    8134 
     
    8538        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
    8639    } 
    87      
     40 
    8841    @Override 
    8942    public boolean removeAssociatedEvent() 
     
    9245        event = null; 
    9346        return true; 
     47    } 
     48 
     49    @Override 
     50    public void uponClose() 
     51    { 
     52        event.audioPath = audioFileText.getText(); 
     53        try 
     54        { 
     55            event.audioLength = Integer.parseInt(audioLengthText.getText()); 
     56        } 
     57        catch (Exception ex) 
     58        { 
     59 
     60        } 
    9461    } 
    9562 
Note: See TracChangeset for help on using the changeset viewer.