RaulMP22 de Agosto del 2005
PreguntaHola, a ver si alguien me puede ayudar:
Quiero mostrar en un JDialog la ayuda de una aplicación que está en HTML. El problema es que en un JFrame funciona correcto, pero en un JDialog no me muestra nada, a que se debe?
El código es el siguiente:
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.net.*;
import java.awt.event.*;
public class JHelp extends JDialog{
public JHelp(Frame Parent, String Title, boolean Modal){
super(Parent, Title, Modal );
Inicia();
}
public void Inicia(){
JEditorPane JTexto = new JEditorPane();
JTexto.setEditable(false);
URL url = null;
try
{
url = new File("Archivo.html").toURL() ;
}
catch (Exception exc)
{
System.out.println(exc);
}
try
{
JTexto.setPage(url);
}
catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + url);
}
JScrollPane sp = new JScrollPane();
sp.add(JTexto);
getContentPane().setLayout(null);
getContentPane().add(sp);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent evt){
closeDialog(evt);
}
});
}
private void closeDialog(WindowEvent evt){
setVisible(false);
dispose();
}
public JEditorPane JTexto = new JEditorPane();
}
Gracias
Quiero mostrar en un JDialog la ayuda de una aplicación que está en HTML. El problema es que en un JFrame funciona correcto, pero en un JDialog no me muestra nada, a que se debe?
El código es el siguiente:
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.net.*;
import java.awt.event.*;
public class JHelp extends JDialog{
public JHelp(Frame Parent, String Title, boolean Modal){
super(Parent, Title, Modal );
Inicia();
}
public void Inicia(){
JEditorPane JTexto = new JEditorPane();
JTexto.setEditable(false);
URL url = null;
try
{
url = new File("Archivo.html").toURL() ;
}
catch (Exception exc)
{
System.out.println(exc);
}
try
{
JTexto.setPage(url);
}
catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + url);
}
JScrollPane sp = new JScrollPane();
sp.add(JTexto);
getContentPane().setLayout(null);
getContentPane().add(sp);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent evt){
closeDialog(evt);
}
});
}
private void closeDialog(WindowEvent evt){
setVisible(false);
dispose();
}
public JEditorPane JTexto = new JEditorPane();
}
Gracias
