ecco il codice:
codice:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lupix.school;
import java.io.File;
import javax.swing.*;
import java.io.*;
import java.awt.*;
/**
*
* @author giordano
*/
public class guide {
static JEditorPane page;
public guide() {
JFrame guide = new JFrame("Guida");
JPanel gp = new JPanel();
gp.setLayout(new BorderLayout());
String html = "";
page = new JEditorPane();
page.setContentType("text/html");
Container gc = guide.getContentPane();
gc.add(gp);
File g = new File("guide/guide.html");
try {
FileInputStream fis1 = new FileInputStream(g);
page.read(fis1, null);
} catch (FileNotFoundException a) {
a.printStackTrace();
} catch (IOException a) {
a.printStackTrace();
}
page.setEditable(false);
JScrollPane st = new JScrollPane(page);
st.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
st.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
st.setPreferredSize(new Dimension(800, 600));
gp.add(st, BorderLayout.PAGE_START);
guide.pack();
guide.setResizable(false);
guide.setLocationRelativeTo(null);
guide.setVisible(true);
}
}