org.openjump.core.ui.swing
Class DialogTools

java.lang.Object
  extended by org.openjump.core.apitools.ToolToMakeYourLifeEasier
      extended by org.openjump.core.ui.swing.DialogTools

public class DialogTools
extends ToolToMakeYourLifeEasier

Since:
1.2: changed by Stefan Ostermann at 2005-04-26: added method to return localized string of a double value.,
1.3 changed by Carsten Schulze at 2005-05-22: added a method to center a given AWT-Window (or subclasses) on the screen.
Version:
$Rev: 1245 $
Author:
Ole Rahn, Stefan Ostermann, Carsten Schulze

FH Osnabrück - University of Applied Sciences Osnabrück
Project PIROL 2005
Daten- und Wissensmanagement

Constructor Summary
DialogTools()
           
 
Method Summary
static void centerOnScreen(java.awt.Window window)
          This method centers the window (or subclasses of it) on the screen.
static void centerOnWindow(java.awt.Component component)
           
static void centerOnWindow(java.awt.Component component2move, java.awt.Component component2CenterOn)
           
static javax.swing.JPanel getPanelWithLabels(java.lang.String text, int charsPerLine)
          This method creates a JPanel with several JLabels on it.
static double localNumberStringToDouble(java.lang.String s)
          This method replaces the localized decimal seperator with a dot.
static java.lang.String numberStringToLocalNumberString(java.lang.String s)
          This method replaces the dot with the localized decimal seperator.
static java.lang.String numberToLocalNumberString(double number)
          This method replaces the dot with the localized decimal seperator.
static void setMaximumHeight(javax.swing.JComponent component, int height)
           
static void setMaximumWidth(javax.swing.JComponent component, int width)
           
static void setPreferedHeight(javax.swing.JComponent component, int height)
          Sets the prefered height of an JComponent and keeps it prefered height.
static void setPreferedWidth(javax.swing.JComponent component, int width)
          Sets the prefered width of an JComponent and keeps it prefered height.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialogTools

public DialogTools()
Method Detail

centerOnScreen

public static void centerOnScreen(java.awt.Window window)
This method centers the window (or subclasses of it) on the screen.

Parameters:
window - the java.awt.Window (or a subclass of it) that should be displayed in the middle of the screen.

centerOnWindow

public static void centerOnWindow(java.awt.Component component)

centerOnWindow

public static void centerOnWindow(java.awt.Component component2move,
                                  java.awt.Component component2CenterOn)

getPanelWithLabels

public static javax.swing.JPanel getPanelWithLabels(java.lang.String text,
                                                    int charsPerLine)
This method creates a JPanel with several JLabels on it. For another method to display multiline bold text, have a look at the {javax.swing.JTextArea} and the Font object.

Parameters:
text - the text to split up into some JLabels.
charsPerLine - the maximum number of characters per line text.
Returns:
the panel with the labels on it.

localNumberStringToDouble

public static double localNumberStringToDouble(java.lang.String s)
This method replaces the localized decimal seperator with a dot.

Parameters:
s - the String containing the double value.
Returns:
the now dotted double value.
See Also:
numberStringToLocalNumberString(String), numberToLocalNumberString(double)

numberStringToLocalNumberString

public static java.lang.String numberStringToLocalNumberString(java.lang.String s)
This method replaces the dot with the localized decimal seperator.

Parameters:
s - the String containing the double value.
Returns:
the localized String containing the double value.
See Also:
localNumberStringToDouble(String), numberToLocalNumberString(double)

numberToLocalNumberString

public static java.lang.String numberToLocalNumberString(double number)
This method replaces the dot with the localized decimal seperator.

Parameters:
number - the double value.
Returns:
the localized String containing the double value.
See Also:
numberStringToLocalNumberString(String), localNumberStringToDouble(String)

setPreferedWidth

public static void setPreferedWidth(javax.swing.JComponent component,
                                    int width)
Sets the prefered width of an JComponent and keeps it prefered height.

Parameters:
component - the component to alter
width - the new prefered width

setPreferedHeight

public static void setPreferedHeight(javax.swing.JComponent component,
                                     int height)
Sets the prefered height of an JComponent and keeps it prefered height.

Parameters:
component - the component to alter
height - the new prefered width

setMaximumWidth

public static void setMaximumWidth(javax.swing.JComponent component,
                                   int width)

setMaximumHeight

public static void setMaximumHeight(javax.swing.JComponent component,
                                    int height)