当前位置: 首页>>代码示例>>Java>>正文


Java ActionEvent.consume方法代码示例

本文整理汇总了Java中com.codename1.ui.events.ActionEvent.consume方法的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent.consume方法的具体用法?Java ActionEvent.consume怎么用?Java ActionEvent.consume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codename1.ui.events.ActionEvent的用法示例。


在下文中一共展示了ActionEvent.consume方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent ev) {
    ev.consume();
    switch(getId()) {
        case 1:
            // key press for activating clear causes keyRelease never to be 
            // called triggering a long click, this code disables the long click
            releaseTime = System.currentTimeMillis();
            pressedAndNotReleased = false;
            longClick = false;
            deleteChar();
            break;
        case 2:
            ev.consume();
            editString();
            break;
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:18,代码来源:TextField.java

示例2: onQueueAction

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void onQueueAction(Component c, ActionEvent event) 
{
    event.consume();
    final List list = (List) event.getSource();
    final Map item = (Map)list.getSelectedItem();

    Button clickedButton = ((GenericListCellRenderer)list.getRenderer()).extractLastClickedComponent();
    if (clickedButton != null) {
        // Occurs when touching a button

        if (clickedButton.getName().equals("btnMediaActionFixed")) {
            ArrayList<Command> commands = new ArrayList<Command>();

            Image icon = StateMachine.getResourceFile().getImage("popup_trash_icon.png");
            icon.lock();
            commands.add(new Command(ui.translate("command_remove_item_from_playlist", "[default]Remove item"), icon) {

                @Override
                public void actionPerformed(ActionEvent evt) {
                    ui.player.removeFromQueue((Map) list.getSelectedItem());
                    if(ui.player.isQueueEmpty())
                    {
                        Display.getInstance().getCurrent().setTransitionOutAnimator(CommonTransitions.createEmpty());
                        ui.playerView.setFromMiniPlayer(false);
                        ui.back();
                        ui.back();
                    }
                    else
                        initQueueModel(list);
                }
            });
            ui.dialogOptions.show(commands);
            return;
        }
    }
    
    ui.player.setQueueAndPlay((TrackListModel) list.getModel());
    Display.getInstance().getCurrent().setTransitionOutAnimator(CommonTransitions.createFade(200));
    ui.back();
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:41,代码来源:QueueView.java

示例3: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent evt) {
    JavascriptEvent jevt = (JavascriptEvent)evt;
    JSObject source = jevt.getSelf();
    String method = jevt.getMethod();
    String key = source.toJSPointer()+"."+method;
    JSFunction func = (JSFunction)callbacks.get(key);
    if ( func == null ){
        // No callback is registered for this method.
        return;
    }
    func.apply(source, jevt.getArgs());
    evt.consume();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:14,代码来源:JavascriptContext.java

示例4: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent evt) {
    evt.consume();
    googleAnalytics.sendCrashReport((Throwable) evt.getSource());
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:6,代码来源:GoogleAnalyticsCrashReporter.java

示例5: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(final ActionEvent evt) {
    final Form f = getComponentForm();
    Container layered = f.getLayeredPane(AutoCompleteTextField.this.getClass(), true);
    
    boolean canOpenPopup = true;
    
    for (int i = 0; i < layered.getComponentCount(); i++) {
        Container wrap = (Container) layered.getComponentAt(i);
        Component pop = wrap.getComponentAt(0);
        if(pop.isVisible()){
            if(!pop.contains(evt.getX(), evt.getY())){
                pop.setVisible(false);
                pop.setEnabled(false);      
                f.repaint();
                evt.consume();
            }else{
                canOpenPopup = false;
            }
        }
    }
    
    if(!canOpenPopup || getText().length() < getMinimumLength()){
        return;
    }
    
    if (contains(evt.getX(), evt.getY())) {
        //if the suggestions are empty don't show the no need to show the popup
        if(((List)popup.getComponentAt(0)).getModel().getSize() == 0){
            return;
        }
        //something went wrong re-init the popup
        if(popup.getAbsoluteX() != getAbsoluteX()){
            removePopup();
            addPopup();
        }
        evt.consume();                
        popup.getComponentAt(0).setScrollY(0);
        popup.setVisible(true);
        popup.setEnabled(true);
        popup.repaint();
        dontCalcSize = false;
        f.revalidate();
        dontCalcSize = true;
        Display.getInstance().callSerially(new Runnable() {

            public void run() {
                pointerReleased(evt.getX(), evt.getY());
            }
        });
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:52,代码来源:AutoCompleteTextField.java


注:本文中的com.codename1.ui.events.ActionEvent.consume方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。