本文整理汇总了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);
}
}
示例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);
}
}
示例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();
}
示例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());
}
示例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());
}
示例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);
}
示例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();
}
}
示例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();
}
示例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());
}
示例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());
}
}