public final class Utilities
extends java.lang.Object
Constructor and Description |
---|
Utilities()
Constructor
|
Modifier and Type | Method and Description |
---|---|
static void |
adjustTableColumnWidth(javax.swing.JTable table,
java.lang.String... test)
Adjust specified column width based on the width of a test string
|
static void |
editFile(java.lang.String path)
Open the desktop default file editor
|
static void |
fixGtkMenuItemFgColor(javax.swing.JMenuItem... jmi)
Fixes incorrect JMenu selectionForeground highlighting
|
static void |
fixGtkMenuSelectionColor(javax.swing.JMenu... jms)
Fixes incorrect JMenu selectionForeground highlighting
|
static void |
fixGtkTextAreaColor(javax.swing.JTextArea jta) |
static void |
fixGtkThickness(java.lang.Object style,
java.lang.String fieldName)
Called internally by installGtkPopupBugWorkaround to fix the thickness of
a GTK style field by setting it to a minimum value of 1.
|
static java.lang.String |
generateSecretKey(int length)
Generate secret key.
|
static java.lang.Object |
getGtkStyle(java.lang.Object styleFactory,
javax.swing.JComponent component,
java.lang.String regionName)
Called internally by installGtkPopupBugWorkaround.
|
static java.lang.String |
getListAsCSV(java.util.ArrayList<java.lang.String> al)
Covert list to csv
|
static java.lang.String |
getSha1Sum(java.lang.String filepath)
Calculate the sha1 checksum of a given file
|
static java.lang.String |
getSHAHash(java.lang.String password)
Get SHAHash using given password string
|
static java.lang.String |
getTextFromFile(java.lang.String filepath)
Retrieve text from a text file
|
static java.lang.String |
getTextFromResource(java.lang.String resourcepath)
Retrieve text from a resource text file
|
static void |
installGtkPopupBugWorkaround()
Swing menus are looking pretty bad on Linux when the GTK LaF is used (See
bug #6925412).
|
static boolean |
isNewerVersion(java.lang.String localversion,
java.lang.String remoteversion)
Check for newer appversion
|
static void |
loadUIStyle(java.lang.String theme)
Initialises the UI Look and Feel
|
static java.lang.String |
openFileChooser(java.awt.Frame parent,
java.lang.String folder,
javax.swing.filechooser.FileFilter filter,
int mode)
Opens java file chooser dialog, convenience method.
|
static boolean |
openFileExternally(java.lang.String strUrl)
Launch the desktops default file handling program
|
public static java.lang.String getListAsCSV(java.util.ArrayList<java.lang.String> al)
al
- public static java.lang.String openFileChooser(java.awt.Frame parent, java.lang.String folder, javax.swing.filechooser.FileFilter filter, int mode)
parent
- folder
- filter
- Extension filtermode
- Fileselection modepublic static boolean isNewerVersion(java.lang.String localversion, java.lang.String remoteversion)
localversion
- remoteversion
- public static void editFile(java.lang.String path)
path
- Path to filepublic static boolean openFileExternally(java.lang.String strUrl)
strUrl
- public static void loadUIStyle(java.lang.String theme)
theme
- public static void adjustTableColumnWidth(javax.swing.JTable table, java.lang.String... test)
table
- test
- public static java.lang.String generateSecretKey(int length)
length
- public static java.lang.String getSHAHash(java.lang.String password)
password
- public static java.lang.String getTextFromResource(java.lang.String resourcepath)
resourcepath
- public static java.lang.String getTextFromFile(java.lang.String filepath)
filepath
- public static java.lang.String getSha1Sum(java.lang.String filepath)
filepath
- public static void fixGtkMenuSelectionColor(javax.swing.JMenu... jms)
jms
- Array of JMenus or single JMenupublic static void fixGtkMenuItemFgColor(javax.swing.JMenuItem... jmi)
jmi
- Array of JMenuItems or single JMenuItempublic static void fixGtkTextAreaColor(javax.swing.JTextArea jta)
public static void installGtkPopupBugWorkaround()
public static void fixGtkThickness(java.lang.Object style, java.lang.String fieldName) throws java.lang.Exception
style
- The GTK style object.fieldName
- The field name.java.lang.Exception
- When reflection fails.public static java.lang.Object getGtkStyle(java.lang.Object styleFactory, javax.swing.JComponent component, java.lang.String regionName) throws java.lang.Exception
styleFactory
- The GTK style factory.component
- The target component of the style.regionName
- The name of the target region of the style.java.lang.Exception
- When reflection fails. This code was taken from K's
Cluttered Loft (Klaus Reimer) at http://www.ailis.de and as far as im
aware is in the public domain as it has no attached license if this
proves incorrect then I will remove it immediately.