// This sample demonstrates how to create // interactive boxes which behave much like buttons // Create a box to be used as a button com.mindfusion.jdiagram.Box box = flowChart.createBox(10, 10, 50, 30); box.setShape(com.mindfusion.jdiagram.Shape.fromId("Rectangle")); box.setText("Click me"); box.setTag("button"); // Associate an event handler with the // FlowChart.BoxClicked event flowChart.addFlowChartListener ( new FlowChartAdapter() { public void itemClicked(ItemMouseEvent e) { if ((String)e.getItem().getTag() == "button") { // The button-box has been clicked JOptionPane.showMessageDialog(null, "Click!"); } } } );