I'm new to windowbuilder designer with eclipse. I'm using eclipse 2021-12, jdk 17 and windowbuilder 1.9.8 version. I'm trying to add an actionListener on a button in design mode. But when I double-click on this button in design mode, to add an actionListener, nothing happens.
Here is my source code in source mode :
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Font;
import java.awt.Color;
public class SwingApp {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SwingApp window = new SwingApp();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public SwingApp() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JButton btnClick = new JButton("Click");
btnClick.setBackground(new Color(219, 112, 147));
btnClick.setForeground(new Color(255, 255, 255));
btnClick.setFont(new Font("Inconsolata SemiBold", Font.BOLD, 14));
btnClick.setBounds(165, 101, 118, 51);
frame.getContentPane().add(btnClick);
}
}
And here is the rendering in design mode : the rendering in design mode