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) {
43 component.removeAll();
45 document = component.getDocument();
48 setFont(component.getFont());
49 setForeground(component.getForeground());
50 setBorder(
new EmptyBorder(component.getInsets()));
51 setHorizontalAlignment(JLabel.LEADING);
53 component.addFocusListener(
this);
54 document.addDocumentListener(
this);
56 component.setLayout(
new BorderLayout());
78 alpha = alpha > 255 ? 255 : alpha < 0 ? 0 : alpha;
80 Color foreground = getForeground();
81 int red = foreground.getRed();
82 int green = foreground.getGreen();
83 int blue = foreground.getBlue();
85 Color withAlpha =
new Color(red, green, blue, alpha);
86 super.setForeground(withAlpha);
97 setFont(getFont().deriveFont(style));
151 if (document.getLength() > 0) {
157 if (showPromptOnce && focusLost > 0) {
164 if (component.hasFocus()) {
void changeAlpha(int alpha)
TextPrompt(String text, JTextComponent component, Show show)
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)