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) {
44 document = component.getDocument();
47 setFont(component.getFont());
48 setForeground(component.getForeground());
49 setBorder(
new EmptyBorder(component.getInsets()));
50 setHorizontalAlignment(JLabel.LEADING);
52 component.addFocusListener(
this);
53 document.addDocumentListener(
this);
55 component.setLayout(
new BorderLayout());
77 alpha = alpha > 255 ? 255 : alpha < 0 ? 0 : alpha;
79 Color foreground = getForeground();
80 int red = foreground.getRed();
81 int green = foreground.getGreen();
82 int blue = foreground.getBlue();
84 Color withAlpha =
new Color(red, green, blue, alpha);
85 super.setForeground(withAlpha);
96 setFont(getFont().deriveFont(style));
150 if (document.getLength() > 0) {
156 if (showPromptOnce && focusLost > 0) {
163 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)