JAligner

jaligner.ui.util
Class TextComponentUtil

java.lang.Object
  extended byjaligner.ui.util.TextComponentUtil

public class TextComponentUtil
extends java.lang.Object

Text component (e.g. JTextAreaor JTextPane) editing helper class.

Author:
Ahmed Moustafa (ahmed@users.sf.net)

Constructor Summary
TextComponentUtil()
           
 
Method Summary
static void copy(javax.swing.text.JTextComponent textComponent)
          Copies the selected text to the system clipboard.
static void cut(javax.swing.text.JTextComponent textComponent)
          Copies the selected text to the system clipboad and then deletes it from the text component.
static void delete(javax.swing.text.JTextComponent textComponent)
          Deletes the selected text in a text component.
static boolean open(javax.swing.text.JTextComponent textComponent)
          Opens a file and puts the contents of the file in a text component.
static void paste(javax.swing.text.JTextComponent textComponent)
          Copies the text contents of the system clipboard to the text component.
static void print(javax.swing.text.JTextComponent textComponent)
          Prints the contents of a text component.
static boolean save(javax.swing.text.JTextComponent textComponent)
          Saves the contents of a text component to a file.
static boolean save(javax.swing.text.JTextComponent textComponent, java.lang.String fileName)
          Saves the contents of a text component to a file.
static void selectAll(javax.swing.text.JTextComponent textComponent)
          Selects all contents of a text component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextComponentUtil

public TextComponentUtil()
Method Detail

cut

public static void cut(javax.swing.text.JTextComponent textComponent)
Copies the selected text to the system clipboad and then deletes it from the text component.

Parameters:
textComponent -

copy

public static void copy(javax.swing.text.JTextComponent textComponent)
Copies the selected text to the system clipboard.

Parameters:
textComponent -

paste

public static void paste(javax.swing.text.JTextComponent textComponent)
Copies the text contents of the system clipboard to the text component.

Parameters:
textComponent -

delete

public static void delete(javax.swing.text.JTextComponent textComponent)
Deletes the selected text in a text component.

Parameters:
textComponent -

selectAll

public static void selectAll(javax.swing.text.JTextComponent textComponent)
Selects all contents of a text component.

Parameters:
textComponent -

open

public static boolean open(javax.swing.text.JTextComponent textComponent)
                    throws TextComponentUtilException
Opens a file and puts the contents of the file in a text component.

Parameters:
textComponent -
Throws:
TextComponentUtilException

save

public static boolean save(javax.swing.text.JTextComponent textComponent,
                           java.lang.String fileName)
                    throws TextComponentUtilException
Saves the contents of a text component to a file.

Parameters:
textComponent -
fileName -
Returns:
true if a file has been chosen or false otherwise
Throws:
TextComponentUtilException

save

public static boolean save(javax.swing.text.JTextComponent textComponent)
                    throws TextComponentUtilException
Saves the contents of a text component to a file.

Parameters:
textComponent -
Returns:
true if a file has been chosen or false otherwise
Throws:
TextComponentUtilException

print

public static void print(javax.swing.text.JTextComponent textComponent)
                  throws TextComponentUtilException
Prints the contents of a text component.

Parameters:
textComponent -
Throws:
TextComponentUtilException

JAligner

Ahmed Moustafa (ahmed@users.sf.net)SourceForge.net
The source code of JAligner is licensed under The GNU General Public License (GPL)