gradeview.util
Class Misc

java.lang.Object
  |
  +--gradeview.util.Misc

public class Misc
extends java.lang.Object

A set of miscellaneous, non-class specific functions which are used throughout GradeView. Note, an object of type Misc should never be created. All of Misc's functions/methods are static, meaning that they can be called upon directly. For example, if we wanted to print the contents of a HashMap using Misc's printHashMap() function, we could use the following code:

// myHashMap is a predefined instance of java.util.HashMap.
Misc.printHashMap( myHashMap );


Constructor Summary
Misc()
           
 
Method Summary
static java.util.HashMap buildHashMap(java.lang.String parseMe)
          Builds a new HashMap based on the contents of a given string.
static javax.swing.JPanel makePanel()
          Makes a JPanel according to GradeView defaults (i.e., foreground color, background color, etc.
static javax.swing.JLabel makeSmallLabel(java.lang.String withString)
          Creates a JLabel in a small font and a GradeView-default color.
static javax.swing.JLabel makeSmallLabel(java.lang.String withString, java.awt.GridBagLayout gridbag, java.awt.GridBagConstraints c)
          Creates a JLabel in a small font.
static void printHashMap(java.util.HashMap printMe)
          Prints the contents of a HashMap to the system console.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Misc

public Misc()
Method Detail

makeSmallLabel

public static javax.swing.JLabel makeSmallLabel(java.lang.String withString)
Creates a JLabel in a small font and a GradeView-default color.
Parameters:
withString - The new label's textual contents.
Returns:
A new, ready-to-use JLabel.
See Also:
makeSmallLabel(String, GridBagLayout, GridBagConstraints)

makeSmallLabel

public static javax.swing.JLabel makeSmallLabel(java.lang.String withString,
                                                java.awt.GridBagLayout gridbag,
                                                java.awt.GridBagConstraints c)
Creates a JLabel in a small font. It will then call a GridBagLayout's setConstraints() method with the new JLabel and the specified GridBagConstraints.
Parameters:
withString - The new label's textual contents.
gridbag - The GridBagLayout to call setConstraints() on.
c - The GridBagConstraints that will be passed to gridbag.setConstraints(), along with the new label.
Returns:
A new, ready-to-use JLabel.
See Also:
makeSmallLabel(String), GridBagLayout, GridBagConstraints

makePanel

public static javax.swing.JPanel makePanel()
Makes a JPanel according to GradeView defaults (i.e., foreground color, background color, etc.
Returns:
JPanel A new, ready-to-use JPanel.

buildHashMap

public static java.util.HashMap buildHashMap(java.lang.String parseMe)
Builds a new HashMap based on the contents of a given string. The string is parsed as such; Each entry in the HashMap is separated by a comma (,) and each pair is separated by a single equal sign (=). For example:

HashMap myHashMap = Misc.buildHashMap( "first=one,second=two,third=three" );

This code would build a hashmap with the following keys and values:

Parameters:
parseMe - The string to be parsed/converted into a HashMap.
Returns:
A new HashMap with contents based on buildHashMap()'s parameter.
See Also:
HashMap

printHashMap

public static void printHashMap(java.util.HashMap printMe)
Prints the contents of a HashMap to the system console.
Parameters:
printMe - The HashMap whose contents should be printed to the system console.