JTabbedPane(7)

/**
*
*/
package test;
import java.awt.event.KeyEvent;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Event;
import java.awt.BorderLayout;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.KeyStroke;
import java.awt.Point;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JMenuItem;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JFrame;
import javax.swing.JDialog;
import javax.swing.JToolBar;
import java.awt.Rectangle;
import javax.swing.JScrollPane;
import javax.swing.JScrollBar;
import javax.swing.JToggleButton;
import javax.swing.JSlider;
import javax.swing.JTabbedPane;
import javax.swing.JButton;
import javax.swing.JTree;
/**
* @author QQ
*
*/
public class T6 {
private JFrame jFrame;
private JPanel jContentPane;
private JMenuBar jJMenuBar;
private JMenu fileMenu;
private JMenu editMenu;
private JMenu helpMenu;
private JMenuItem exitMenuItem;
private JMenuItem aboutMenuItem;
private JMenuItem cutMenuItem;
private JMenuItem copyMenuItem;
private JMenuItem pasteMenuItem;
private JMenuItem saveMenuItem;
private JTabbedPane jTabbedPane = null;
private JMenuItem jMenuItem = null;
private JMenuItem jMenuItem1 = null;
private JMenuItem jMenuItem2 = null;
private JTabbedPane jTabbedPane1 = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JScrollPane jScrollPane = null;
private JTree jTree = null;
/**
* This method initializes jTabbedPane
*
* @return javax.swing.JTabbedPane
*/
private JTabbedPane getJTabbedPane() {
   if (jTabbedPane == null) {
    jTabbedPane = new JTabbedPane();
    jTabbedPane.setBounds(new Rectangle(4, 3, 73, 57));
    jTabbedPane.addTab(null, null, getJMenuItem(), null);
    jTabbedPane.addTab(null, null, getJMenuItem1(), null);
    jTabbedPane.addTab(null, null, getJMenuItem2(), null);
    jTabbedPane.setAutoscrolls(true);
   
    jTabbedPane.addChangeListener(new javax.swing.event.ChangeListener() {
     public void stateChanged(javax.swing.event.ChangeEvent e) {
      System.out.println("stateChanged()");
      if(e.getSource().equals(jMenuItem)){
       System.out.println("你妈");
      }
     }
    });
   }
   return jTabbedPane;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem() {
   if (jMenuItem == null) {
    jMenuItem = new JMenuItem();
    jMenuItem.setText("你 ");
    jMenuItem.addActionListener(new java.awt.event.ActionListener() {
     public void actionPerformed(java.awt.event.ActionEvent e) {
      System.out.println("你妈"); // TODO Auto-generated Event stub actionPerformed()
     }
    });
   }
   return jMenuItem;
}
/**
* This method initializes jMenuItem1
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem1() {
   if (jMenuItem1 == null) {
    jMenuItem1 = new JMenuItem();
    jMenuItem1.setText("我");
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
     public void actionPerformed(java.awt.event.ActionEvent e) {
      System.out.println("你大妈"); // TODO Auto-generated Event stub actionPerformed()
     }
    });
   }
   return jMenuItem1;
}
/**
* This method initializes jMenuItem2
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem2() {
   if (jMenuItem2 == null) {
    jMenuItem2 = new JMenuItem();
    jMenuItem2.setText("他");
    jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
     public void actionPerformed(java.awt.event.ActionEvent e) {
      System.out.println("你二妈"); // TODO Auto-generated Event stub actionPerformed()
     }
    });
   }
   return jMenuItem2;
}
/**
* This method initializes jTabbedPane1
*
* @return javax.swing.JTabbedPane
*/
private JTabbedPane getJTabbedPane1() {
   if (jTabbedPane1 == null) {
    jTabbedPane1 = new JTabbedPane();
    jTabbedPane1.setBounds(new Rectangle(214, 1, 76, 60));
    jTabbedPane1.addTab(null, null, getJButton(), null);
    jTabbedPane1.addTab(null, null, getJButton1(), null);
    jTabbedPane1.addTab(null, null, getJButton2(), null);
   }
   return jTabbedPane1;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
   if (jButton == null) {
    jButton = new JButton();
    jButton.addActionListener(new java.awt.event.ActionListener() {
     public void actionPerformed(java.awt.event.ActionEvent e) {
      System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
     }
    });
   }
   return jButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getJButton1() {
   if (jButton1 == null) {
    jButton1 = new JButton();
    jButton1.addActionListener(new java.awt.event.ActionListener() {
     public void actionPerformed(java.awt.event.ActionEvent e) {
      System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
     }
    });
   }
   return jButton1;
}
/**
* This method initializes jButton2
*
* @return javax.swing.JButton
*/
private JButton getJButton2() {
   if (jButton2 == null) {
    jButton2 = new JButton();
    jButton2.addActionListener(new java.awt.event.ActionListener() {
     public void actionPerformed(java.awt.event.ActionEvent e) {
      System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
     }
    });
   }
   return jButton2;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
   if (jScrollPane == null) {
    jScrollPane = new JScrollPane();
    jScrollPane.setBounds(new Rectangle(91, 0, 105, 116));
    jScrollPane.setViewportView(getJTree());
   }
   return jScrollPane;
}
/**
* This method initializes jTree
*
* @return javax.swing.JTree
*/
private JTree getJTree() {
   if (jTree == null) {
    jTree = new JTree();
   
   
    jTree.addTreeExpansionListener(new javax.swing.event.TreeExpansionListener() {
     public void treeExpanded(javax.swing.event.TreeExpansionEvent e) {
      System.out.println("treeExpanded()"); // TODO Auto-generated Event stub treeExpanded()
     }
     public void treeCollapsed(javax.swing.event.TreeExpansionEvent e) {
     }
    });
    jTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
     public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
      System.out.println("valueChanged()"); // TODO Auto-generated Event stub valueChanged()
     }
    });
   }
   return jTree;
}
/**
* @param args
*/
public static void main(String[] args) {
   // TODO Auto-generated method stub
   SwingUtilities.invokeLater(new Runnable() {
    public void run() {
     T6 application = new T6();
     application.getJFrame().setVisible(true);
    }
   });
}
/**
* This method initializes jFrame
*
* @return javax.swing.JFrame
*/
private JFrame getJFrame() {
   if (jFrame == null) {
    jFrame = new JFrame();
    jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jFrame.setJMenuBar(getJJMenuBar());
    jFrame.setSize(300, 200);
    jFrame.setContentPane(getJContentPane());
    jFrame.setTitle("Application");
   }
   return jFrame;
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
   if (jContentPane == null) {
    jContentPane = new JPanel();
    jContentPane.setLayout(null);
    jContentPane.add(getJTabbedPane(), null);
    jContentPane.add(getJTabbedPane1(), null);
    jContentPane.add(getJScrollPane(), null);
   }
   return jContentPane;
}
/**
* This method initializes jJMenuBar
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getJJMenuBar() {
   if (jJMenuBar == null) {
    jJMenuBar = new JMenuBar();
    jJMenuBar.add(getFileMenu());
    jJMenuBar.add(getEditMenu());
    jJMenuBar.add(getHelpMenu());
   }
   return jJMenuBar;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getFileMenu() {
   if (fileMenu == null) {
    fileMenu = new JMenu();
    fileMenu.setText("File");
    fileMenu.add(getSaveMenuItem());
    fileMenu.add(getExitMenuItem());
   }
   return fileMenu;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getEditMenu() {
   if (editMenu == null) {
    editMenu = new JMenu();
    editMenu.setText("Edit");
    editMenu.add(getCutMenuItem());
    editMenu.add(getCopyMenuItem());
    editMenu.add(getPasteMenuItem());
   }
   return editMenu;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getHelpMenu() {
   if (helpMenu == null) {
    helpMenu = new JMenu();
    helpMenu.setText("Help");
    helpMenu.add(getAboutMenuItem());
   }
   return helpMenu;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExitMenuItem() {
   if (exitMenuItem == null) {
    exitMenuItem = new JMenuItem();
    exitMenuItem.setText("Exit");
    exitMenuItem.addActionListener(new ActionListener() {
     public void actionPerformed(ActionEvent e) {
      System.exit(0);
     }
    });
   }
   return exitMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getAboutMenuItem() {
   if (aboutMenuItem == null) {
    aboutMenuItem = new JMenuItem();
    aboutMenuItem.setText("About");
    aboutMenuItem.addActionListener(new ActionListener() {
     public void actionPerformed(ActionEvent e) {
     
     }
    });
   }
   return aboutMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getCutMenuItem() {
   if (cutMenuItem == null) {
    cutMenuItem = new JMenuItem();
    cutMenuItem.setText("Cut");
    cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
      Event.CTRL_MASK, true));
   }
   return cutMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getCopyMenuItem() {
   if (copyMenuItem == null) {
    copyMenuItem = new JMenuItem();
    copyMenuItem.setText("Copy");
    copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
      Event.CTRL_MASK, true));
   }
   return copyMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getPasteMenuItem() {
   if (pasteMenuItem == null) {
    pasteMenuItem = new JMenuItem();
    pasteMenuItem.setText("Paste");
    pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
      Event.CTRL_MASK, true));
   }
   return pasteMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getSaveMenuItem() {
   if (saveMenuItem == null) {
    saveMenuItem = new JMenuItem();
    saveMenuItem.setText("Save");
    saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
      Event.CTRL_MASK, true));
   }
   return saveMenuItem;
}
}

你可能感兴趣的:(职场,休闲)