下拉框
package swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JFCResume2 extends JFrame implements ItemListener {
/** Initializes the applet Resume */
public static void main (String[] args) {
final JFCResume2 res = new JFCResume2();
res.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent evt) {
res.setVisible(false);
res.dispose();
System.exit(0);
}
});
res.setLayoutManager();
res.initComponents ();
res.pack();
res.setVisible(true);
}
public void setLayoutManager() {
getContentPane().setLayout(new FlowLayout());
}
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
choice2 = new JComboBox();
choice2.addItem("Objective");
choice2.addItem("Qualification");
choice2.addItem("Experience");
choice2.addItem("Skillset");
choice2.addItem("Education");
choice2.addItem("Training");
choice2.addItemListener(this);
//choice2.select(0);
panel1 = new JPanel();
panel2 = new JScrollPane();
textArea1 = new JTextArea();
panel3 = new JScrollPane();
textArea2 = new JTextArea();
panel4 = new JScrollPane();
textArea3 = new JTextArea();
panel5 = new JScrollPane();
textArea4 = new JTextArea();
panel6 = new JScrollPane();
textArea5 = new JTextArea();
panel7 = new JScrollPane();
textArea6 = new JTextArea();
choice2.setFont(new java.awt.Font ("Dialog", 0, 11));
choice2.setName("choice2");
choice2.setBackground(java.awt.Color.white);
choice2.setForeground(java.awt.Color.black);
getContentPane().add(choice2);
panel1.setLayout(new java.awt.CardLayout());
panel1.setFont(new java.awt.Font ("Dialog", 0, 11));
panel1.setName("panel20");
panel1.setBackground(new java.awt.Color (204, 204, 204));
panel1.setForeground(java.awt.Color.black);
panel2.setFont(new java.awt.Font ("Dialog", 0, 11));
panel2.setName("panel21");
panel2.setBackground(new java.awt.Color (153, 153, 153));
panel2.setForeground(java.awt.Color.black);
textArea2.setBackground(new java.awt.Color (216, 208, 200));
textArea2.setName("text4");
textArea2.setEditable(false);
textArea2.setFont(new java.awt.Font ("Courier New", 0, 12));
textArea2.setColumns(80);
textArea2.setForeground(new java.awt.Color (0, 0, 204));
textArea2.setText("Seeking a challenging position as a JAVA Programmer."n");
textArea2.setRows(20);
panel2.getViewport().add(textArea2,null);
panel1.add(panel2, "Objective");
panel3.setFont(new java.awt.Font ("Dialog", 0, 11));
panel3.setName("panel22");
panel3.setBackground(new java.awt.Color (153, 153, 153));
panel3.setForeground(java.awt.Color.black);
textArea1.setBackground(new java.awt.Color (216, 208, 200));
textArea1.setName("text3");
textArea1.setEditable(false);
textArea1.setFont(new java.awt.Font ("Courier New", 1, 12));
textArea1.setColumns(80);
textArea1.setForeground(java.awt.Color.black);
textArea1.setText("* 7 years C/C++ experience on UNIX/Windows"n * 7 years experience in RDBMS, including Oracle, Informix and Sybase"n* 3 years programming experience in JAVA on UNIX/WINDOWS"n* 2 years experience in designing and developing in J2EE"n ");
textArea1.setRows(20);
panel3.getViewport().add(textArea1,null);
panel1.add(panel3, "Qualification");
panel4.setFont(new java.awt.Font ("Dialog", 0, 11));
panel4.setName("panel23");
panel4.setBackground(new java.awt.Color (153, 153, 153));
panel4.setForeground(java.awt.Color.black);
textArea3.setBackground(new java.awt.Color (216, 208, 200));
textArea3.setName("text5");
textArea3.setEditable(false);
textArea3.setFont(new java.awt.Font ("Courier New", 0, 12));
textArea3.setColumns(80);
textArea3.setForeground(java.awt.Color.blue);
textArea3.setText("Technical Support / Systems Engineer"nSun Microsystems Inc. China Ltd. PRC "n");
textArea3.setRows(20);
panel4.getViewport().add(textArea3,null);
panel1.add(panel4, "Experience");
panel5.setFont(new java.awt.Font ("Dialog", 0, 11));
panel5.setName("panel24");
panel5.setBackground(new java.awt.Color (153, 153, 153));
panel5.setForeground(java.awt.Color.black);
textArea4.setBackground(new java.awt.Color (216, 208, 200));
textArea4.setName("text6");
textArea4.setEditable(false);
textArea4.setFont(new java.awt.Font ("Courier New", 0, 12));
textArea4.setColumns(80);
textArea4.setForeground(java.awt.Color.blue);
textArea4.setText("Programming:C, C++, JAVA, HTML, XML "n");
textArea4.setRows(20);
panel5.getViewport().add(textArea4,null);
panel1.add(panel5, "Skillset");
panel6.setFont(new java.awt.Font ("Dialog", 0, 11));
panel6.setName("panel25");
panel6.setBackground(new java.awt.Color (153, 153, 153));
panel6.setForeground(java.awt.Color.black);
textArea5.setBackground(new java.awt.Color (216, 208, 200));
textArea5.setName("text7");
textArea5.setEditable(false);
textArea5.setFont(new java.awt.Font ("Courier New", 0, 12));
textArea5.setColumns(80);
textArea5.setForeground(java.awt.Color.blue);
textArea5.setText("University of Science and Technology of China "n");
textArea5.setRows(20);
panel6.getViewport().add(textArea5,null);
panel1.add(panel6, "Education");
panel7.setFont(new java.awt.Font ("Dialog", 0, 11));
panel7.setName("panel26");
panel7.setBackground(new java.awt.Color (153, 153, 153));
panel7.setForeground(java.awt.Color.black);
textArea6.setBackground(new java.awt.Color (216, 208, 200));
textArea6.setName("text8");
textArea6.setEditable(false);
textArea6.setFont(new java.awt.Font ("Courier New", 0, 12));
textArea6.setColumns(80);
textArea6.setForeground(java.awt.Color.blue);
textArea6.setText("Sun Microsystems Inc. 1998-2001"nAttended training course "n");
textArea6.setRows(20);
panel7.getViewport().add(textArea6,null);
panel1.add(panel7, "Training");
getContentPane().add(panel1);
}//GEN-END:initComponents
public void itemStateChanged(ItemEvent evt) {
CardLayout card = (CardLayout)panel1.getLayout();
card.show(panel1, (String)evt.getItem());
}
// Variables declaration - do not modify//GEN-BEGIN:variables
//private java.awt.Choice choice2;
private JComboBox choice2;
private JPanel panel1;
private JScrollPane panel2;
private JTextArea textArea1;
private JScrollPane panel3;
private JTextArea textArea2;
private JScrollPane panel4;
private JTextArea textArea3;
private JScrollPane panel5;
private JTextArea textArea4;
private JScrollPane panel6;
private JTextArea textArea5;
private JScrollPane panel7;
private JTextArea textArea6;
// End of variables declaration//GEN-END:variables
}