KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > xui > XuiUpgradePanel


1 /**
2  * $RCSfile: XuiUpgradePanel.java,v $
3  * @creation 13/05/00
4  * @modification $Date: 2004/02/02 20:57:58 $
5  */

6
7 package com.memoire.vainstall.xui;
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 /**
16  * @version $Id: XuiUpgradePanel.java,v 1.5 2004/02/02 20:57:58 deniger Exp $
17  * @author Guillaume Desnoix
18  */

19
20 public class XuiUpgradePanel
21        extends XuiAbstractPanel
22        implements VAUpgradeStep
23 {
24   JLabel lbVersion_, lbStatus_;
25   JTextField tfDirectory_;
26   JRadioButton rdYes_, rdNo_;
27   JPanel pnChoice_;
28
29   public XuiUpgradePanel()
30   {
31     super();
32     
33     setLayout(new BorderLayout());
34
35     JPanel pnMain=new XuiPanel();
36     pnMain.setLayout(new BorderLayout());
37     pnMain.setBorder(new EmptyBorder(5,5,5,5));
38     pnMain.setForeground(new Color(128,255,255));
39
40     JPanel pnDetails=new XuiPanel();
41     pnDetails.setLayout(new GridLayout(4,0));
42     pnDetails.setBorder(new CompoundBorder(new LineBorder(Color.black,2),
43                        new CompoundBorder(new EmptyBorder(5,5,5,5),
44                                   new LineBorder(Color.black,2))));
45
46     JLabel lb1=new XuiLabel(VAGlobals.i18n("UI_PreviousVersionFound"));
47     lb1.setBackground(new Color(160,224,224));
48     lb1.setBorder(new EmptyBorder(0,5,0,5));
49     lb1.setOpaque(true);
50     pnDetails.add(lb1);
51
52     lbVersion_=new XuiLabel(VAGlobals.i18n("UI_Invisible"));
53     lbVersion_.setBackground(new Color(255,255,224));
54     lbVersion_.setForeground(new Color(255,255,224));
55     // lbVersion_.setFont(new Font("SansSerif", Font.BOLD, 16));
56
lbVersion_.setBorder(new EmptyBorder(0,5,0,5));
57     lbVersion_.setOpaque(true);
58     pnDetails.add(lbVersion_);
59
60     JLabel lb2=new XuiLabel(VAGlobals.i18n("UI_InstallationDirectory"));
61     lb2.setBackground(new Color(160,224,224));
62     lb2.setBorder(new EmptyBorder(0,5,0,5));
63     lb2.setOpaque(true);
64     pnDetails.add(lb2);
65
66     tfDirectory_=new JTextField();
67     tfDirectory_.setBackground(new Color(255,255,224));
68     tfDirectory_.setBorder(new EmptyBorder(0,5,0,5));
69     tfDirectory_.setEditable(false);
70     tfDirectory_.setText("");
71     pnDetails.add(tfDirectory_);
72
73     pnChoice_=new XuiPanel();
74     pnChoice_.setLayout(new BorderLayout());
75     pnChoice_.add(BorderLayout.CENTER, new XuiLabel(
76       VAGlobals.i18n("UI_WantToUpgrade")));
77     JPanel pnRadios=new XuiPanel();
78     rdYes_=new XuiRadioButton(VAGlobals.i18n("Common_Yes"));
79     rdYes_.setEnabled(true);
80     rdYes_.setSelected(false);
81     rdNo_=new XuiRadioButton(VAGlobals.i18n("Common_No"));
82     rdNo_.setEnabled(true);
83     rdNo_.setSelected(true);
84     ButtonGroup bg=new ButtonGroup();
85     bg.add(rdYes_);
86     bg.add(rdNo_);
87     pnRadios.add(rdYes_);
88     pnRadios.add(rdNo_);
89     pnChoice_.add(BorderLayout.SOUTH, pnRadios);
90     pnChoice_.setVisible(false);
91
92     lbStatus_=new XuiLabel(VAGlobals.i18n("UI_ClickNextToContinue"));
93
94     XuiTitle lbTitle=new XuiTitle(VAGlobals.i18n("UI_Upgrade"),XuiTitle.LEFT);
95     lbTitle.setFont(new Font("SansSerif",Font.PLAIN,16));
96
97     JPanel q=new JPanel();
98     q.setOpaque(false);
99     q.setBorder(null);
100     q.setLayout(new BorderLayout());
101     q.add(lbTitle ,BorderLayout.NORTH);
102     q.add(pnDetails,BorderLayout.CENTER);
103    
104     pnMain.add(q ,BorderLayout.NORTH );
105     pnMain.add(pnChoice_,BorderLayout.CENTER);
106     pnMain.add(lbStatus_,BorderLayout.SOUTH );
107     
108     JPanel pnImage=XuiImagePanel.IMAGE_PANEL;
109     add(pnImage,BorderLayout.WEST);
110     add(pnMain ,BorderLayout.CENTER);
111   }
112
113   public void version(String JavaDoc msg)
114   {
115     lbVersion_.setForeground(Color.red);
116     lbVersion_.setText(msg);
117     //RepaintManager.currentManager(lbVersion_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
118
}
119   
120   public void setChoiceEnabled(boolean b)
121   {
122     pnChoice_.setVisible(b);
123   }
124   
125   public void status(String JavaDoc msg)
126   {
127     lbStatus_.setText(msg);
128     //RepaintManager.currentManager(lbStatus_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
129
}
130   
131   public void directory(String JavaDoc msg)
132   {
133     tfDirectory_.setText(msg);
134     //RepaintManager.currentManager(tfDirectory_).paintDirtyRegions(); // OSX Repaint - see VAWizard.java
135
}
136
137   public boolean isConfirmUpgrade()
138   {
139     return rdYes_.isSelected();
140   }
141 }
142
Popular Tags