@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		String com = e.getActionCommand();
		if (com.equals("局部生效") || com.equals("全局生效")) {
			MutableAttributeSet attr = new SimpleAttributeSet();
			StyleConstants.setFontFamily(attr, list.getSelectedValue());
			int startpos = text.getSelectionStart();
			int endpos = text.getSelectionEnd();
			StyledDocument doc = text.getStyledDocument();
			if (com.equals("局部生效")){
				doc.setCharacterAttributes(startpos, endpos - startpos, attr,
						false);
				StyleConstants.setFontFamily(attr, "宋体");
				try {
					doc.insertString(endpos, " ", null);
					doc.setCharacterAttributes(endpos, 1, attr, false);
				} catch (BadLocationException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
			else
				text.setCharacterAttributes(attr, false);
		// setParagraphAttributes(startpos,endpos-startpos , attr, false);
	}
		this.dispose();
}