org.jfree.ui

Class RefineryUtilities


public abstract class RefineryUtilities
extends java.lang.Object

A collection of utility methods relating to user interfaces.
Author:
David Gilbert

Field Summary

protected static LogContext
logger
Access to logging facilities.

Method Summary

static void
centerDialogInParent(Dialog dialog)
Positions the specified dialog within its parent.
static void
centerFrameOnScreen(Window frame)
Positions the specified frame in the middle of the screen.
static JButton
createJButton(String label, Font font)
Creates a JButton.
static JLabel
createJLabel(String text, Font font)
Creates a label with a specific font.
static JLabel
createJLabel(String text, Font font, Color color)
Creates a label with a specific font and color.
static JPanel
createTablePanel(TableModel model)
Creates a panel that contains a table based on the specified table model.
static void
positionDialogRelativeToParent(Dialog dialog, double horizontalPercent, double verticalPercent)
Positions the specified dialog at a position relative to its parent.
static void
positionFrameOnScreen(Window frame, double horizontalPercent, double verticalPercent)
Positions the specified frame at a relative position in the screen, where 50% is considered to be the center of the screen.
static void
positionFrameRandomly(Window frame)
Positions the specified frame at a random location on the screen while ensuring that the entire frame is visible (provided that the frame is smaller than the screen).

Field Details

logger

protected static final LogContext logger
Access to logging facilities.

Method Details

centerDialogInParent

public static void centerDialogInParent(Dialog dialog)
Positions the specified dialog within its parent.
Parameters:
dialog - the dialog to be positioned on the screen.

centerFrameOnScreen

public static void centerFrameOnScreen(Window frame)
Positions the specified frame in the middle of the screen.
Parameters:
frame - the frame to be centered on the screen.

createJButton

public static JButton createJButton(String label,
                                    Font font)
Creates a JButton.
Parameters:
label - the label.
font - the font.
Returns:
The button.

createJLabel

public static JLabel createJLabel(String text,
                                  Font font)
Creates a label with a specific font.
Parameters:
text - the text for the label.
font - the font.
Returns:
The label.

createJLabel

public static JLabel createJLabel(String text,
                                  Font font,
                                  Color color)
Creates a label with a specific font and color.
Parameters:
text - the text for the label.
font - the font.
color - the color.
Returns:
The label.

createTablePanel

public static JPanel createTablePanel(TableModel model)
Creates a panel that contains a table based on the specified table model.
Parameters:
model - the table model to use when constructing the table.
Returns:
The panel.

positionDialogRelativeToParent

public static void positionDialogRelativeToParent(Dialog dialog,
                                                  double horizontalPercent,
                                                  double verticalPercent)
Positions the specified dialog at a position relative to its parent.
Parameters:
dialog - the dialog to be positioned.
horizontalPercent - the relative location.
verticalPercent - the relative location.

positionFrameOnScreen

public static void positionFrameOnScreen(Window frame,
                                         double horizontalPercent,
                                         double verticalPercent)
Positions the specified frame at a relative position in the screen, where 50% is considered to be the center of the screen.
Parameters:
frame - the frame.
horizontalPercent - the relative horizontal position of the frame (0.0 to 1.0, where 0.5 is the center of the screen).
verticalPercent - the relative vertical position of the frame (0.0 to 1.0, where 0.5 is the center of the screen).

positionFrameRandomly

public static void positionFrameRandomly(Window frame)
Positions the specified frame at a random location on the screen while ensuring that the entire frame is visible (provided that the frame is smaller than the screen).
Parameters:
frame - the frame.