1 package org.sleuthkit.autopsy.corecomponents;
4 import java.awt.event.*;
6 import javax.swing.border.*;
7 import javax.swing.event.*;
8 import javax.swing.text.*;
21 implements FocusListener, DocumentListener {
37 public TextPrompt(String text, JTextComponent component) {
45 public TextPrompt(String text, JTextComponent component, String layoutConstraint) {
49 public TextPrompt(String text, JTextComponent component,
Show show, String layoutConstraint) {
51 component.removeAll();
53 document = component.getDocument();
56 setFont(component.getFont());
57 setForeground(component.getForeground());
58 setBorder(
new EmptyBorder(component.getInsets()));
59 setHorizontalAlignment(JLabel.LEADING);
61 component.addFocusListener(
this);
62 document.addDocumentListener(
this);
64 component.setLayout(
new BorderLayout());
65 if (layoutConstraint == null) {
68 component.add(
this, layoutConstraint);
90 alpha = alpha > 255 ? 255 : alpha < 0 ? 0 : alpha;
92 Color foreground = getForeground();
93 int red = foreground.getRed();
94 int green = foreground.getGreen();
95 int blue = foreground.getBlue();
97 Color withAlpha =
new Color(red, green, blue, alpha);
98 super.setForeground(withAlpha);
109 setFont(getFont().deriveFont(style));
163 if (document.getLength() > 0) {
169 if (showPromptOnce && focusLost > 0) {
176 if (component.hasFocus()) {
void changeAlpha(int alpha)
TextPrompt(String text, JTextComponent component, Show show)
TextPrompt(String text, JTextComponent component, String layoutConstraint)
TextPrompt(String text, JTextComponent component)
void focusLost(FocusEvent e)
void insertUpdate(DocumentEvent e)
void changeStyle(int style)
void setShowPromptOnce(boolean showPromptOnce)
void changeAlpha(float alpha)
void changedUpdate(DocumentEvent e)
void removeUpdate(DocumentEvent e)
boolean getShowPromptOnce()
void focusGained(FocusEvent e)
TextPrompt(String text, JTextComponent component, Show show, String layoutConstraint)