Changeset 18247 for greenstone3


Ignore:
Timestamp:
2008-12-18T14:08:44+13:00 (15 years ago)
Author:
cc108
Message:

replace jtextpane with jtextarea

File:
1 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/admin/gui/ExtensionInstallation.java

    r18241 r18247  
    5050import javax.swing.JFrame;
    5151import javax.swing.JScrollPane;
    52 import javax.swing.JTextPane;
     52import javax.swing.JTextArea;
    5353import javax.swing.text.BadLocationException;
    5454import javax.swing.text.DefaultStyledDocument;
     
    114114       
    115115        ExtPane.message_textarea.append(timestamp);
    116             proc.waitFor();
    117        
     116        proc.waitFor();
     117        System.out.println("here -1");
    118118        JTextPaneStyle test  = new JTextPaneStyle(adaptee.extension_path);
     119        System.out.println("here -2");
    119120        test.display();
     121        System.out.println("here -3");
    120122        ExtPane.updateExtensionContentPane();
    121123       
     
    133135class JTextPaneStyle implements ActionListener{
    134136
    135         private static String message ="";
     137    private static String message ="";
    136138
    137139    JFrame frame = new JFrame("The extension (Mat) has been installed!!!");
     
    143145    }
    144146
    145         public void loadReadMe(){
    146    
    147             try{
     147    public void loadReadMe(){
     148        message = new String();
    148149
    149             FileInputStream fstream = new FileInputStream(filePath);
    150         DataInputStream in = new DataInputStream(fstream);
    151             BufferedReader br = new BufferedReader(new InputStreamReader(in));
    152             String strLine;
     150        try{
    153151
    154             while ((strLine = br.readLine()) != null)   {
    155             message = message+ "\n "+ strLine;
    156             }
     152            FileInputStream fstream = new FileInputStream(filePath);
     153            DataInputStream in = new DataInputStream(fstream);
     154            BufferedReader br = new BufferedReader(new InputStreamReader(in));
     155            String strLine;
    157156
    158             in.close();
    159    
    160             }catch (Exception e){
    161                 System.err.println("Error: " + e.getMessage());
    162             }
    163    
    164         }
     157            while ((strLine = br.readLine()) != null)   {
     158                message = message+ "\n "+ strLine;
     159            }
     160
     161            in.close();
     162        }catch (Exception e){
     163            System.err.println("Error: " + e.getMessage());
     164        }
     165    }
    165166
    166167    public void display() {
    167168
    168169        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    169 
    170170        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 
    186171        JPanel mainPane = new JPanel(new BorderLayout());
    187         JTextPane textPane = new JTextPane(document);
     172        JTextArea textPane = new JTextArea(message);
    188173        textPane.setEditable(false);
    189174        JScrollPane scrollPane = new JScrollPane(textPane);
Note: See TracChangeset for help on using the changeset viewer.