1 14 package org.compiere.install; 15 16 import java.awt.*; 17 import java.awt.event.*; 18 import javax.swing.*; 19 import javax.swing.border.*; 20 import java.io.*; 21 import java.util.ResourceBundle ; 22 23 import org.compiere.apps.OnlineHelp; 24 25 31 public class Setup_Help extends JDialog implements ActionListener 32 { 33 37 public Setup_Help (Frame parent) 38 { 39 super (parent, true); 40 init(parent); 41 } 43 47 public Setup_Help (Dialog parent) 48 { 49 super (parent, true); 50 init(parent); 51 } 53 57 private void init (Window parent) 58 { 59 enableEvents(AWTEvent.WINDOW_EVENT_MASK); 60 try 61 { 62 jbInit(); 63 dynInit(); 64 } 65 catch(Exception e) 66 { 67 e.printStackTrace(); 68 } 69 70 Dimension dlgSize = getPreferredSize(); 71 Dimension frmSize = parent.getSize(); 72 Point loc = parent.getLocation(); 73 setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); 74 try 75 { 76 pack(); 77 show(); } 79 catch (Exception ex) 80 { 81 } 82 } 84 85 static ResourceBundle res = ResourceBundle.getBundle("org.compiere.install.SetupRes"); 86 private JPanel mainPanel = new JPanel(); 87 private JPanel southPanel = new JPanel(); 88 private JButton bOK = new JButton(); 89 private BorderLayout mainLayout = new BorderLayout(); 90 private JScrollPane centerScrollPane = new JScrollPane(); 91 private JEditorPane editorPane = new OnlineHelp(); 92 93 94 98 private void jbInit() throws Exception  99 { 100 this.setTitle(res.getString("CompiereServerSetup") + " " + res.getString("Help")); 102 mainPanel.setLayout(mainLayout); 103 bOK.setText(res.getString("Ok")); 104 bOK.addActionListener(this); 105 centerScrollPane.setPreferredSize(new Dimension(400, 400)); 106 this.getContentPane().add(mainPanel, null); 107 southPanel.add(bOK, null); 108 mainPanel.add(southPanel, BorderLayout.SOUTH); 109 setResizable(true); 110 mainPanel.add(centerScrollPane, BorderLayout.CENTER); 111 centerScrollPane.getViewport().add(editorPane, null); 112 } 114 117 private void dynInit() 118 { 119 try 120 { 121 editorPane.setPage("http://www.compiere.org/help/serverSetup.html"); 122 } 123 catch (IOException ex) 124 { 125 editorPane.setText(res.getString("PleaseCheck") 126 + " http://www.compiere.org/support <p>(" 127 + res.getString("UnableToConnect") + ")"); 128 } 129 } 131 135 protected void processWindowEvent(WindowEvent e) 136 { 137 if (e.getID() == WindowEvent.WINDOW_CLOSING) 138 dispose(); 139 super.processWindowEvent(e); 140 } 142 146 public void actionPerformed(ActionEvent e) 147 { 148 if (e.getSource() == bOK) 149 dispose(); 150 } 152 } | Popular Tags |