1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.widgets;
|
---|
3 |
|
---|
4 | import java.awt.Color;
|
---|
5 | import java.awt.Font;
|
---|
6 | import java.awt.Graphics;
|
---|
7 |
|
---|
8 | import javax.swing.BorderFactory;
|
---|
9 | import javax.swing.JLabel;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * On screen display label.
|
---|
13 | * @since 12389 (extracted from FilterTableModel)
|
---|
14 | */
|
---|
15 | public class OSDLabel extends JLabel {
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Constructs a new {@code OSDLabel}.
|
---|
19 | * @param text The text to be displayed by the label
|
---|
20 | */
|
---|
21 | public OSDLabel(String text) {
|
---|
22 | super(text);
|
---|
23 | setOpaque(true);
|
---|
24 | setForeground(Color.black);
|
---|
25 | setBackground(new Color(0, 0, 0, 0));
|
---|
26 | setFont(getFont().deriveFont(Font.PLAIN));
|
---|
27 | setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public void paintComponent(Graphics g) {
|
---|
32 | g.setColor(new Color(255, 255, 255, 140));
|
---|
33 | g.fillRoundRect(getX(), getY(), getWidth(), getHeight(), 10, 10);
|
---|
34 | super.paintComponent(g);
|
---|
35 | }
|
---|
36 | }
|
---|