public class GUIUtils
extends java.lang.Object
Constructor and Description |
---|
GUIUtils() |
Modifier and Type | Method and Description |
---|---|
static java.awt.Color |
fromWeightToBWColor(java.lang.Double value)
Method to convert a value in the interval [0, 1] into a black and white
color, where 0 is white and 1 is black
|
static java.awt.Color |
fromWeightToColor(java.awt.Color baseColor,
java.lang.Double value)
Method that convert a give color (as "color-base") into another one that
is obtained considering the value as a "weight" (values in [0, 1]).
|
static javax.swing.JPanel |
prepareBorderedTitle(java.lang.String s)
This method creates a new
JLabel correctly formatted in order to
be a frame title. |
static javax.swing.JTextField |
prepareDoubleField(java.lang.Double initialContent,
java.lang.Double minimum,
java.lang.Double maximum)
This method creates a new
JFormattedTextField for receiving a
double |
static javax.swing.JTextField |
prepareIntegerField(int initialContent)
This method creates a new
JFormattedTextField for receiving
integer (up to 5 digits) as input |
static javax.swing.JTextField |
prepareIPField(java.lang.String initialContent)
This method creates a new text field for receiving integer (up to 5
digits) as input
|
static javax.swing.JLabel |
prepareLabel(int i)
This method creates a new
JLabel correctly formatted |
static javax.swing.JLabel |
prepareLabel(int i,
int alignment,
java.awt.Color foreground)
This method creates a new
JLabel correctly formatted |
static javax.swing.JLabel |
prepareLabel(java.lang.String s)
This method creates a new
JLabel correctly formatted |
static javax.swing.JLabel |
prepareLabel(java.lang.String s,
int alignment,
java.awt.Color foreground)
This method creates a new
JLabel correctly formatted |
static javax.swing.JTextArea |
prepareTextArea(java.lang.String initialContent)
This method creates a new text area
|
static javax.swing.JTextField |
prepareTextField(java.lang.String initialContent)
This method creates a new text field
|
static javax.swing.JLabel |
prepareTitle(java.lang.String s)
This method creates a new
JLabel correctly formatted in order to
be a frame title |
static javax.swing.JPanel |
wrapInRoundedPanel(javax.swing.JComponent c)
This method to wrap a given component into a rounded panel.
|
public static javax.swing.JLabel prepareLabel(java.lang.String s)
JLabel
correctly formatteds
- the string to be inserted into the labelpublic static javax.swing.JLabel prepareLabel(java.lang.String s, int alignment, java.awt.Color foreground)
JLabel
correctly formatteds
- the string to be inserted into the labelalignment
- the alignmentforeground
- the foreground colorpublic static javax.swing.JLabel prepareLabel(int i)
JLabel
correctly formattedi
- the string to be inserted into the labelpublic static javax.swing.JLabel prepareLabel(int i, int alignment, java.awt.Color foreground)
JLabel
correctly formattedi
- the string to be inserted into the labelalignment
- the alignmentforeground
- the foreground colorpublic static javax.swing.JPanel prepareBorderedTitle(java.lang.String s)
JLabel
correctly formatted in order to
be a frame title. The text will be inserted into a gray box.s
- the string to be inserted into the labelpublic static javax.swing.JLabel prepareTitle(java.lang.String s)
JLabel
correctly formatted in order to
be a frame titles
- the string to be inserted into the labelpublic static javax.swing.JTextField prepareIntegerField(int initialContent)
JFormattedTextField
for receiving
integer (up to 5 digits) as inputinitialContent
- the initial content of the text fieldpublic static javax.swing.JTextField prepareDoubleField(java.lang.Double initialContent, java.lang.Double minimum, java.lang.Double maximum)
JFormattedTextField
for receiving a
doubleinitialContent
- the initial content of the text fieldminimum
- the minimum valuemaximum
- the maximum valuepublic static javax.swing.JPanel wrapInRoundedPanel(javax.swing.JComponent c)
JTextField a = GUIUtils.prepareIntegerField(100); mainComponent.add(GUIUtils.wrapInRoundedPanel(a), BorderLayout.CENTER);
c
- the component to wrapJPanel
containing the given componentpublic static javax.swing.JTextField prepareIPField(java.lang.String initialContent)
initialContent
- the initial content of the text fieldpublic static javax.swing.JTextField prepareTextField(java.lang.String initialContent)
initialContent
- the initial content of the text fieldpublic static javax.swing.JTextArea prepareTextArea(java.lang.String initialContent)
initialContent
- the initial content of the text fieldpublic static java.awt.Color fromWeightToBWColor(java.lang.Double value)
value
- the valuepublic static java.awt.Color fromWeightToColor(java.awt.Color baseColor, java.lang.Double value)
baseColor
- the starting colorvalue
- the value