networking
Class Util

java.lang.Object
  extended by networking.Util

public class Util
extends java.lang.Object


Constructor Summary
Util()
           
 
Method Summary
static java.io.File getFile(java.lang.String fileName)
          Get file object from file name
static java.lang.String getFilePath(java.lang.String fileName)
          Get file path from file name
static int getInt(javax.swing.JTextField tf, java.lang.String who)
          Parse text field
static int getInt(java.awt.TextField tf, java.lang.String who)
          Parse text field
static java.lang.String getLocalHost()
          Get name of the localhost
static java.lang.String getString(javax.swing.JTextField tf, java.lang.String who)
          Ensure that text field is not empty
static java.lang.String getString(java.awt.TextField tf, java.lang.String who)
          Ensure that text field is not empty
static void setCentered(java.awt.Window w)
          Center a window on the screen
static void setCentered(java.awt.Window w, java.awt.Window wBack)
          Center a window relative to the other window
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

getLocalHost

public static java.lang.String getLocalHost()
Get name of the localhost

Returns:
name of the localhost or empty string

getFile

public static java.io.File getFile(java.lang.String fileName)
Get file object from file name

Parameters:
fileName - file name relative to the current user directory
Returns:
file object

getFilePath

public static java.lang.String getFilePath(java.lang.String fileName)
Get file path from file name

Parameters:
fileName - file name relative to the current user directory
Returns:
full file path

setCentered

public static void setCentered(java.awt.Window w)
Center a window on the screen

Parameters:
w - window

setCentered

public static void setCentered(java.awt.Window w,
                               java.awt.Window wBack)
Center a window relative to the other window

Parameters:
w - front window
wBack - back window

getString

public static java.lang.String getString(java.awt.TextField tf,
                                         java.lang.String who)
                                  throws java.lang.Exception
Ensure that text field is not empty

Parameters:
tf - text field
who - name of control
Returns:
not empty contents
Throws:
java.lang.Exception

getInt

public static int getInt(java.awt.TextField tf,
                         java.lang.String who)
                  throws java.lang.Exception
Parse text field

Parameters:
tf - text field
who - name of control
Returns:
parsed integer
Throws:
java.lang.Exception

getString

public static java.lang.String getString(javax.swing.JTextField tf,
                                         java.lang.String who)
                                  throws java.lang.Exception
Ensure that text field is not empty

Parameters:
tf - text field
who - name of control
Returns:
not empty contents
Throws:
java.lang.Exception

getInt

public static int getInt(javax.swing.JTextField tf,
                         java.lang.String who)
                  throws java.lang.Exception
Parse text field

Parameters:
tf - text field
who - name of control
Returns:
parsed integer
Throws:
java.lang.Exception


Copyright © 2009 Alexey Veremenko. All rights reserved.