/* JWildfire - an image and animation processor written in Java Copyright (C) 1995-2016 Andreas Maschke This is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this software; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jwildfire.swing; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Font; import java.awt.Point; import java.awt.SystemColor; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import javax.swing.JInternalFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextPane; import javax.swing.WindowConstants; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import org.jwildfire.base.Prefs; @SuppressWarnings("serial") public class ListOfChangesInternalFrame extends JInternalFrame { private JPanel jContentPane = null; public ListOfChangesInternalFrame() { super(); initialize(); } /** * This method initializes this * * @return void */ private void initialize() { this.setSize(1188, 740); this.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10)); this.setLocation(new Point(JWildfire.DEFAULT_WINDOW_LEFT, JWildfire.DEFAULT_WINDOW_TOP)); this.setClosable(true); this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.setIconifiable(true); this.setTitle("List of Changes"); this.setVisible(false); this.setResizable(true); this.setContentPane(getJContentPane()); } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new JPanel(); jContentPane.setLayout(new BorderLayout()); jContentPane.setFont(Prefs.getPrefs().getFont("Dialog", Font.PLAIN, 10)); jContentPane.setSize(new Dimension(1097, 617)); jContentPane.add(getScrollPane(), BorderLayout.CENTER); } return jContentPane; } private JScrollPane scrollPane; private JTextPane changesPane; private JScrollPane getScrollPane() { if (scrollPane == null) { scrollPane = new JScrollPane(); scrollPane.setPreferredSize(new Dimension(6, 400)); scrollPane.setViewportView(getHelpPane()); } return scrollPane; } JTextPane getHelpPane() { if (changesPane == null) { changesPane = new JTextPane(); changesPane.setBackground(SystemColor.menu); changesPane.setFont(Prefs.getPrefs().getFont("SansSerif", Font.PLAIN, 14)); changesPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { java.awt.Desktop.getDesktop().browse(e.getURL().toURI()); } catch (Exception ex) { ex.printStackTrace(); } } } }); changesPane.setEditable(false); } return changesPane; } public void initChangesPane() { changesPane.setContentType("text/html"); try { InputStream is = this.getClass().getResourceAsStream("CHANGES.txt"); StringBuffer content = new StringBuffer(); String lineFeed = System.getProperty("line.separator"); String line; Reader r = new InputStreamReader(is, "utf-8"); BufferedReader in = new BufferedReader(r); while ((line = in.readLine()) != null) { content.append(line).append(lineFeed); } in.close(); changesPane.setText("<pre>" + content.toString() + "</pre>"); changesPane.setSelectionStart(0); changesPane.setSelectionEnd(0); } catch (Exception ex) { ex.printStackTrace(); } } }