Changeset 61 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java


Ignore:
Timestamp:
08/19/2017 04:42:55 AM (9 years ago)
Author:
bmcguffin
Message:

Made a few cosmetic changes to the code. Added a statement in the update method of IncidentEditorFrame? which tries to set the maximum scale of the zoom slider at an appropriate level.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java

    r55 r61  
    88import java.awt.Adjustable; 
    99import java.awt.Color; 
    10 import java.awt.Cursor; 
    1110import java.awt.event.AdjustmentEvent; 
    1211import java.awt.event.AdjustmentListener; 
     
    1514import java.io.File; 
    1615import java.io.IOException; 
    17 import java.util.ArrayList; 
    1816import java.util.Observable; 
    1917import java.util.Observer; 
     
    2321import java.util.logging.Logger; 
    2422import javax.swing.DefaultListModel; 
    25 import javax.swing.JButton; 
    2623import javax.swing.JFileChooser; 
    2724import javax.swing.JOptionPane; 
     
    15851582        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) 
    15861583        { 
     1584            script = new SimulationScript(); 
    15871585            System.out.println(fc.getSelectedFile().getName()); 
    15881586            script.loadScriptFromFile(fc.getSelectedFile()); 
    15891587            script.saveFile = fc.getSelectedFile(); 
    15901588        } 
     1589        update(script, script); 
    15911590        zoomSlider.setValue(zoomSlider.getMinimum()); 
    1592         update(script, script); 
     1591        repaint(); 
    15931592    }//GEN-LAST:event_fileOpenActionPerformed 
    15941593 
     
    18761875    private void fileNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileNewActionPerformed 
    18771876    {//GEN-HEADEREND:event_fileNewActionPerformed 
    1878         System.out.println("NEW SCRIPT"); 
    18791877        script = new SimulationScript(); 
    18801878        script.update(); 
     
    18971895                script.incidents.get(0)); 
    18981896 
    1899         System.out.println("RESULT = " + result.toString()); 
    1900  
    1901         input = result.toString(); 
    1902  
    1903         System.out.println("INPUT = " + input); 
    1904  
    1905         int i = 0; 
    1906         for (ScriptIncident incident : script.incidents) 
    1907         { 
    1908             if (incident == null) 
    1909             { 
    1910                 continue; 
    1911             } 
    1912             System.out.println((++i) + ": " + incident.toString()); 
    1913             if (incident.toString().equals(input)) 
    1914             { 
    1915                 inc = incident; 
    1916             } 
    1917         } 
    1918  
    1919         if (inc != null) 
    1920         { 
    1921             new IncidentEditorFrame(inc).setVisible(true); 
     1897        if (result != null) 
     1898        { 
     1899            System.out.println("RESULT = " + result.toString()); 
     1900 
     1901            input = result.toString(); 
     1902 
     1903            System.out.println("INPUT = " + input); 
     1904 
     1905            int i = 0; 
     1906            for (ScriptIncident incident : script.incidents) 
     1907            { 
     1908                if (incident == null) 
     1909                { 
     1910                    continue; 
     1911                } 
     1912                System.out.println((++i) + ": " + incident.toString()); 
     1913                if (incident.toString().equals(input)) 
     1914                { 
     1915                    inc = incident; 
     1916                } 
     1917            } 
     1918 
     1919            if (inc != null) 
     1920            { 
     1921                new IncidentEditorFrame(inc).setVisible(true); 
     1922            } 
    19221923        } 
    19231924        update(script, script); 
Note: See TracChangeset for help on using the changeset viewer.