JLabel « JTextPane « Java Swing Q&A





1. Inserting JLabel into JTextPane    coderanch.com

2. deleting JLabels in JTextPanes??    coderanch.com

3. How to pass an image of a JLabel to a JTextPane?    coderanch.com

import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class Janela2 extends JFrame { Janela1 janela1; public Janela2() { ImageIcon imagem = new ImageIcon(getClass().getResource("ok.gif")); JLabel label = new JLabel(imagem); label.addMouseListener(new ClicouListener()); getContentPane().add(label); setVisible(true); setSize(300,300); setDefaultCloseOperation(EXIT_ON_CLOSE);; } private class ClicouListener implements MouseListener { @Override public void mouseClicked(MouseEvent e) { //How do I get by clicking here to add the image ...