package UserJFrame; import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import java.awt.Dimension; import java.awt.FileDialog; import java.awt.Font; import java.awt.GraphicsEnvironment; import java.awt.GridLayout; import java.awt.Label; import java.awt.MenuBar; import java.awt.Panel; import java.awt.TrayIcon.MessageType; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.font.TextLayout; import javax.swing.ButtonGroup; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Group; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.LayoutStyle; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.plaf.basic.BasicBorders.RadioButtonBorder; import javax.swing.text.StyledEditorKit.BoldAction; public class UserJFrame extends JFrame implements ActionListener, MouseListener { private JButton btnAdd; private JTextArea textarea; private JRadioButton btnMan,btnFelman; private JTextField tfdNumber,tfdName; private JComboBox comProvince,comCitys; private int number=1; private Object[][] citys; private JTextField tfd1; private JMenuItem jmenuItemcolor[]=null; private JDialog jdialog1,jdialogsave; private Font font1; private JPopupMenu jpopupmenu; private JPanel jpanel1,jpanel2; private JComboBox combofonename,combofonesize; private JCheckBox checkBold,checkItalic; private JRadioButton radioColor[]; private Font font; public UserJFrame(Object[] province, Object[][] citys) { super("Personal Information Statistics"); this.citys=citys; this.setBounds(200, 200, 650, 400); this.getContentPane().setBackground(Color.lightGray); this.getContentPane().setLayout(new BorderLayout()); this.setDefaultCloseOperation(EXIT_ON_CLOSE); //Setting menu bar addMymenu();//Call the menu bar code declared below jpanel1=new JPanel();//A panel for storing toolbars jpanel2=new JPanel();//The panel used to do the following text area and information addition area JToolBar jtoolbar=new JToolBar();//Make space for toolbars //Following are the contents of the toolbar, including font size settings, font settings, font selection boxes //Getting System Font GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment(); String fonesName[]=ge.getAvailableFontFamilyNames(); combofonename=new JComboBox(fonesName); combofonename.addActionListener(this);//Audio for adding fonts jtoolbar.add(combofonename); //Font Size Settings String fonesSize[]={"20","30","40","50","60","70"}; combofonesize=new JComboBox(fonesSize); combofonesize.addActionListener(this); jtoolbar.add(combofonesize); combofonesize.setEditable(true); //Font selection checkBold=new JCheckBox("bold"); checkItalic=new JCheckBox("Italics"); jtoolbar.add(checkBold); jtoolbar.add(checkItalic); //Color selection String colorStr[]={"red","green","blue","black"}; radioColor=new JRadioButton[colorStr.length]; ButtonGroup group=new ButtonGroup(); for(int i=0;i<colorStr.length;i++){ radioColor[i]=new JRadioButton(colorStr[i]); jtoolbar.add(radioColor[i]); group.add(radioColor[i]); radioColor[i].addActionListener(this); } jpanel1.add(jtoolbar);//Add toolbar to jpanel1 in this.getContentPane().add(jpanel1, BorderLayout.NORTH);//Set up jpanel1 Location and add to the entire panel this.getContentPane().add(jpanel2);//jpanel2 piece in jpanel2.setLayout(new GridLayout(1, 2));//Divide the interface into two parts, with text box eyes on the left and information columns on the right. textarea=new JTextArea(); //textarea.setEditable(false); //If there is this code, the text box cannot be edited jpanel2.add(new JScrollPane(textarea)); JPanel jpanel=new JPanel(new GridLayout(7, 1)); jpanel2.add(jpanel); //Add various elements to the right panel tfdNumber=new JTextField("1"); tfdNumber.setEditable(false); jpanel.add(tfdNumber); tfdName=new JTextField("Full name:"); jpanel.add(tfdName); JPanel jpanelrd=new JPanel(new GridLayout(1,2)); btnMan=new JRadioButton("male",true); btnFelman=new JRadioButton("female"); jpanelrd.add(btnMan); jpanelrd.add(btnFelman); jpanel.add(jpanelrd); ButtonGroup btngroup=new ButtonGroup();// Make the keys (male, female) mutually exclusive, only one can be selected,So put them in the same button group. btngroup.add(btnMan); btngroup.add(btnFelman); //Provincial Combination Box comProvince=new JComboBox(province); comProvince.addActionListener(this); jpanel.add(comProvince); comCitys=new JComboBox(citys[0]); jpanel.add(comCitys); tfd1=new JTextField("Remarks:"); jpanel.add(tfd1); btnAdd=new JButton("Add to"); btnAdd.addActionListener(this); jpanel.add(btnAdd); //Add the right mouse button shortcut menu jpopupmenu=new JPopupMenu(); String popumenuItem[]={"paste","copy","shear"}; JMenuItem popumenuItemadd[]=new JMenuItem[popumenuItem.length]; for(int i=0;i<popumenuItem.length;i++){ popumenuItemadd[i]=new JMenuItem(popumenuItem[i]); jpopupmenu.add(popumenuItemadd[i]); popumenuItemadd[i].addActionListener(this); } textarea.add(jpopupmenu); textarea.addMouseListener(this); this.setVisible(true); } private void addMymenu() { JMenuBar jmenubar=new JMenuBar(); setJMenuBar(jmenubar); String menustr[]={"file","edit","Help"}; JMenu menu[]=new JMenu[menustr.length]; for(int i=0;i<menustr.length;i++){ menu[i]=new JMenu(menustr[i]); jmenubar.add(menu[i]); } //"file"Submenu of menu JMenuItem open=new JMenuItem("open"); open.setActionCommand("open"); open.addActionListener(this); menu[0].add(open); JMenuItem save=new JMenuItem("Preservation"); menu[0].add(save); menu[0].addSeparator(); JMenuItem past=new JMenuItem("paste"); past.addActionListener(this); menu[0].add(past); JMenuItem copy=new JMenuItem("copy"); copy.addActionListener(this); menu[0].add(copy); JMenuItem cut=new JMenuItem("shear"); cut.addActionListener(this); menu[0].add(cut); menu[0].addSeparator(); JMenuItem exit=new JMenuItem("Sign out"); exit.setActionCommand("exit"); exit.addActionListener(this); menu[0].add(exit); //"edit "Submenu of menu JMenu wordstyle=new JMenu("Glyph"); menu[1].add(wordstyle); JMenu colorstyle=new JMenu("color setting"); menu[1].add(colorstyle); //Set up the "font menu of two levels" String wordstyle1[]={"bold","Italics"}; JMenuItem jmenuitem[]=new JMenuItem[wordstyle1.length]; for(int i=0;i<wordstyle1.length;i++){ jmenuitem[i]=new JMenuItem(wordstyle1[i]); wordstyle.add(jmenuitem[i]); jmenuitem[i].addActionListener(this); } //Setting the "Color Settings" Level 2 Menu String colorstyle1[]={"red","green","blue","black"}; jmenuItemcolor=new JMenuItem[colorstyle1.length]; for(int i=0;i<colorstyle1.length;i++){ jmenuItemcolor[i]=new JMenuItem(colorstyle1[i]); colorstyle.add(jmenuItemcolor[i]); jmenuItemcolor[i].addActionListener(this); } JMenuItem jmenuitemhelp=new JMenuItem("Relevant Help Consultation"); jmenuitemhelp.addActionListener(this); menu[2].add(jmenuitemhelp); } @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==btnAdd){ String aline; //Add name and number aline=this.number+","+tfdName.getText(); //Add sex if(btnMan.isSelected()){ aline=aline+","+btnMan.getText(); } if(btnFelman.isSelected()){ aline=aline+","+btnFelman.getText(); } //Add provinces aline=aline+","+comProvince.getSelectedItem(); //Add municipal level aline=aline+","+comCitys.getSelectedItem(); //Add remarks aline=aline+","+tfd1.getText(); tfd1.setText("Remarks:"); textarea.append(aline+"\n"); this.number++; tfdNumber.setText(""+this.number); tfdName.setText("Full name:"); } else if(e.getSource()==comProvince){ int i=comProvince.getSelectedIndex(); comCitys.removeAllItems(); System.out.println(citys[i].length); for(int j=0;j<citys[i].length;j++){ comCitys.addItem(citys[i][j]); } } else if(e.getSource() instanceof JMenuItem||e.getSource() instanceof JRadioButton){ //Setting up color monitor Color color=null; //Using Reference Thinking to Make Colors if(e.getActionCommand().equals("red")){ color=new Color(255,0,0); } if(e.getActionCommand().equals("green")){ color=new Color(0,255,0); } if(e.getActionCommand().equals("blue")){ color=new Color(0,0,255); } if(e.getActionCommand().equals("black")){ color=new Color(0,0,0); } textarea.setForeground(color); //Setting up help monitoring if(e.getActionCommand().equalsIgnoreCase("Relevant Help Consultation")){ jdialog1=new JDialog(this,true); jdialog1.setSize(330, 100); int lx=getX()+20; int ly=getY()+20; jdialog1.setLocation(lx, ly); jdialog1.add(new Label("Relevant help please consult telephone 10010, the final right to explain belongs to Unicom!")); jdialog1.setVisible(true); } //Setting font monitoring if(e.getActionCommand().equals("bold")){ font1=new Font(getName(),20, 20); textarea.setFont(font1); } if(e.getActionCommand().equals("Italics")){ } //Exit monitoring if(e.getActionCommand().equalsIgnoreCase("exit")){ int option=JOptionPane.showConfirmDialog(this, "Are you sure you want to save and exit?"); if(option==JOptionPane.OK_OPTION){ System.out.println("In preservation..."); System.exit(0); } if(option==JOptionPane.NO_OPTION){ System.exit(0); } if(option==JOptionPane.CANCEL_OPTION){ return; } } //Preserved listening if(e.getActionCommand().equalsIgnoreCase("copy")){ textarea.copy(); } //Paste monitoring if(e.getActionCommand().equalsIgnoreCase("paste")){ textarea.paste(); } //Shear monitoring if(e.getActionCommand().equalsIgnoreCase("shear")){ textarea.cut(); } //Open listening if(e.getActionCommand().equals("open")){ openFile(); } } //Glyph monitoring /*if(e.getSource() instanceof JComboBox ){ String fontName=(String) combofonename.getSelectedItem(); int fontSize=0; String strSize=(String) combofonesize.getSelectedItem(); int style = changeStyle(e); font=new Font(fontName, style, fontSize); textarea.setFont(font); } } private int changeStyle(ActionEvent e) { // TODO Auto-generated method stub return 0;*/ } private void openFile() { FileDialog openFileDlg = new FileDialog(this, "Open file", FileDialog.LOAD); openFileDlg.setVisible(true); } @Override public void mouseClicked(MouseEvent e) { if(e.getModifiers()==MouseEvent.BUTTON3_MASK){ jpopupmenu.show(textarea,e.getX(), e.getY()); } } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public static void main(String[] args) { Object province[]={"Sichuan Province","Hunan Province","Jiangsu Province"}; Object citys[][]={{"Chengdu City","suining city","Nanchong City","deyang","Mianyang City"}, {"Yiyang City","Changsha City","Zhuzhou City","Xiangtan City","Yueyang City"}, {"Nanjing City","Suzhou City","Wuxi City"} }; new UserJFrame(province,citys); } }
https://blog.csdn.net/asd529735325
package UserJFrame; import java.awt.BorderLayout; import java.awt.BorderLayout; import java.awt.import java.awt.Button import import java.awt. java.awt. import java.java.awt.importjavjavjava.awt.FileDialog import import java.awt.FileDialog; import java.awt.Font import java.awt.Font import import java.awt.GraphicsEnvironment import java.awt.GraphicsEnvironment import java.awt.import java.awt.javawt.Label import import import Java java.awt.awt.import import import import import javjavjava yIcon. MessageType; import java. Awt. event. Action Action Event; import java. awt. event. event. ActionEvent; import java. awt. event. import java. awt. event. MouseEvent import java. awt. event. MouseListener import import java. awt. font. font. TextLayout import javax. swing. ButtonGroup import javax. javax. swing. ButtonGroup import javax. javax. javax. swing. GroupLaxGroup import javax javax javax. javax. javax. swing. GroupLaxGroup; import import javax javax javjavax. javjavax. javjavax. javax. javjavjavjavjavjavswing.JComboBox; imp Javax. swing. JDialog; import javax. swing. JFileChooser; import javax. swing. JFileChooser; import javax. swing. JFrame; import javax. swing. JMenu; import javax. swing. JMenuBar; import javax. swing. JMenuItem; import javax. swing. JMenuItem; import javax. javax. swing. JMenuItem import javax. javax. swing. javax. javax. swing. JPanel; import javax javax. javjavjavax. javjavjavjavjavjavax. swing. JPax import javjavjavjavjavax. swing. JScrollPane; import javax. swing. JTextArea; import Javax. swing. JTextField; import javax. swing. JToolBar; import javax. swing. JToolBar; import javax. swing. import javax. swing. LayoutStyle; import javax. swing. filechooser. FileNameExtension Filter; import javax. swing. plaf. basic. BasicBorders. RadioButtonButtonBorder; import javax. swing. text. import javax. swing. text. StyledEditoKit. Kit. EditoKit. BoldKit. BoldClassClassClass Public Action javjavax FrameJextenextenJFrame JavaJavaJavaJavaax Frame. javax. Swing. javax n BtnAdd; private JTextArea textarea; private JRadioButton btnMan, btnFelman; private JTextField tfdNumber, tfdName; private JComboBox com province, comCitys; private int number = 1; private Object [][] citys; private JTextField tfd1; private JMenuItem jmenuItem color []= null; private Dialog 1, jdialog save; private FotnFelman; private JPjpopu; upupupmenu; upprivu; JPanel jpanel1, jpanel2; private JComboBox combofonename, combofonesize; private JCheckBox checkBold, checkItalic; private JRadioButton radiocolor []; private Font font; public User JFrame (Object [] province, Object [] citys) {super ("personal information statistics"); this. citys = citys; this. sets (200, 200, 650, 400); this. getContent Pane (). Background (Light Gr). This. getContentPane (). setLayout (new BorderLayout ()); this. setDefault Close Operation (EXIT_ON_CLOSE); //Set the menu bar addMymenu(); //Call the menu bar related code jpanel1=new JPanel(); //The panel jpanel2=new JPanel(); //The panel JToolBartoolbar = JToolBar (); //Give tools The open space of the toolbar // below is the content of the toolbar, including font size settings, font settings, font selection box // Get the system font Graphics Environment = Graphics Environment. getLocalGraphics Environment (); String fonesName [] = ge. getAvailable Font Family Names (); combofonename = new JComboBox (fonesName); combofname. ActionListener (this); and //Add fonts to monitor jto jto jfonts Combofolbar. add (combofonename); // font size setString fonesSize []]= {"20",""""",,""30""""""40"""""50"""""60"""}; combofonesize = new JComboBox (fonesSize); combofonesize. addionListener (this); jtoolbar. add (combofonesize); combonesize; combonesize. setEditable (true); //fonfonfonfont selection checkcheckBold = new checkBold = JCheBox ("bolhehehehehehehebox"""""""","""""""""""""""""""""""""""""""The results of this study are as follows:1. Add.add (checkItalic);//color selection String colorStr []]= {red, "green,""blue,""black"}; radioColor = new JRadioButton [colorStr. length]; ButtonGroup = new ButtonGroup (); for (int I = 0; I < colorStr. length; i+++++ {radioColor [i]= JRadioButton (colorStr Str [i]]]]; jtoolbar. add color [color [i]]]]]; color group (color]]]; color [color]]]]; radioRadiRadiRadiRadioButtoRadioButton ActionListen (RadiRadiRadionListen}; (RadiRadiRadionListen ActionListen}; (RadiRadijpanel 1. add (jtoolbar) //toolbar add to jpanel1 this.getContentPane().add(jpanel1, BorderLayout.NORTH); //set the location of jpanel1 and add to the entire panel this.getContentPane().add(jpanel2);//jpanel2 add to jpanel2. setLayout (new GridLayout (1, 2); //divide the interface into two parts, the text box eye on the left, and the information section bar added to the right side = Jtarea ();/ jpanel2.add(new JScrollPane(textarea));JPanel jpanel=new JPanel(new GridLayout(7, 1));jpanel2.add(jpanel); // / / Add various elements into the right panel tfdNumber = new JTextField ("1"); tfdNumber. setitable (false); tfdNumber. setEditable (false); tftftftfdNumber. add (add); NadName = JScrollPane (new Textarea); JPanel JPanel = new JPanel (new GridLayout (7, 1), jpanel2.add (jpanel); jpanel2.add (jpanel); ///Add various elements into the right panel tfdNumber tftfdNul Jpanelrd = new JPanel (new GridLayout (1,2); btnMan = new JRadioButton ("male", true);btnFelman=new JRadioButton("female"); btnFelman = new JRadioButton ("female"); jpanelrd. add (btnMan); jpanelrd. add (btnFelman); jpanel. add (jpanelrd); ButtonGroup btttngroup = new ButtonGroup () //make the button in the group (male, female) mutually exclusive, can only select one button, so they can be placed in the same group of buttons in the same group, so they can be placed in the same button group button group (routbnMan; btngro Up.add (btn Felman); // province combo box comProvince = new JComboBox (province); comProvince. addAction Listener (this); jpanel. add (comProvince); comCitys = new JComboBox (citys [0]); jpanel. add (comCitys); tfd1 = JTextField ("Note:"); jpanel. add (tfd1); btnAdd = new Button ("Add"); btnAdd. Listener (this); jpanel. Add; / jjjjtAdd; / jpopu add the right-click menu Pmenu = new JPopupMenu (); String popumenuItem []]= {"paste""""""""""""""""""""""""""""""""""""""""}; JMenuItem popumenuItem add []]=new JMenuItem popumenuItem add []]==new JMenuItem [popumenuItem. length]]]; for (int I = 0; I < popumenuItem. length; I ++++++++++{{{popnuItem [popumeItem]]]]]]]]]=new JMenuItem (popumenuItem (popaddActionListener (this);} textarea. add (jpopupmenu); textarea. addMouseLi Stener (this); this. setVisible (true);} private void addMymenu() {JMenuBar jmenubar = new JMenuBar (); setJMenuBar (jmenubar); String menustr []]= {"file","""""", "edit", "help"}; JMenu menu []]=new JMenu [menu [menustr.menu]]]]]; for (int I = 0; I < menustr. length; I < menr. length; ++++++ + + {menu [i]]= menu [i]]]= new menu [menu]]]]]= menu add new menu [menu] [menu]];}//"File" menu submenu JMenuItem open = new JMenuItem(“ Open "; open. setAction Command (" open "); open. setAction Command (" open "); open. addAction Listener (this); menu [0]add (open); JMenuItem save = new JMenuItem save = new JMenuItem (" save "); menu [0]add (save); menu [0]add Separator (); JMenuItem past = new JMenMenMenMenuMenuItem Itempast = new JMenMenuIMenuIItemItem Item past = new JMenuItem Item (" paste ("paste"); past. ActionListener (this); menu [0]]]]]]; past. addaction. ActionListener (this); menu [0]]][0]. add (copy); JMenuItem C JMenuItem exit = new JMenuItem ("clip"); cut. addAction Listener (this); menu [0]add (cut); menu [0]add (cut); menu [0]; menu [0]add (cut); menu [0]; menu [0]add (cut); menu [0]; menu [0]add (new]]; menu [0]]; menu [new] new JMenuItem exit = new JMenuItem exit ("exit"); JMenuItem exit = new JMenuItem exit = new JMenuItem Item ("exit"); exit.setAction Command ("exit"); exit.setAction Command ("exit"); exit exit exit; exit. setAction exit; exit. addAction"Color Settings"; menu [1] Add. add (color style); ///set String wordstyle1 []= {"bold",""bold"[]]=="""""""]]]]]; JMenuItem jmenuitem []=new JMenuItem [wordstyle1.length]]]; for (int = 0; I < wordstyle1.length; i++++++ {jmenuitem [i]]=new JMenuItem (wordstyle1 [wordste1 [i]]]]]); add (wordstyle. wordstyle. add (jmenuite [jmenuituite]]]]]]]]]]]]]]]]]; jmenuitThis;}// Set the "Color Settings" secondary menu String colorstyle 1[ ]= {"red", "green", "green", "blue"","black"}; jmenuItemcolor = new JMenuItem [color style 1. length]; for (int I = 0; I < colorstyle 1. length; I ++) {jmenuItemcolor [i] = new JMenuItemcolor [color [i] = new JMenuItemcolor [color 1 [i]]; color style. add (jmenuItemcolor [i]]]; jmenuItemcolor [color]]; jmenuImenuItem [color] add i]]. additiionListener (this);} jmenuItemtem help = new JmenmenuItemtem help help ("jmenmenmenmenuItem help help"("jmenmenmenmenmenmenmenuitemhelp. addActionListener (this); menu [2]. Override public void ID action Performed (Action Event)} {if (e. getSource () =====btnAdd) {String aline; // / / add name and number aline = this. number + "/// / / / / / / add the name and number aline = this. number +," +tfdName. getText (); //Add gender if (btnMan Man. ised //// / / / / / / / / / Add gender if (btnMan Man Man. isissed ()/////////////////////////// / / / Add gender if (btnMan Selecte = aline e+"," +btnFelman.getText();}// Add provinces aline = aline+"," +comProvin GetSelectedItem ();////// / add municipal aline=aline+","+comCitys.getSelectedItem();// / add annotation aline = aline + + "," +tfd1.getText (; ///add annotation aline = aline + + "/// / / / / add annotation aline = aline +"""+tfd1.getText (; tfd1.setText ("Note::"); textarea. append (e + \\\\\;++++++++++++e () = comProvince {int I = comProvince. getSelected Index (); comCitys. removeAllItems () System.out.println (citys [i]. length); for (int J = 0; J < citys [i]; length; J ++) {comCitys. addItem (citys [i] [j]]]]];}} if (e.getSource () instance of JMenuItem | | | e.getSource () instance of JMenuItem {///RadioButton) {///SettingtingtingtingtingtingtingtingtingtingtingtingtingtingtingtingtingColor = null; //// / / / Use parameterized thinking to make color if (e. CommgetCommand ("equalgetCommand Action (" getCommand ("equalequalequals ("color = new color (255, 0, 0);} if (e. getAction Command (). E. Quals ("green") {color = new color (0, 255, 0);}if (e.getActionCommand (). e quals (). e quals ("blue"){color = new color (0, 0, 255);}if (e.getActionCommand and (). e quals (). e quals ("black")) {color = new color (0, 0, 0);}tarea text. setForetext (ground); // / / / / / / setsethelp if (e. getActionCommand (). Command (). e quals Case () {IgnoreActionCase () {{IgnorejjjjCase) ("{{{help {related advice) {{dialog 1 = new JDialog (this, true); jdialog 1. setSize (330, 100); Int l X = getX ()+20; int ly = getY ()+20; jdialog 1. setLocation (lx, ly); jdialog 1. add (new Label ("For related help, please call 10010, the right of final interpretation belongs to Unicom! jdialog1.setVisible(true);};}/// / Setfonfont settings for monitoring if (e.getActionCommand and (). equals ("bolbold"){font1=new Font(getName(),20, 20);textarea.setFont(font1);}if(e.getActionCommand().equals(). equals ("itaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaitaita {}}}} {getActionCommand and (). equalsIgnoreCase exit ()]]]]]] {Dialog (this),"Are you sure you want to save and exit? If (option=====JOptionPane.OK_OPTION) {System.out.println ("saved..."); System.exit (0);} if (option===JOptionPane. NO_OPTION) {System.exit (0);} if (option====JOptionPane. NO_OPTION) {System.exit (0);}if (option=====JOptionPane.CANCEL_OPTION) {return;}}/// / / saved listening if (e.geCommaction and (). sIgnorCase ("replica equaleCase (""{{{{copy () tartarea} copy ///// / tartartartartar paste tActionCommand (). equalsIgnoreCase ("Paste") {textarea. pas [te ();;;;}// / crop listener if (e.getActionCommand and (). equalsIgnoreCase ("crop"){textarea.cut();}/// open listener if (e.getActionCommand and ().equals (). equals ("open"){openFile ();}///// fonfonfonfonfonfont listen/* if (e.getcombcomb Source () instance of JCoBox)) {JCoBox fonfontfonfonfonfontString = (String = (String) Name= (String) Selectonename. Selected Item fonfonfonfonfonfonfonfonfonfont0; SifontfonfonfonstrSize= (String) combofonesize. getSelectedItem (); int Font = change Style (e) style = change Style (e); font = new Font (fontName, style, fontSize); textarea. setFont (font);}}} private int change Style (ActionEvent) {// TODO Auto generated method stubreturn 0; */}} void openopenFile File () {{FileDiaopenFile Dialog OpenFile File DiaDialog. FileDialog. FileDialog. Open File Fill Open Fill Open Fill Open Fill Open Fill OpenOpen FileViseDOpen Fill. Open FileOpenOpen FileOpen Fill. Open FileOpen FileViseOpen FileOpen FileOpen seCl (MouseEvent) {if (e. getModidifiers () ==== = MouseEvent. BUTTON3_MASK) {jpopupmenu. show (textarea, E. getX (), e.getY ();}}}}}}}}}}} public void mousePressed (MouseEvent) {}} public void mouseReleased (MouseEvent) {}}{} public void moumouseEnterMouseEvent (useEvent) public Event {}}}} public voseEveEvent (Exvosed (ExvouseEveEvent) public {public voideided {public vouseEveEvent {public public public void {public vo(String [] args) {Object province []= {Sichuan