Class GuiUtils
-
- All Implemented Interfaces:
public final class GuiUtils
-
-
Constructor Summary
Constructors Constructor Description GuiUtils()
-
Method Summary
Modifier and Type Method Description static JScrollPanemakeScrollPane(Component comp)Create a scroll panel that sets its preferred size to its minimum size. static <C extends JComponent> CemptyBorder(C comp)Clears border of the given component. static voidfixSize(TableColumn column, JTable table)Fix the size of a column according to the header text. static JComponentcreateLabelCombo(String label, JComboBox<out Object> comboBox)Create a GUI component JLabel + JComboBox with a left and right margin (5px) static voidstopTableEditing(JTable table)Stop any editing that is currently being done on the table. static voidcancelEditing(JTable table)cancel any editing that is currently being done on the table. static StringgetPastedText()Get pasted text from clipboard static voidmakeScrollableMenu(JMenu menu)Make menu scrollable final static voidcopyTextToClipboard(String text)Copy text to clipboard -
-
Method Detail
-
makeScrollPane
static JScrollPane makeScrollPane(Component comp)
Create a scroll panel that sets its preferred size to its minimum size. Explicitly for scroll panes that live inside other scroll panes, or within containers that stretch components to fill the area they exist in. Use this for any component you would put in a scroll pane (such as TextAreas, tables, JLists, etc). It is here for convenience and to avoid duplicate code. JMeter displays best if you follow this custom.
- Parameters:
comp- the component which should be placed inside the scroll pane- Returns:
a JScrollPane containing the specified component
-
emptyBorder
static <C extends JComponent> C emptyBorder(C comp)
Clears border of the given component.
- Parameters:
comp- input component- Returns:
the given component with border set to empty
-
fixSize
static void fixSize(TableColumn column, JTable table)
Fix the size of a column according to the header text.
- Parameters:
column- to be resizedtable- containing the column
-
createLabelCombo
static JComponent createLabelCombo(String label, JComboBox<out Object> comboBox)
Create a GUI component JLabel + JComboBox with a left and right margin (5px)
- Parameters:
label- the labelcomboBox- the combo box- Returns:
the JComponent (margin+JLabel+margin+JComboBox)
-
stopTableEditing
static void stopTableEditing(JTable table)
Stop any editing that is currently being done on the table. This will save any changes that have already been made.
- Parameters:
table- the table to stop on editing
-
cancelEditing
static void cancelEditing(JTable table)
cancel any editing that is currently being done on the table.
- Parameters:
table- the table to cancel on editing- Since:
3.1
-
getPastedText
static String getPastedText()
Get pasted text from clipboard
- Returns:
String Pasted text
-
makeScrollableMenu
static void makeScrollableMenu(JMenu menu)
Make menu scrollable
- Parameters:
menu- JMenu
-
copyTextToClipboard
final static void copyTextToClipboard(String text)
Copy text to clipboard
- Parameters:
text- Text to copy
-
-
-
-