Changeset 2506


Ignore:
Timestamp:
03/23/07 10:20:22 (13 years ago)
Author:
curtis
Message:

Clean up dependencies for loci.visbio.util package.

Location:
trunk/loci/visbio
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/ExitManager.java

    r1989 r2506  
    2626import com.jgoodies.plaf.LookUtils; 
    2727import java.awt.event.*; 
    28 import loci.visbio.util.SwingUtil; 
    2928 
    3029/** ExitManager is the manager encapsulating VisBio's shutdown logic. */ 
     
    7473      bio.addMenuSeparator("File"); 
    7574      bio.addMenuItem("File", "Exit", "loci.visbio.ExitManager.fileExit", 'x'); 
    76       SwingUtil.setMenuShortcut(bio, "File", "Exit", KeyEvent.VK_Q); 
     75      bio.setMenuShortcut("File", "Exit", KeyEvent.VK_Q); 
    7776    } 
    7877  } 
  • trunk/loci/visbio/data/DataManager.java

    r2499 r2506  
    3636import loci.visbio.help.HelpManager; 
    3737import loci.visbio.state.*; 
    38 import loci.visbio.util.SwingUtil; 
    3938import loci.visbio.util.XMLUtil; 
    4039import org.w3c.dom.Element; 
     
    462461    bio.addMenuItem("File", "Import data...", 
    463462      "loci.visbio.data.DataManager.importData", 'i'); 
    464     SwingUtil.setMenuShortcut(bio, "File", "Import data...", KeyEvent.VK_O); 
     463    bio.setMenuShortcut("File", "Import data...", KeyEvent.VK_O); 
    465464    bio.addMenuItem("File", "Export data...", 
    466465      "loci.visbio.data.DataManager.exportData", 'e').setEnabled(false); 
    467     SwingUtil.setMenuShortcut(bio, "File", "Export data...", KeyEvent.VK_X); 
     466    bio.setMenuShortcut("File", "Export data...", KeyEvent.VK_X); 
    468467    bio.addSubMenu("File", "Sample datasets", 'd'); 
    469468    bio.addMenuItem("Sample datasets", "sdub", 
  • trunk/loci/visbio/help/HelpManager.java

    r1989 r2506  
    3434import loci.visbio.state.*; 
    3535import loci.visbio.util.*; 
     36import visad.util.GUIFrame; 
    3637 
    3738/** HelpManager is the manager encapsulating VisBio's help window logic. */ 
     
    159160      "loci.visbio.help.HelpManager.helpHelp", 'h'); 
    160161    KeyStroke helpStroke = LookUtils.IS_OS_MAC ? KeyStroke.getKeyStroke( 
    161       new Character('?'), SwingUtil.MENU_MASK) : 
     162      new Character('?'), GUIFrame.MENU_MASK) : 
    162163      KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0); 
    163164    help.setAccelerator(helpStroke); 
     
    167168      bio.addMenuItem("Help", "About", 
    168169        "loci.visbio.help.HelpManager.helpAbout", 'a'); 
    169       SwingUtil.setMenuShortcut(bio, "Help", "About", KeyEvent.VK_A); 
     170      bio.setMenuShortcut("Help", "About", KeyEvent.VK_A); 
    170171    } 
    171172 
  • trunk/loci/visbio/state/OptionManager.java

    r1989 r2506  
    213213          bio.addMenuItem("File", "Options...", 
    214214            "loci.visbio.state.OptionManager.fileOptions", 'o'); 
    215           SwingUtil.setMenuShortcut(bio, "File", "Options...", KeyEvent.VK_P); 
     215          bio.setMenuShortcut("File", "Options...", KeyEvent.VK_P); 
    216216        } 
    217217      } 
  • trunk/loci/visbio/state/StateManager.java

    r1989 r2506  
    3030import loci.formats.ExtensionFileFilter; 
    3131import loci.visbio.*; 
    32 import loci.visbio.util.SwingUtil; 
    3332import loci.visbio.util.XMLUtil; 
    3433import org.w3c.dom.Document; 
     
    291290    editUndo = bio.addMenuItem("Edit", "Undo", 
    292291      "loci.visbio.state.StateManager.editUndo", 'u'); 
    293     SwingUtil.setMenuShortcut(bio, "Edit", "Undo", KeyEvent.VK_Z); 
     292    bio.setMenuShortcut("Edit", "Undo", KeyEvent.VK_Z); 
    294293    editRedo = bio.addMenuItem("Edit", "Redo", 
    295294      "loci.visbio.state.StateManager.editRedo", 'r'); 
    296     SwingUtil.setMenuShortcut(bio, "Edit", "Redo", KeyEvent.VK_Y); 
     295    bio.setMenuShortcut("Edit", "Redo", KeyEvent.VK_Y); 
    297296    JMenuItem editReset = bio.addMenuItem("Edit", "Reset", 
    298297      "loci.visbio.state.StateManager.editReset", 't'); 
    299     SwingUtil.setMenuShortcut(bio, "Edit", "Reset", KeyEvent.VK_R); 
     298    bio.setMenuShortcut("Edit", "Reset", KeyEvent.VK_R); 
    300299 
    301300    // undo logic variables 
  • trunk/loci/visbio/util/DialogPane.java

    r1989 r2506  
    3232import java.awt.event.ActionListener; 
    3333import javax.swing.*; 
    34 import visad.util.Util; 
    3534 
    3635/** 
     
    167166    dialog.pack(); 
    168167    Window owner = dialog.getOwner(); 
    169     if (owner == null) Util.centerWindow(dialog); 
    170     else Util.centerWindow(owner, dialog); 
     168    if (owner == null) SwingUtil.centerWindow(dialog); 
     169    else SwingUtil.centerWindow(owner, dialog); 
    171170    rval = CANCEL_OPTION; 
    172171    dialog.setVisible(true); 
  • trunk/loci/visbio/util/FontChooserPane.java

    r1989 r2506  
    8585   */ 
    8686  public FontChooserPane(Font font, String preview) { 
    87     super("VisBio Font Chooser", true); 
     87    super("Font Chooser", true); 
    8888 
    8989    GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); 
  • trunk/loci/visbio/util/OutputConsole.java

    r1989 r2506  
    3131import javax.swing.text.BadLocationException; 
    3232import javax.swing.text.Document; 
    33 import visad.util.Util; 
    3433 
    3534/** 
     
    150149//    lastInvalid = false; 
    151150 
    152     Util.invoke(false, new Runnable() { 
     151    SwingUtilities.invokeLater(new Runnable() { 
    153152      public void run() { 
    154153        try { 
  • trunk/loci/visbio/util/SplashScreen.java

    r1989 r2506  
    3131import javax.swing.*; 
    3232import javax.swing.border.LineBorder; 
    33 import visad.util.Util; 
    3433 
    3534/** An application splash screen. */ 
     
    8887    setContentPane(pane); 
    8988    pack(); 
    90     Util.centerWindow(this); 
     89    SwingUtil.centerWindow(this); 
    9190  } 
    9291 
  • trunk/loci/visbio/util/SwingUtil.java

    r1989 r2506  
    3737import javax.swing.tree.TreePath; 
    3838import loci.formats.ImageReader; 
    39 import visad.util.GUIFrame; 
    4039 
    4140/** SwingUtil contains useful Swing functions. */ 
     
    161160  } 
    162161 
     162  /** Centers the given window on the screen. */ 
     163  public static void centerWindow(Window window) { 
     164    Dimension s = Toolkit.getDefaultToolkit().getScreenSize(); 
     165    centerWindow(new Rectangle(0, 0, s.width, s.height), window); 
     166  } 
     167 
     168  /** Centers the given window within the specified parent window. */ 
     169  public static void centerWindow(Window parent, Window window) { 
     170    centerWindow(parent.getBounds(), window); 
     171  } 
     172 
     173  /** Centers the given window within the specified bounds. */ 
     174  public static void centerWindow(Rectangle bounds, Window window) { 
     175    Dimension w = window.getSize(); 
     176    int x = bounds.x + (bounds.width - w.width) / 2; 
     177    int y = bounds.y + (bounds.height - w.height) / 2; 
     178    if (x < 0) x = 0; 
     179    if (y < 0) y = 0; 
     180    window.setLocation(x, y); 
     181  } 
     182 
    163183  /** Sets the title of the given window. */ 
    164184  public static void setWindowTitle(Window w, String title) { 
     
    173193    else if (w instanceof Dialog) return ((Dialog) w).getTitle(); 
    174194    else return w.getName(); 
    175   } 
    176  
    177   /** Key mask for use with keyboard shortcuts on this operating system. */ 
    178   public static final int MENU_MASK = 
    179     Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); 
    180  
    181   /** Sets the keyboard shortcut for the given menu item. */ 
    182   public static void setMenuShortcut(GUIFrame frame, 
    183     String menu, String item, int keycode) 
    184   { 
    185     JMenuItem jmi = frame.getMenuItem(menu, item); 
    186     if (jmi == null) return; 
    187     jmi.setAccelerator(KeyStroke.getKeyStroke(keycode, MENU_MASK)); 
    188195  } 
    189196 
Note: See TracChangeset for help on using the changeset viewer.