*/
public HelpFrame()
{
super();
final Application app = AbstractApplication.getApplication();
final WindowHandler wh = app.getWindowHandler();
win = wh.createWindow( AbstractWindow.SUPPORT );
Container cp = win.getContentPane();
Box buttonPanel;
final JButton ggClose;
JScrollPane ggScroll;
plainTitle = GUIUtil.getResourceString( "frameHelp" );
win.setTitle( plainTitle );
// ---------- HTML schoko ----------
htmlPane = new JEditorPane();
htmlPane.setEditable( false );
htmlPane.addHyperlinkListener( this );
htmlPane.setPreferredSize( new Dimension( 320, 320 ));
htmlPane.setAutoscrolls( true );
// htmlPane.setContentType( "text/html" );
htmlPane.addPropertyChangeListener( this );
// HelpGlassPane.setHelp( htmlPane, "HelpHTMLPane" );
ggScroll = new JScrollPane( htmlPane );
ggVScroll = ggScroll.getVerticalScrollBar();
// ---------- generic gadgets ----------
buttonPanel = Box.createHorizontalBox(); // new JPanel( new FlowLayout( FlowLayout.RIGHT, 4, 4 ));
ggEdit = new JButton( GUIUtil.getResourceString( "buttonJEdit" ));
buttonPanel.add( ggEdit );
buttonPanel.add( Box.createHorizontalGlue() );
ggEdit.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e )
{
if( historyIndex < 0 ) return;
try {
final File f = net.roydesign.mac.MRJAdapter.findApplication( "JESP" ); // try to open with jEdit
final HistoryEntry he = (HistoryEntry) history.get( historyIndex );
if( f != null ) {
final String[] cmdArray = { "open", "-a", f.getAbsolutePath(), new File( new URI( he.url.toString() )).getAbsolutePath() };
java.lang.Runtime.getRuntime().exec( cmdArray );
}
}
catch( IOException e1 ) {
GUIUtil.displayError( win.getWindow(), e1, ggEdit.getText() );
}
catch( IllegalArgumentException e1 ) {
GUIUtil.displayError( win.getWindow(), e1, ggEdit.getText() );
}
catch( URISyntaxException e1 ) {
GUIUtil.displayError( win.getWindow(), e1, ggEdit.getText() );
}
}
});
ggBack = new JButton( GUIUtil.getResourceString( "buttonBack" ));
ggBack.setEnabled( false );
buttonPanel.add( ggBack );
ggBack.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent newEvent )
{
if( historyIndex > 0 ) {
try {
try {
historyIndex--;
loadURL();
}
catch( IOException e2 ) { // try to load previous file
historyIndex++;
loadURL();
throw e2;
}
}
catch( IOException e3 ) {
GUIUtil.displayError( win.getWindow(), e3, ggBack.getText() );
}
}
}
});
ggOpenInBrowser = new JButton( GUIUtil.getResourceString( "helpOpenBrowser" ));
ggOpenInBrowser.setEnabled( false );
// HelpGlassPane.setHelp( ggOpenInBrowser, "HelpOpenInBrowser" );
buttonPanel.add( ggOpenInBrowser );
ggOpenInBrowser.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent newEvent )
{
openInBrowser();
}
});
ggClose = new JButton( GUIUtil.getResourceString( "buttonClose" ));
buttonPanel.add( ggClose );
ggClose.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent newEvent )
{
dispose();
}
});
win.addListener( new AbstractWindow.Adapter() {
public void windowClosing( AbstractWindow.Event e )
{
dispose();
}
});
buttonPanel.add( new HelpButton( "HelpHTMLPane" ));
buttonPanel.add( Box.createHorizontalStrut( 16 )); // XXX check intruding size
cp.add( ggScroll, BorderLayout.CENTER );
cp.add( buttonPanel, BorderLayout.SOUTH );
// GUIUtil.setDeepFont( cp, fnt );
AbstractWindowHandler.setDeepFont( win.getContentPane(), null );
ggScroll.setPreferredSize( new Dimension( 512, 512 )); // XXX
win.pack();
// win.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );
win.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
win.init();
app.addComponent( COMP_HELP, this );
}