001: /**
002: * $RCSfile: VAUpgradePanel.java,v $
003: * @creation 13/05/00
004: * @modification $Date: 2004/02/02 20:57:59 $
005: */package com.memoire.vainstall.gui;
006:
007: import java.awt.*;
008: import javax.swing.*;
009: import javax.swing.border.*;
010: import com.memoire.vainstall.VAUpgradeStep;
011: import com.memoire.vainstall.VAGlobals;
012:
013: /**
014: * @version $Id: VAUpgradePanel.java,v 1.5 2004/02/02 20:57:59 deniger Exp $
015: * @author Axel von Arnim
016: */
017:
018: public class VAUpgradePanel extends VAPanel implements VAUpgradeStep {
019: JLabel lbVersion_, lbStatus_;
020: JTextField tfDirectory_;
021: JRadioButton rdYes_, rdNo_;
022: JPanel pnChoice_;
023:
024: public VAUpgradePanel() {
025: super ();
026:
027: setLayout(new BoxLayout(this , BoxLayout.X_AXIS));
028:
029: JPanel pnMain = new JPanel();
030: pnMain.setBorder(new CompoundBorder(new EtchedBorder(),
031: new EmptyBorder(new Insets(5, 5, 5, 5))));
032: pnMain.setLayout(new BoxLayout(pnMain, BoxLayout.Y_AXIS));
033:
034: JPanel pnHaut = new JPanel();
035: pnHaut.setLayout(new BorderLayout());
036:
037: JLabel lbTitle = new JLabel(VAGlobals.i18n("UI_Upgrade"));
038: lbTitle.setFont(lbTitle.getFont().deriveFont(Font.BOLD, 20));
039: lbTitle.setOpaque(true);
040: lbTitle.setBorder(new EmptyBorder(new Insets(5, 0, 5, 0)));
041: lbTitle.setBackground(pnMain.getBackground().darker());
042: lbTitle.setForeground(Color.white);
043: pnHaut.add(BorderLayout.NORTH, lbTitle);
044:
045: JPanel pnDetails = new JPanel();
046: pnDetails.setLayout(new GridLayout(4, 1));
047: lbVersion_ = new JLabel();
048: lbVersion_.setForeground(pnDetails.getBackground());
049: Font f = lbVersion_.getFont().deriveFont(Font.BOLD);
050: lbVersion_.setFont(f);
051: lbVersion_.setText(VAGlobals.i18n("UI_Invisible"));
052: pnDetails.add(new JLabel(VAGlobals
053: .i18n("UI_PreviousVersionFound")));
054: pnDetails.add(lbVersion_);
055: tfDirectory_ = new JTextField();
056: tfDirectory_.setEditable(false);
057: tfDirectory_.setText("");
058: pnDetails.add(new JLabel(VAGlobals
059: .i18n("UI_InstallationDirectory")));
060: pnDetails.add(tfDirectory_);
061: pnHaut.add(BorderLayout.SOUTH, pnDetails);
062:
063: JPanel pnBas = new JPanel();
064: pnBas.setLayout(new BorderLayout());
065:
066: pnChoice_ = new JPanel();
067: pnChoice_.setBorder(new EmptyBorder(new Insets(20, 0, 0, 0)));
068: pnChoice_.setLayout(new BorderLayout());
069: pnChoice_.add(BorderLayout.CENTER, new JLabel(VAGlobals
070: .i18n("UI_WantToUpgrade")));
071: JPanel pnRadios = new JPanel();
072: rdYes_ = new JRadioButton(VAGlobals.i18n("Common_Yes"));
073: rdYes_.setEnabled(true);
074: rdYes_.setSelected(false);
075: rdNo_ = new JRadioButton(VAGlobals.i18n("Common_No"));
076: rdNo_.setEnabled(true);
077: rdNo_.setSelected(true);
078: ButtonGroup bg = new ButtonGroup();
079: bg.add(rdYes_);
080: bg.add(rdNo_);
081: pnRadios.add(rdYes_);
082: pnRadios.add(rdNo_);
083: pnChoice_.add(BorderLayout.SOUTH, pnRadios);
084: setChoiceEnabled(false);
085: pnBas.add(BorderLayout.NORTH, pnChoice_);
086:
087: lbStatus_ = new JLabel();
088: lbStatus_.setOpaque(true);
089: lbStatus_.setText(VAGlobals.i18n("UI_ClickNextToContinue"));
090: lbStatus_.setBackground(pnMain.getBackground().brighter());
091: pnBas.add(BorderLayout.SOUTH, lbStatus_);
092:
093: pnMain.add(pnHaut);
094: pnMain.add(pnBas);
095:
096: JComponent pnImage = VAImagePanel.IMAGE_PANEL;
097: add(pnImage);
098: add(pnMain);
099: }
100:
101: public void version(String msg) {
102: lbVersion_.setForeground(Color.red);
103: lbVersion_.setText(msg);
104: //RepaintManager.currentManager(lbVersion_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
105: }
106:
107: public void setChoiceEnabled(boolean b) {
108: pnChoice_.setVisible(b);
109: }
110:
111: public void status(String msg) {
112: lbStatus_.setText(msg);
113: //RepaintManager.currentManager(lbStatus_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
114: }
115:
116: public void directory(String msg) {
117: tfDirectory_.setText(msg);
118: //RepaintManager.currentManager(tfDirectory_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
119: }
120:
121: public boolean isConfirmUpgrade() {
122: return rdYes_.isSelected();
123: }
124: }
|