I am trying to add image in a button this ImageIcon
is giving me error, I also import java.awt.Image;
. But still image is not uploading, what can I do now?
JButton btnFind = new JButton("Find");
Image img = new ImageIcon(this.getClass().getResource("/search.png")).getImage();
btnFind.setIcon(new ImageIcon(img));
btnFind.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
btnFind.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
try {
cDriver.fObjectWithDataCity_V3(textFieldSearch.getText());
fDataInTextBoxes();
} catch (Exception ee) {
// TODO Auto-generated catch block
ee.printStackTrace();
}