/* * TestBeanFrameComponents.java * * */ import java.awt.Component; import java.awt.event.MouseListener; import javax.swing.text.AttributeSet; import javax.swing.text.html.HTML; /** * * @author Vassil Boyadjiev */ public class ButtonListenersExample extends javax.swing.JFrame implements MouseListener { /** Creates new form TestBeanFrame */ public ButtonListenersExample() { initComponents(); hTMLEditor1.addFormElementsMouseListener(this); hTMLEditor1.setContent("<input type=\"submit\" name=\"my_button\" id=\"3246\">"); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents hTMLEditor1 = new sferyx.administration.editors.HTMLEditor(); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); hTMLEditor1.setRemovedMenuItems(""); hTMLEditor1.setStatusMessage(""); hTMLEditor1.setTableItemsStatus(false); getContentPane().add(hTMLEditor1, java.awt.BorderLayout.CENTER); pack(); }//GEN-END:initComponents /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm System.exit(0); }//GEN-LAST:event_exitForm /** * @param args the command line arguments */ public static void main(String args[]) { ButtonListenersExample frame=new ButtonListenersExample(); frame.setLocation(100,100); frame.setSize(800,600); frame.show(); } public void mouseClicked(java.awt.event.MouseEvent mouseEvent) { } public void mouseEntered(java.awt.event.MouseEvent mouseEvent) { } public void mouseExited(java.awt.event.MouseEvent mouseEvent) { } public void mousePressed(java.awt.event.MouseEvent mouseEvent) { } public void mouseReleased(java.awt.event.MouseEvent mouseEvent) { System.out.println("==> Mouse Released:"+mouseEvent); System.out.println("===========Attribute Dump Start====================="); AttributeSet attribs=hTMLEditor1.getAttributesForComponent((Component)mouseEvent.getSource(), hTMLEditor1.getSelectedEditorComponent()); if(attribs!=null) { System.out.println("Name="+attribs.getAttribute(HTML.Attribute.NAME)); System.out.println("ID="+attribs.getAttribute(HTML.Attribute.ID)); } System.out.println("===========Attribute Dump End====================="); } // Variables declaration - do not modify//GEN-BEGIN:variables private sferyx.administration.editors.HTMLEditor hTMLEditor1; // End of variables declaration//GEN-END:variables }