1 6 7 package com.memoire.vainstall.gui; 8 9 import java.awt.*; 10 import java.io.*; 11 import java.awt.event.*; 12 import javax.swing.*; 13 import javax.swing.border.*; 14 import com.memoire.vainstall.VAGlobals; 15 import com.memoire.vainstall.VAReadmeStep; 16 17 21 22 public class VAReadmePanel 23 extends VAPanel 24 implements VAReadmeStep 25 { 26 JTextArea taLicense_; 27 28 public VAReadmePanel() 29 { 30 super(); 31 32 setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); 33 34 JPanel pnMain=new JPanel(); 35 pnMain.setBorder(new CompoundBorder(new EtchedBorder(), 36 new EmptyBorder(new Insets(5, 5, 5, 5)))); 37 pnMain.setLayout(new BorderLayout()); 38 JLabel lbTitle=new JLabel(VAGlobals.i18n("UI_Readme")); 39 lbTitle.setFont(lbTitle.getFont().deriveFont(Font.BOLD, 20)); 40 lbTitle.setOpaque(true); 41 lbTitle.setBorder(new EmptyBorder(new Insets(5, 0, 5, 0))); 42 lbTitle.setBackground(pnMain.getBackground().darker()); 43 lbTitle.setForeground(Color.white); 44 45 taLicense_=new JTextArea(); 46 taLicense_.setEditable(false); 47 taLicense_.setFont(new Font("Monospaced", Font.PLAIN, 10)); 48 JScrollPane spLicense=new JScrollPane(taLicense_); 49 50 pnMain.add(BorderLayout.NORTH, lbTitle); 51 pnMain.add(BorderLayout.CENTER, spLicense); 52 53 JComponent pnImage=VAImagePanel.IMAGE_PANEL; 54 add(pnImage); 55 add(pnMain); 56 } 57 58 public void setText(InputStream lic) 59 { 60 String text=""; 61 if( lic==null ) { 62 text+=VAGlobals.i18n("UI_NoReadme"); 63 } else { 64 try { 65 LineNumberReader in=new LineNumberReader(new InputStreamReader(lic, "UTF-8")); 66 String line=in.readLine(); 67 while( line!=null ) { 68 text+=line+"\n"; 69 line=in.readLine(); 70 } 71 in.close(); 72 } catch( IOException e ) { 73 text+=e.getMessage(); 74 } 75 } 76 taLicense_.setText(text); 77 taLicense_.setCaretPosition(0); 78 } 79 } 80 | Popular Tags |