Package com.reportmill.panels
Class UIUtils
- java.lang.Object
- 
- com.reportmill.panels.UIUtils
 
- 
 public class UIUtils extends java.lang.ObjectA utility class for UI related needs.
- 
- 
Constructor SummaryConstructors Constructor Description UIUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddragImage(java.awt.Image anImage, java.lang.String aString, java.lang.Object aSource, java.util.List events)Initiates Drag and Drop for the given image with the list of mouse events.static voiddragString(java.lang.String aString, java.util.List events)Drags a String from any component, given a MouseEvent and the string.static java.lang.Stringformat(float value)Returns the given float value as a simple formatted string.static java.lang.StringgetString(java.awt.datatransfer.Transferable aTrans)Returns a string from given transferable.static voidopenFile(java.lang.String aName)Tries to open the given file name with the platform reader.static voidopenURL(java.lang.String aName)Tries to open the given URL with the platform reader.static java.lang.StringshowChooser(boolean save, java.awt.Component aComp, java.lang.String aDesc, java.lang.Object oneOrMoreExtensions)Runs a file chooser that remembers last open file and size.static java.lang.StringshowChooser(boolean save, java.awt.Component aComp, java.lang.String aDesc, java.lang.Object oneOrMoreExtensions, java.lang.Class chooserClass)Runs a file chooser that remembers last open file and size.static voidshowPopupMenu(javax.swing.JPopupMenu aMenu, java.awt.Component anOwner, int targetX, int targetY)Show a popup menu at the given coords, adjusting if necessary to ensure that full menu appears within screen bounds.static voidtranslateRectToDropDestination(RMRect dragShapeBounds, RMPoint overShapePt)Set the origin of the rect to match the image being dragged around.
 
- 
- 
- 
Method Detail- 
formatpublic static java.lang.String format(float value) Returns the given float value as a simple formatted string.
 - 
openFilepublic static void openFile(java.lang.String aName) Tries to open the given file name with the platform reader.
 - 
openURLpublic static void openURL(java.lang.String aName) Tries to open the given URL with the platform reader.
 - 
showChooserpublic static java.lang.String showChooser(boolean save, java.awt.Component aComp, java.lang.String aDesc, java.lang.Object oneOrMoreExtensions)Runs a file chooser that remembers last open file and size.
 - 
showChooserpublic static java.lang.String showChooser(boolean save, java.awt.Component aComp, java.lang.String aDesc, java.lang.Object oneOrMoreExtensions, java.lang.Class chooserClass)Runs a file chooser that remembers last open file and size.- Parameters:
- save- true if you intend to store into the resulting file, false otherwise
- aComp- a swing component that will go modal
- aDesc- a description of the file(s) you are filtering for
- oneOrMoreExtensions- a String or array of string with acceptable file extension(s)
- chooserClass- an optional subclass of JFileChooser (you can pass null for JFileChooser)
- Returns:
- the selected path if the user chose a valid file (null otherwise)
 
 - 
showPopupMenupublic static void showPopupMenu(javax.swing.JPopupMenu aMenu, java.awt.Component anOwner, int targetX, int targetY)Show a popup menu at the given coords, adjusting if necessary to ensure that full menu appears within screen bounds.
 - 
getStringpublic static java.lang.String getString(java.awt.datatransfer.Transferable aTrans) Returns a string from given transferable.
 - 
dragStringpublic static void dragString(java.lang.String aString, java.util.List events)Drags a String from any component, given a MouseEvent and the string.
 - 
dragImagepublic static void dragImage(java.awt.Image anImage, java.lang.String aString, java.lang.Object aSource, java.util.List events)Initiates Drag and Drop for the given image with the list of mouse events.
 - 
translateRectToDropDestinationpublic static void translateRectToDropDestination(RMRect dragShapeBounds, RMPoint overShapePt) Set the origin of the rect to match the image being dragged around.Right now this is used to handle the fact that the position of the drag image in relationship to the cursor is different depending on whether the image dragging is being done by the system or by us. It can also be used at some point if we want to make the image dragged from where it was clicked on initially, instead of in the middle (in the system drag case). 
 
- 
 
-