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


Java ActionEvent.getSource方法代码示例

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


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

示例1: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void actionPerformed(ActionEvent evt) {
    if(!FaceBookAccess.getInstance().isAuthenticated()) {
        FaceBookAccess.setClientId(appId);
        FaceBookAccess.setRedirectURI(redirectURI);
        FaceBookAccess.setClientSecret(clientSecret);
        if(permissions != null) {
            FaceBookAccess.setPermissions(permissions);            
        }
        FaceBookAccess.getInstance().showAuthentication(this);
        return;
    }
    if(evt.getSource() instanceof Exception) {
        return;
    }
    try {
        FaceBookAccess.getInstance().postLike(getPostId());
    } catch (IOException ex) {
        Log.e(ex);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:LikeButton.java

示例2: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent evt) {
    if(current != null) {
        leafListener.fireActionEvent(new ActionEvent(current,ActionEvent.Type.Other));
        return;
    }
    Component c = (Component)evt.getSource();
    Container lead = c.getParent().getLeadParent();
    if(lead != null) {
        c = lead;
    }
    Object e = c.getClientProperty(KEY_EXPANDED);
    if(e != null && e.equals("true")) {
        collapseNode(c);
    } else {
        expandNode(isInitialized(), c);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:18,代码来源:Tree.java

示例3: 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

示例4: onTrackAction

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void onTrackAction(Component c, ActionEvent event) {
    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")) {
            ui.dialogOptions.showTrackOptions(item);
            return;
        }
    }
    
    ui.player.setQueueAndPlay((TrackListModel)list.getModel());
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:16,代码来源:NewsView.java

示例5: onLanguageAction

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void onLanguageAction(Component c, ActionEvent event) {
    List list = (List) event.getSource();
    final Map item = (Map)list.getSelectedItem();
    
    if(current.equals(item.get("shortLanguage").toString()))
        ui.back();
    else
        handler.setLanguage(item.get("shortLanguage").toString());
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:10,代码来源:LanguageView.java

示例6: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void actionPerformed(ActionEvent evt) {
    if (!FaceBookAccess.getInstance().isAuthenticated()) {
        FaceBookAccess.getInstance().showAuthentication(this);
        return;
    }
    if (evt.getSource() instanceof Exception) {
        return;
    }
    if (evt.getSource() instanceof String) {
        token = (String) evt.getSource();
    }

    super.actionPerformed(evt);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:18,代码来源:FacebookShare.java

示例7: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent evt) {
    if(evt == null) {
        url = null;
    } else {
        url = (String)evt.getSource();
    }
    completed = true;
    synchronized(this) {
        this.notify();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:12,代码来源:Capture.java

示例8: if

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
/**
 * Creates a ComponentInspector with the source component of the provided event.
 * @param e The event whose source component is added to the set.
 * @return A ComponentSelector with a single component - the source of the event.
 */
public static ComponentSelector $(ActionEvent e) {
    Object src = e.getSource();
    if (src == null) {
        return new ComponentSelector();
    } else if (src instanceof Component) {
        return new ComponentSelector((Component)src);
    }
    return new ComponentSelector();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:15,代码来源:ComponentSelector.java

示例9: actionPerformed

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent evt) {
    TextArea t = (TextArea)evt.getSource();
    int row = getCellRow(t);
    int column = getCellColumn(t);
    editingColumn = column;
    editingRow = row;
    getModel().setValueAt(row, column, t.getText());
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:9,代码来源:Table.java

示例10: onBrowseAction

import com.codename1.ui.events.ActionEvent; //导入方法依赖的package包/类
public void onBrowseAction(final Component c, ActionEvent event) {
    final List list = (List) event.getSource();
    final Map item = (Map) list.getSelectedItem();
    
    if("album".equals(item.get("type")))
    {
        show(MediaHelper.getId(item));
    }
    /*
    else if("video".equals(item.get("subtype")))
    {
        String url = null;
        for (Map itemMedia : (ArrayList<Map>)item.get("media")) {
            if ("video".equals(itemMedia.get("type"))) {
                Map file = ((ArrayList<Map>)itemMedia.get("files")).get(0);
                url = (String)file.get("url");
            }
        }
        
        if(Display.getInstance().getPlatformName().equals("ios"))
        {
            try {
                Media m = MediaManager.createMedia(url, true);
                m.setNativePlayerMode(true);
                m.play();
            } catch (IOException ex) {

            }
        }
        else
            Display.getInstance().execute(url);
    }
            */
    else
    {
        Button clickedButton = ((GenericListCellRenderer)list.getRenderer()).extractLastClickedComponent();
        if (clickedButton != null) {
            // Occurs when touching a button
            if (clickedButton.getName().equals("btnMediaActionFixed")) {
                ui.dialogOptions.showTrackOptions(item);
                return;
            }
        }

        ui.player.setQueueAndPlay((TrackListModel)list.getModel());
    }
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:48,代码来源:BrowseView.java


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