1 6 7 package com.memoire.vainstall.gui; 8 9 import java.awt.*; 10 import javax.swing.*; 11 import javax.swing.border.*; 12 import com.memoire.vainstall.VAUpgradeStep; 13 import com.memoire.vainstall.VAGlobals; 14 15 19 20 public class VAUpgradePanel 21 extends VAPanel 22 implements VAUpgradeStep 23 { 24 JLabel lbVersion_, lbStatus_; 25 JTextField tfDirectory_; 26 JRadioButton rdYes_, rdNo_; 27 JPanel pnChoice_; 28 29 public VAUpgradePanel() 30 { 31 super(); 32 33 setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); 34 35 JPanel pnMain=new JPanel(); 36 pnMain.setBorder(new CompoundBorder(new EtchedBorder(), 37 new EmptyBorder(new Insets(5, 5, 5, 5)))); 38 pnMain.setLayout(new BoxLayout(pnMain, BoxLayout.Y_AXIS)); 39 40 JPanel pnHaut=new JPanel(); 41 pnHaut.setLayout(new BorderLayout()); 42 43 JLabel lbTitle=new JLabel(VAGlobals.i18n("UI_Upgrade")); 44 lbTitle.setFont(lbTitle.getFont().deriveFont(Font.BOLD, 20)); 45 lbTitle.setOpaque(true); 46 lbTitle.setBorder(new EmptyBorder(new Insets(5, 0, 5, 0))); 47 lbTitle.setBackground(pnMain.getBackground().darker()); 48 lbTitle.setForeground(Color.white); 49 pnHaut.add(BorderLayout.NORTH, lbTitle); 50 51 JPanel pnDetails=new JPanel(); 52 pnDetails.setLayout(new GridLayout(4, 1)); 53 lbVersion_=new JLabel(); 54 lbVersion_.setForeground(pnDetails.getBackground()); 55 Font f=lbVersion_.getFont().deriveFont(Font.BOLD); 56 lbVersion_.setFont(f); 57 lbVersion_.setText(VAGlobals.i18n("UI_Invisible")); 58 pnDetails.add(new JLabel(VAGlobals.i18n("UI_PreviousVersionFound"))); 59 pnDetails.add(lbVersion_); 60 tfDirectory_=new JTextField(); 61 tfDirectory_.setEditable(false); 62 tfDirectory_.setText(""); 63 pnDetails.add(new JLabel( 64 VAGlobals.i18n("UI_InstallationDirectory"))); 65 pnDetails.add(tfDirectory_); 66 pnHaut.add(BorderLayout.SOUTH, pnDetails); 67 68 JPanel pnBas=new JPanel(); 69 pnBas.setLayout(new BorderLayout()); 70 71 pnChoice_=new JPanel(); 72 pnChoice_.setBorder(new EmptyBorder(new Insets(20, 0, 0, 0))); 73 pnChoice_.setLayout(new BorderLayout()); 74 pnChoice_.add(BorderLayout.CENTER, new JLabel( 75 VAGlobals.i18n("UI_WantToUpgrade"))); 76 JPanel pnRadios=new JPanel(); 77 rdYes_=new JRadioButton(VAGlobals.i18n("Common_Yes")); 78 rdYes_.setEnabled(true); 79 rdYes_.setSelected(false); 80 rdNo_=new JRadioButton(VAGlobals.i18n("Common_No")); 81 rdNo_.setEnabled(true); 82 rdNo_.setSelected(true); 83 ButtonGroup bg=new ButtonGroup(); 84 bg.add(rdYes_); 85 bg.add(rdNo_); 86 pnRadios.add(rdYes_); 87 pnRadios.add(rdNo_); 88 pnChoice_.add(BorderLayout.SOUTH, pnRadios); 89 setChoiceEnabled(false); 90 pnBas.add(BorderLayout.NORTH, pnChoice_); 91 92 lbStatus_=new JLabel(); 93 lbStatus_.setOpaque(true); 94 lbStatus_.setText(VAGlobals.i18n("UI_ClickNextToContinue")); 95 lbStatus_.setBackground(pnMain.getBackground().brighter()); 96 pnBas.add(BorderLayout.SOUTH, lbStatus_); 97 98 pnMain.add(pnHaut); 99 pnMain.add(pnBas); 100 101 JComponent pnImage=VAImagePanel.IMAGE_PANEL; 102 add(pnImage); 103 add(pnMain); 104 } 105 106 public void version(String msg) 107 { 108 lbVersion_.setForeground(Color.red); 109 lbVersion_.setText(msg); 110 } 112 113 public void setChoiceEnabled(boolean b) 114 { 115 pnChoice_.setVisible(b); 116 } 117 118 public void status(String msg) 119 { 120 lbStatus_.setText(msg); 121 } 123 124 public void directory(String msg) 125 { 126 tfDirectory_.setText(msg); 127 } 129 130 public boolean isConfirmUpgrade() 131 { 132 return rdYes_.isSelected(); 133 } 134 } 135 | Popular Tags |