001 /*
002 * LAPIS lightweight structured text processing system
003 *
004 * Copyright (C) 1998-2002 Carnegie Mellon University,
005 * Copyright (C) 2003 Massachusetts Institute of Technology.
006 * All rights reserved.
007 *
008 * This library is free software; you can redistribute it
009 * and/or modify it under the terms of the GNU General
010 * Public License as published by the Free Software
011 * Foundation, version 2.
012 *
013 * LAPIS homepage: http://graphics.lcs.mit.edu/lapis/
014 */
015
016 package lapisx.swing;
017
018 import java.awt.event.*;
019 import javax.swing.text.*;
020
021 public abstract class TextUtil {
022 public static JTextComponent getTextComponent(ActionEvent e) {
023 return duh.getTheTextComponent (e);
024 }
025
026 public static JTextComponent getFocusedTextComponent() {
027 return duh.getTheTextComponent (null);
028 }
029
030 static Duh duh = new Duh ();
031 static class Duh extends TextAction {
032 public Duh () {
033 super ("");
034 }
035 public void actionPerformed (ActionEvent e) {
036 }
037 public JTextComponent getTheTextComponent (ActionEvent e) {
038 return Duh.this.getTextComponent (e);
039 }
040 }
041 }