How to create a JButton with a menu?
This is way harder in Swing than it needs to be. So instead of pointing you to tutorials I’ve created a fully working example. import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class ToolbarDemo { public static void main(String[] args) { final JFrame frame = new JFrame(); frame.setPreferredSize(new Dimension(600, 400)); final JToolBar … Read more