JSampler
v0.8a

org.jsampler
Class HF

java.lang.Object
  extended by org.jsampler.HF

public class HF
extends java.lang.Object

This class contains some helper function.


Constructor Summary
HF()
           
 
Method Summary
static boolean createBackup(java.lang.String file, java.lang.String bkpFile)
          Create a backup copy of the specified file, located in the JSampler's home directory.
static float decibelsToFactor(double vol)
          Converts the volume value specified in decibels to volume factor.
static int decibelsToPercents(double vol)
          Converts the volume value specified in decibels to percents.
static void deleteFile(java.lang.String file)
          Deletes the specified file, if exists and is located in the JSampler's home directory.
static java.lang.String getErrorMessage(java.lang.Exception e)
          Returns more meaningful, non-null message.
static double percentsToDecibels(int vol)
          Converts the volume value specified in percents to decibels.
static float percentsToFactor(int vol)
          Converts the volume value specified in percents to volume factor.
static void setUIDefaultFont(java.lang.String fontName)
          Sets the default font to be used in the GUI.
static void showErrorMessage(java.lang.Exception e)
          Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.
static void showErrorMessage(java.lang.Exception e, java.awt.Dialog dlg)
          Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.
static void showErrorMessage(java.lang.Exception e, java.awt.Frame frame)
          Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.
static void showErrorMessage(java.lang.Exception e, java.awt.Frame frame, java.lang.String prefix)
          Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.
static void showErrorMessage(java.lang.Exception e, java.lang.String prefix)
          Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.
static void showErrorMessage(java.lang.String msg)
          Shows a dialog with the specified error message.
static void showErrorMessage(java.lang.String msg, java.awt.Dialog dlg)
          Shows a dialog with the specified error message.
static void showErrorMessage(java.lang.String msg, java.awt.Frame frame)
          Shows a dialog with the specified error message.
static boolean showYesNoDialog(java.awt.Component parent, java.lang.String message)
          Brings up a question dialog with Yes, No options, empty title and the specified message.
static boolean showYesNoDialog(java.awt.Component parent, java.lang.String message, java.lang.String title)
          Brings up a question dialog with Yes, No options, empty title and the specified message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HF

public HF()
Method Detail

getErrorMessage

public static java.lang.String getErrorMessage(java.lang.Exception e)
Returns more meaningful, non-null message.

Returns:
More meaningful, non-null message.

showErrorMessage

public static void showErrorMessage(java.lang.String msg)
Shows a dialog with the specified error message.

Parameters:
msg - The error message to be shown.

showErrorMessage

public static void showErrorMessage(java.lang.String msg,
                                    java.awt.Frame frame)
Shows a dialog with the specified error message.

Parameters:
frame - The parent Frame for the dialog.
msg - The error message to be shown.

showErrorMessage

public static void showErrorMessage(java.lang.String msg,
                                    java.awt.Dialog dlg)
Shows a dialog with the specified error message.

Parameters:
dlg - The parent Dialog from which the dialog is displayed.
msg - The error message to be shown.

showErrorMessage

public static void showErrorMessage(java.lang.Exception e)
Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.

Parameters:
e - The Exception from which the error message is obtained.

showErrorMessage

public static void showErrorMessage(java.lang.Exception e,
                                    java.lang.String prefix)
Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.

Parameters:
e - The Exception from which the error message is obtained.
prefix - The prefix to be added to the error message.

showErrorMessage

public static void showErrorMessage(java.lang.Exception e,
                                    java.awt.Frame frame)
Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.

Parameters:
e - The Exception from which the error message is obtained.
frame - The parent Frame for the dialog.

showErrorMessage

public static void showErrorMessage(java.lang.Exception e,
                                    java.awt.Frame frame,
                                    java.lang.String prefix)
Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.

Parameters:
e - The Exception from which the error message is obtained.
frame - The parent Frame for the dialog.
prefix - The prefix to be added to the error message.

showErrorMessage

public static void showErrorMessage(java.lang.Exception e,
                                    java.awt.Dialog dlg)
Shows a dialog with error message obtained by getErrorMessage(java.lang.Exception) method.

Parameters:
e - The Exception from which the error message is obtained.
dlg - The parent Dialog from which the dialog is displayed.

showYesNoDialog

public static boolean showYesNoDialog(java.awt.Component parent,
                                      java.lang.String message)
Brings up a question dialog with Yes, No options, empty title and the specified message.

Parameters:
parent - The parent Component for the dialog.
message - The message to display.
Returns:
true if the user chooses "yes", false otherwise.

showYesNoDialog

public static boolean showYesNoDialog(java.awt.Component parent,
                                      java.lang.String message,
                                      java.lang.String title)
Brings up a question dialog with Yes, No options, empty title and the specified message.

Parameters:
parent - The parent Component for the dialog.
message - The message to display.
title - The dialog's title.
Returns:
true if the user chooses "yes", false otherwise.

setUIDefaultFont

public static void setUIDefaultFont(java.lang.String fontName)
Sets the default font to be used in the GUI.

Parameters:
fontName - The name of the font to be used as default.

deleteFile

public static void deleteFile(java.lang.String file)
Deletes the specified file, if exists and is located in the JSampler's home directory.

Parameters:
file - The file to delete.

createBackup

public static boolean createBackup(java.lang.String file,
                                   java.lang.String bkpFile)
Create a backup copy of the specified file, located in the JSampler's home directory.

Parameters:
file - The name of the file to backup.
bkpFile - The backup name of the file.
Returns:
true if the file is backuped successfully.

percentsToDecibels

public static double percentsToDecibels(int vol)
Converts the volume value specified in percents to decibels.


decibelsToPercents

public static int decibelsToPercents(double vol)
Converts the volume value specified in decibels to percents.


decibelsToFactor

public static float decibelsToFactor(double vol)
Converts the volume value specified in decibels to volume factor.


percentsToFactor

public static float percentsToFactor(int vol)
Converts the volume value specified in percents to volume factor.


JSampler
v0.8a

Copyright © 2007 Grigor Iliev. All rights reserved.