📄 eafpopupmenu.java
字号:
/* * File: EAFPopupMenu.java * Project: MPI Linguistic Application * Date: 02 May 2007 * * Copyright (C) 2001-2007 Max Planck Institute for Psycholinguistics * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package mpi.eudico.client.annotator.search.query.viewer;import mpi.eudico.client.im.ImUtil;import mpi.search.content.query.viewer.AbstractConstraintPanel;import mpi.search.content.query.viewer.AbstractPopupMenu;import java.awt.Component;import java.awt.event.*;import java.util.Locale;import javax.swing.JMenuItem;/** * Created on Aug 18, 2004 * @author Alexander Klassmann * @version Aug 18, 2004 */public class EAFPopupMenu extends AbstractPopupMenu implements FocusListener { /** Holds value of property DOCUMENT ME! */ final static private Locale[] imLocales = ImUtil.getLanguages(); /** * Creates a new EAFPopupMenu instance * * @param component DOCUMENT ME! * @param constraintPanel DOCUMENT ME! */ public EAFPopupMenu(Component component, AbstractConstraintPanel constraintPanel) { super(component, constraintPanel); } /** * DOCUMENT ME! */ public void fillMenu() { setLabel("Select Language"); try { JMenuItem item; for (int i = 0; i < imLocales.length; i++) { if ((i == 0) && (imLocales[i] == Locale.getDefault())) { item = new JMenuItem(imLocales[i].getDisplayName() + " (System default)"); } else { item = new JMenuItem(imLocales[i].getDisplayName()); } add(item); item.addActionListener(this); } component.addFocusListener(this); } catch (java.lang.NoSuchMethodError nsme) { System.err.println( "No input methods found. Probably class ImUtil not in java.lib.ext"); } } /** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void mouseClicked(MouseEvent e) { } /** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void mouseExited(MouseEvent e) { } /** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void mouseReleased(MouseEvent e) { } /** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void mouseEntered(MouseEvent e) { } /** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void mousePressed(MouseEvent e) { if (javax.swing.SwingUtilities.isRightMouseButton(e) || e.isPopupTrigger()) { show(component, e.getX(), e.getY()); } } /** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); for (int i = 0; i < imLocales.length; i++) { if (command.equals(imLocales[i].getDisplayName())) { ImUtil.setLanguage(component, imLocales[i]); break; } } } /** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void focusGained(FocusEvent e) { ImUtil.setLanguage(component, component.getLocale()); } /** * DOCUMENT ME! * * @param e DOCUMENT ME! */ public void focusLost(FocusEvent e) { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -