public class SwingHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SwingHelper.HtmlViewerBuilder |
static interface |
SwingHelper.WidthCalculator |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ELLIPSIS |
static java.lang.String |
ERROR_STR |
Constructor and Description |
---|
SwingHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
addHistoryOnExpansion(TextFieldWithHistory textFieldWithHistory,
NotNullProducer<? extends java.util.List<java.lang.String>> historyProvider) |
static void |
adjustDialogSizeToFitPreferredSize(DialogWrapper dialogWrapper) |
static java.lang.String |
buildHtml(java.lang.String headInnerHtml,
java.lang.String bodyInnedHtml) |
static javax.swing.JEditorPane |
createHtmlLabel(java.lang.String innerHtml,
java.lang.String disabledHtml,
Consumer<? super java.lang.String> hyperlinkListener) |
static javax.swing.JEditorPane |
createHtmlViewer(boolean lineWrap,
java.awt.Font font,
java.awt.Color background,
java.awt.Color foreground) |
static TextFieldWithHistoryWithBrowseButton |
createTextFieldWithHistoryWithBrowseButton(Project project,
java.lang.String browseDialogTitle,
FileChooserDescriptor fileChooserDescriptor,
NotNullProducer<? extends java.util.List<java.lang.String>> historyProvider) |
static HyperlinkLabel |
createWebHyperlink(java.lang.String url) |
static HyperlinkLabel |
createWebHyperlink(java.lang.String text,
java.lang.String url) |
static java.awt.Component |
getComponentFromRecentMouseEvent() |
static void |
installFileCompletionAndBrowseDialog(Project project,
TextFieldWithBrowseButton textFieldWithBrowseButton,
java.lang.String browseDialogTitle,
FileChooserDescriptor fileChooserDescriptor) |
static void |
installFileCompletionAndBrowseDialog(Project project,
TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton,
java.lang.String browseDialogTitle,
FileChooserDescriptor fileChooserDescriptor) |
static javax.swing.JPanel |
newHorizontalPanel(float childAlignmentY,
java.awt.Component... children)
Creates panel whose content consists of given
children components horizontally
stacked each on another in a given order. |
static javax.swing.JPanel |
newLeftAlignedVerticalPanel(java.util.Collection<java.awt.Component> children) |
static javax.swing.JPanel |
newLeftAlignedVerticalPanel(java.awt.Component... children) |
static javax.swing.JPanel |
newVerticalPanel(float childAlignmentX,
java.util.Collection<java.awt.Component> children) |
static javax.swing.JPanel |
newVerticalPanel(float childAlignmentX,
java.awt.Component... children)
Creates panel whose content consists of given
children components
stacked vertically each on another in a given order. |
static void |
resizeDialogToFitTextFor(javax.swing.JComponent... components) |
static boolean |
scrollToReference(javax.swing.JEditorPane view,
java.lang.String reference) |
static void |
setHistory(TextFieldWithHistory textFieldWithHistory,
java.util.List<java.lang.String> history,
boolean mergeWithPrevHistory) |
static void |
setHtml(javax.swing.JEditorPane editorPane,
java.lang.String bodyInnerHtml,
java.awt.Color foregroundColor) |
static void |
setLongestAsPrototype(javax.swing.JComboBox comboBox,
java.util.List<java.lang.String> variants) |
static void |
setNoBorderCellRendererFor(javax.swing.table.TableColumn column) |
static void |
setPreferredWidth(java.awt.Component component,
int width) |
static void |
setPreferredWidthToFitText(javax.swing.JTextField textField) |
static void |
setPreferredWidthToFitText(javax.swing.JTextField textField,
int additionalWidth) |
static void |
setPreferredWidthToFitText(javax.swing.JTextField textField,
java.lang.String text) |
static void |
setPreferredWidthToFitText(TextFieldWithBrowseButton component) |
static void |
setPreferredWidthToFitText(TextFieldWithHistoryWithBrowseButton component) |
static java.lang.String |
truncateStringWithEllipsis(java.lang.String text,
int maxWidth,
java.awt.FontMetrics fm) |
static java.lang.String |
truncateStringWithEllipsis(java.lang.String text,
int maxWidth,
SwingHelper.WidthCalculator fm) |
static <T> void |
updateItems(javax.swing.JComboBox<T> comboBox,
java.util.List<? extends T> newItems,
T newSelectedItemIfSelectionCannotBePreserved) |
static javax.swing.JPanel |
wrapWithHorizontalStretch(javax.swing.JComponent component) |
static <C extends javax.swing.JComponent> |
wrapWithInfoButton(C component,
java.lang.String infoButtonTooltip,
java.awt.event.ActionListener listener) |
static javax.swing.JPanel |
wrapWithoutStretch(javax.swing.JComponent component) |
public static final java.lang.String ELLIPSIS
public static final java.lang.String ERROR_STR
public static javax.swing.JPanel newVerticalPanel(float childAlignmentX, java.awt.Component... children)
children
components
stacked vertically each on another in a given order.childAlignmentX
- Component.LEFT_ALIGNMENT, Component.CENTER_ALIGNMENT or Component.RIGHT_ALIGNMENTchildren
- children componentspublic static javax.swing.JPanel newLeftAlignedVerticalPanel(java.awt.Component... children)
public static javax.swing.JPanel newLeftAlignedVerticalPanel(java.util.Collection<java.awt.Component> children)
public static javax.swing.JPanel newVerticalPanel(float childAlignmentX, java.util.Collection<java.awt.Component> children)
public static javax.swing.JPanel newHorizontalPanel(float childAlignmentY, java.awt.Component... children)
children
components horizontally
stacked each on another in a given order.childAlignmentY
- Component.TOP_ALIGNMENT, Component.CENTER_ALIGNMENT or Component.BOTTOM_ALIGNMENTchildren
- children componentspublic static javax.swing.JPanel wrapWithoutStretch(javax.swing.JComponent component)
public static javax.swing.JPanel wrapWithHorizontalStretch(javax.swing.JComponent component)
public static void setPreferredWidthToFitText(TextFieldWithHistoryWithBrowseButton component)
public static void setPreferredWidthToFitText(TextFieldWithBrowseButton component)
public static void setPreferredWidthToFitText(javax.swing.JTextField textField)
public static void setPreferredWidthToFitText(javax.swing.JTextField textField, int additionalWidth)
public static void setPreferredWidthToFitText(javax.swing.JTextField textField, java.lang.String text)
public static void adjustDialogSizeToFitPreferredSize(DialogWrapper dialogWrapper)
public static void resizeDialogToFitTextFor(javax.swing.JComponent... components)
public static <T> void updateItems(javax.swing.JComboBox<T> comboBox, java.util.List<? extends T> newItems, T newSelectedItemIfSelectionCannotBePreserved)
public static void setNoBorderCellRendererFor(javax.swing.table.TableColumn column)
public static void addHistoryOnExpansion(TextFieldWithHistory textFieldWithHistory, NotNullProducer<? extends java.util.List<java.lang.String>> historyProvider)
public static void setHistory(TextFieldWithHistory textFieldWithHistory, java.util.List<java.lang.String> history, boolean mergeWithPrevHistory)
public static void setLongestAsPrototype(javax.swing.JComboBox comboBox, java.util.List<java.lang.String> variants)
public static void installFileCompletionAndBrowseDialog(Project project, TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton, java.lang.String browseDialogTitle, FileChooserDescriptor fileChooserDescriptor)
public static void installFileCompletionAndBrowseDialog(Project project, TextFieldWithBrowseButton textFieldWithBrowseButton, java.lang.String browseDialogTitle, FileChooserDescriptor fileChooserDescriptor)
public static HyperlinkLabel createWebHyperlink(java.lang.String url)
public static HyperlinkLabel createWebHyperlink(java.lang.String text, java.lang.String url)
public static void setPreferredWidth(java.awt.Component component, int width)
public static boolean scrollToReference(javax.swing.JEditorPane view, java.lang.String reference)
public static javax.swing.JEditorPane createHtmlViewer(boolean lineWrap, java.awt.Font font, java.awt.Color background, java.awt.Color foreground)
public static void setHtml(javax.swing.JEditorPane editorPane, java.lang.String bodyInnerHtml, java.awt.Color foregroundColor)
public static java.lang.String buildHtml(java.lang.String headInnerHtml, java.lang.String bodyInnedHtml)
public static TextFieldWithHistoryWithBrowseButton createTextFieldWithHistoryWithBrowseButton(Project project, java.lang.String browseDialogTitle, FileChooserDescriptor fileChooserDescriptor, NotNullProducer<? extends java.util.List<java.lang.String>> historyProvider)
public static <C extends javax.swing.JComponent> ComponentWithBrowseButton<C> wrapWithInfoButton(C component, java.lang.String infoButtonTooltip, java.awt.event.ActionListener listener)
public static java.lang.String truncateStringWithEllipsis(java.lang.String text, int maxWidth, java.awt.FontMetrics fm)
public static java.lang.String truncateStringWithEllipsis(java.lang.String text, int maxWidth, SwingHelper.WidthCalculator fm)
public static javax.swing.JEditorPane createHtmlLabel(java.lang.String innerHtml, java.lang.String disabledHtml, Consumer<? super java.lang.String> hyperlinkListener)
public static java.awt.Component getComponentFromRecentMouseEvent()