import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import java.net.URL; public class Botones_fotos_code extends JFrame { public static void main(String[] args) { // Java look and feel //JFrame.setDefaultLookAndFeelDecorated(true); new Botones_fotos_code(); } public Botones_fotos_code() { //super("Botones_fotos2_code"); //super(); // cerrar la ventana sin salir del programa this.setDefaultCloseOperation ( JFrame.DISPOSE_ON_CLOSE ); // ocultar la ventana sin cerrarla //this.setDefaultCloseOperation ( JFrame.HIDE_ON_CLOSE ); JPanel panel = new JPanel(new BorderLayout()); //this.setTitle("Botones_Fotos2_code"); this.getContentPane().add(panel); this.setSize(800,600); JEditorPane editorPane = new JEditorPane(); editorPane.setEditable(false); URL url = Botones_fotos_code.class.getResource("/code/Botones_fotos_code.html"); // tambien puede ser //URL url = this.getClass.getResource("code/Botones_fotos2_code.html"); if (url != null) { try { editorPane.setPage(url); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Error al leer " + url.toString(), "IOException", JOptionPane.PLAIN_MESSAGE); } } else { JOptionPane.showMessageDialog(null, "No se encuentra el archivo " + url, "FileNotFoundException", JOptionPane.PLAIN_MESSAGE); //return; } //Put the editor pane in a scroll pane. JScrollPane editorScrollPane = new JScrollPane(editorPane); editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); editorScrollPane.setPreferredSize(new Dimension(760, 540)); editorScrollPane.setMinimumSize(new Dimension(10, 10)); panel.add(editorScrollPane, BorderLayout.CENTER); //show window //pack(); setLocationRelativeTo(null); setResizable(false); setVisible(true); } }