Changeset 18241
- Timestamp:
- 2008-12-17T18:48:34+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/admin/gui/ExtensionInstallation.java
r18220 r18241 30 30 import javax.xml.transform.stream.StreamResult; 31 31 32 //import org.apache.tools.ant.Project;33 //import org.apache.tools.ant.ProjectHelper;34 32 import org.greenstone.gsdl3.util.GSPath; 35 33 import org.greenstone.gsdl3.util.GlobalProperties; … … 49 47 import java.util.Set; 50 48 49 import java.awt.BorderLayout; 50 import javax.swing.JFrame; 51 import javax.swing.JScrollPane; 52 import javax.swing.JTextPane; 53 import javax.swing.text.BadLocationException; 54 import javax.swing.text.DefaultStyledDocument; 55 import javax.swing.text.SimpleAttributeSet; 56 import javax.swing.text.Style; 57 import javax.swing.text.StyleConstants; 58 import javax.swing.text.StyleContext; 59 import javax.swing.text.StyledDocument; 60 import java.io.DataInputStream; 51 61 52 62 class ExtensionInstallation extends Thread { … … 106 116 proc.waitFor(); 107 117 108 JOptionPane.showMessageDialog(new JFrame(),adaptee.InstallCompleteMsg); 118 JTextPaneStyle test = new JTextPaneStyle(adaptee.extension_path); 119 test.display(); 109 120 ExtPane.updateExtensionContentPane(); 110 121 … … 118 129 } 119 130 } 131 132 133 class JTextPaneStyle implements ActionListener{ 134 135 private static String message =""; 136 137 JFrame frame = new JFrame("The extension (Mat) has been installed!!!"); 138 private String filePath; 139 140 public JTextPaneStyle (String path){ 141 filePath = path + "README.txt"; 142 loadReadMe(); 143 } 144 145 public void loadReadMe(){ 146 147 try{ 148 149 FileInputStream fstream = new FileInputStream(filePath); 150 DataInputStream in = new DataInputStream(fstream); 151 BufferedReader br = new BufferedReader(new InputStreamReader(in)); 152 String strLine; 153 154 while ((strLine = br.readLine()) != null) { 155 message = message+ "\n "+ strLine; 156 } 157 158 in.close(); 159 160 }catch (Exception e){ 161 System.err.println("Error: " + e.getMessage()); 162 } 163 164 } 165 166 public void display() { 167 168 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 169 170 frame.setSize(new Dimension(550, 450)); 171 StyleContext context = new StyleContext(); 172 StyledDocument document = new DefaultStyledDocument(context); 173 174 Style style = context.getStyle(StyleContext.DEFAULT_STYLE); 175 StyleConstants.setAlignment(style, StyleConstants.ALIGN_LEFT); 176 StyleConstants.setFontSize(style, 14); 177 StyleConstants.setSpaceAbove(style, 4); 178 StyleConstants.setSpaceBelow(style, 4); 179 180 try { 181 document.insertString(document.getLength(), message, style); 182 } catch (BadLocationException badLocationException) { 183 System.err.println("Oops"); 184 } 185 186 JPanel mainPane = new JPanel(new BorderLayout()); 187 JTextPane textPane = new JTextPane(document); 188 textPane.setEditable(false); 189 JScrollPane scrollPane = new JScrollPane(textPane); 190 mainPane.add(scrollPane,BorderLayout.CENTER); 191 JButton jbutton = new JButton("ok"); 192 jbutton.addActionListener(this); 193 mainPane.add(jbutton,BorderLayout.SOUTH); 194 frame.getContentPane().add(mainPane, BorderLayout.CENTER); 195 frame.setVisible(true); 196 } 197 198 public void actionPerformed(ActionEvent e) { 199 frame.dispose(); 200 } 201 } 202 203
Note:
See TracChangeset
for help on using the changeset viewer.