How can i display a tick mark like this -
and some text on a JButton.
-----------------------
| mybutton [tick-mark] |
-----------------------
Is there any way i can achieve this apart from placing an image on the button ?
How can i display a tick mark like this -
and some text on a JButton.
-----------------------
| mybutton [tick-mark] |
-----------------------
Is there any way i can achieve this apart from placing an image on the button ?
Use ImageIcon
for button with tick image :
JButton b = new JButton();
b.setIcon(new ImageIcon("PATH_TO_ICON"));
b.setText("TEXT");
You could try using one of the Unicode code-points that denote a "check mark". The alternatives are listed here.
If you take this approach, your buttons may look different (or even completely wrong) on different platforms due to font issues. An image is more likely to give a consistent "look".