/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/LSConsoleFrame.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/fantasia/LSConsoleFrame.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2145 by iliev, Sat Mar 14 20:44:58 2009 UTC revision 2146 by iliev, Mon Oct 11 09:31:27 2010 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com>   *   Copyright (C) 2005-2010 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 22  Line 22 
22    
23  package org.jsampler.view.fantasia;  package org.jsampler.view.fantasia;
24    
 import java.awt.Dimension;  
 import java.awt.Rectangle;  
   
25  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
26  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
 import java.awt.event.WindowAdapter;  
 import java.awt.event.WindowEvent;  
27    
 import javax.swing.JFrame;  
28  import javax.swing.JMenu;  import javax.swing.JMenu;
29  import javax.swing.JMenuBar;  import javax.swing.JMenuBar;
30  import javax.swing.JMenuItem;  import javax.swing.JMenuItem;
31    
32  import org.jsampler.CC;  import org.jsampler.CC;
33    import org.jsampler.view.std.JSFrame;
34  import org.jsampler.view.std.JSLscpScriptDlg;  import org.jsampler.view.std.JSLscpScriptDlg;
 import org.jsampler.view.std.StdUtils;  
35    
36  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
 import static org.jsampler.view.fantasia.FantasiaPrefs.preferences;  
37    
38  /**  /**
39   *   *
40   * @author Grigor Iliev   * @author Grigor Iliev
41   */   */
42  public class LSConsoleFrame extends JFrame {  public class LSConsoleFrame extends JSFrame {
43          private final JMenuBar menuBar = new JMenuBar();          private final JMenuBar menuBar = new JMenuBar();
44          private final LSConsolePane lsConsolePane = new LSConsolePane(this);          private final LSConsolePane lsConsolePane = new LSConsolePane(this);
45                    
# Line 55  public class LSConsoleFrame extends JFra Line 48  public class LSConsoleFrame extends JFra
48           */           */
49          public          public
50          LSConsoleFrame() {          LSConsoleFrame() {
51                  setTitle(i18n.getLabel("LSConsoleFrame.title"));                  super(i18n.getLabel("LSConsoleFrame.title"), "LSConsoleFrame");
52                  if(Res.iconAppIcon != null) setIconImage(Res.iconLSConsole.getImage());                  if(Res.iconAppIcon != null) setIconImage(Res.iconLSConsole.getImage());
53                                    
54                  add(lsConsolePane);                  add(lsConsolePane);
55                  addMenu();                  addMenu();
56                  pack();                  pack();
                 setSavedSize();  
                   
                 addWindowListener(new WindowAdapter() {  
                         public void  
                         windowClosing(WindowEvent we) { onWindowClose(); }  
                 });  
57          }          }
58                    
59          private void          private void
# Line 139  public class LSConsoleFrame extends JFra Line 126  public class LSConsoleFrame extends JFra
126                  }                  }
127          }          }
128                    
         /** Invoked when this window is about to close. */  
         private void  
         onWindowClose() {  
                 boolean b = (getExtendedState() & MAXIMIZED_BOTH) == MAXIMIZED_BOTH;  
                 preferences().setBoolProperty("LSConsoleFrame.windowMaximized", b);  
                 if(b) return;  
                   
                 StdUtils.saveWindowBounds("LSConsoleFrame", getBounds());  
         }  
           
         private void  
         setDefaultSize() {  
                 Dimension dimension = java.awt.Toolkit.getDefaultToolkit().getScreenSize();  
                 double width = dimension.getWidth();  
                 double height = dimension.getHeight();  
                 setBounds(100, 100, (int) width - 200, (int) height - 200);  
         }  
           
         private void  
         setSavedSize() {  
                 Rectangle r = StdUtils.getWindowBounds("LSConsoleFrame");  
                 if(r == null) {  
                         setDefaultSize();  
                         return;  
                 }  
                   
                 setBounds(r);  
         }  
           
         @Override  
         public void  
         setVisible(boolean b) {  
                 if(b == isVisible()) return;  
                   
                 super.setVisible(b);  
                   
                 if(b && preferences().getBoolProperty("LSConsoleFrame.windowMaximized")) {  
                         setExtendedState(getExtendedState() | MAXIMIZED_BOTH);  
                 }  
         }  
           
129          protected LSConsolePane          protected LSConsolePane
130          getLSConsolePane() { return lsConsolePane; }          getLSConsolePane() { return lsConsolePane; }
131  }  }

Legend:
Removed from v.2145  
changed lines
  Added in v.2146

  ViewVC Help
Powered by ViewVC