Ayuda con el JEditorPane
hola no se si alguien me pude ayudar necesito crear un area de diseño en el q pueda poner imagenes, cuadros, y texto, tengo alguna idea de como hacer pero me seria muy util si me pueden ayudar con um pedazo de codgo para darme una mejor idea ya sea en JEditorPane o en cualquier otro componente
Gracias
Gracias
// esto te va a servir
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.*;
public class Test4 extends JFrame {
private JEditorPane editor;
public Test4(){
this.addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent arg0) {}
public void windowClosing(WindowEvent arg0) {}
public void windowClosed(WindowEvent arg0) {
System.exit(0);
}
public void windowIconified(WindowEvent arg0) {}
public void windowDeiconified(WindowEvent arg0) {}
public void windowActivated(WindowEvent arg0) {}
public void windowDeactivated(WindowEvent arg0) {}
});
StringBuffer buf= new StringBuffer();
editor= new JEditorPane();
editor.setContentType("text/html");
buf.append("<p><strong>Esta es una imagen:</strong></p>");
buf.append("<img src="file://c/argentina.jpg">");
editor.setText(buf.toString());
this.getContentPane().add(editor);
this.setSize(400,400);
this.setVisible(true);
}
public static void main (String args[]){
new Test4();
}
}
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.*;
public class Test4 extends JFrame {
private JEditorPane editor;
public Test4(){
this.addWindowListener(new WindowListener() {
public void windowOpened(WindowEvent arg0) {}
public void windowClosing(WindowEvent arg0) {}
public void windowClosed(WindowEvent arg0) {
System.exit(0);
}
public void windowIconified(WindowEvent arg0) {}
public void windowDeiconified(WindowEvent arg0) {}
public void windowActivated(WindowEvent arg0) {}
public void windowDeactivated(WindowEvent arg0) {}
});
StringBuffer buf= new StringBuffer();
editor= new JEditorPane();
editor.setContentType("text/html");
buf.append("<p><strong>Esta es una imagen:</strong></p>");
buf.append("<img src="file://c/argentina.jpg">");
editor.setText(buf.toString());
this.getContentPane().add(editor);
this.setSize(400,400);
this.setVisible(true);
}
public static void main (String args[]){
new Test4();
}
}