1 6 7 package com.memoire.vainstall.xui; 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.VALicenseStep; 16 17 21 22 public class XuiLicensePanel 23 extends XuiAbstractPanel 24 implements VALicenseStep 25 { 26 JTextArea taLicense_; 27 JRadioButton rdYes_, rdNo_; 28 29 public XuiLicensePanel() 30 { 31 super(); 32 33 setLayout(new BorderLayout(5,0)); 34 setBorder(new EmptyBorder(5,5,5,5)); 35 36 JPanel pnMain=new XuiPanel(); 37 pnMain.setLayout(new BorderLayout()); 38 39 XuiTitle lbTitle=new XuiTitle(VAGlobals.i18n("UI_License"),XuiTitle.LEFT); 40 lbTitle.setFont(new Font("SansSerif",Font.PLAIN,16)); 41 42 taLicense_=new JTextArea(); 43 taLicense_.setBackground(new Color(255,255,224)); 44 taLicense_.setBorder(new EmptyBorder(5,5,5,5)); 45 taLicense_.setFont(new Font("Monospaced",Font.PLAIN,12)); 46 taLicense_.setEditable(false); 47 JScrollPane spLicense=new JScrollPane(taLicense_); 48 spLicense.setBorder(new LineBorder(Color.black,2)); 49 spLicense.getVerticalScrollBar().setBackground(Color.black); 50 spLicense.getHorizontalScrollBar().setBackground(Color.black); 51 52 JPanel pnChoice=new XuiPanel(); 53 pnChoice.setOpaque(false); 54 pnChoice.setLayout(new BorderLayout(5,5)); 55 pnChoice.add(BorderLayout.WEST, new XuiLabel( 56 VAGlobals.i18n("UI_WantAcceptLicense"))); 57 JPanel pnRadios=new XuiPanel(); 58 pnRadios.setOpaque(false); 59 rdYes_=new XuiRadioButton(VAGlobals.i18n("Common_Yes")); 60 rdYes_.setSelected(false); 61 rdNo_=new XuiRadioButton(VAGlobals.i18n("Common_No")); 62 rdNo_.setSelected(true); 63 ButtonGroup bg=new ButtonGroup(); 64 bg.add(rdYes_); 65 bg.add(rdNo_); 66 pnRadios.add(rdYes_); 67 pnRadios.add(rdNo_); 68 pnChoice.add(BorderLayout.CENTER, pnRadios); 69 70 pnMain.add(BorderLayout.NORTH, lbTitle); 71 pnMain.add(BorderLayout.CENTER, spLicense); 72 pnMain.add(BorderLayout.SOUTH, pnChoice); 73 74 add(pnMain,BorderLayout.CENTER); 78 } 79 80 public void setText(InputStream lic) 81 { 82 String text=""; 83 if( lic==null ) { 84 text += VAGlobals.i18n("UI_NoLicense"); 85 } else { 86 try { 87 LineNumberReader in=new LineNumberReader(new InputStreamReader(lic, "UTF-8")); 88 String line=in.readLine(); 89 while( line!=null ) { 90 text+=line+"\n"; 91 line=in.readLine(); 92 } 93 in.close(); 94 } catch( IOException e ) { 95 text+=e.getMessage(); 96 } 97 } 98 taLicense_.setText(text); 99 taLicense_.setCaretPosition(0); 100 } 101 102 public boolean isLicenseAccepted() 103 { 104 return rdYes_.isSelected(); 105 } 106 } 107 | Popular Tags |