本文整理汇总了Java中com.codename1.ui.events.ActionEvent类的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent类的具体用法?Java ActionEvent怎么用?Java ActionEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionEvent类属于com.codename1.ui.events包,在下文中一共展示了ActionEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == saveRecording) {
TestRecorder.this.saveRecordingActionPerformed(evt);
}
else if (evt.getSource() == recording) {
TestRecorder.this.recordingActionPerformed(evt);
}
else if (evt.getSource() == assertTitle) {
TestRecorder.this.assertTitleActionPerformed(evt);
}
else if (evt.getSource() == assertLabels) {
TestRecorder.this.assertLabelsActionPerformed(evt);
}
else if (evt.getSource() == assertTextAreas) {
TestRecorder.this.assertTextAreasActionPerformed(evt);
}
else if (evt.getSource() == screenshotTest) {
TestRecorder.this.screenshotTestActionPerformed(evt);
}
}
示例2: onMain_CheckBoxRawJsonAction
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
@Override
protected void onMain_CheckBoxRawJsonAction(Component c, ActionEvent event) {
CheckBox rawPushCheckbox = (CheckBox)c;
if (rawPushCheckbox.isSelected()) {
try {
final String existing = findTextAreaPush().getText();
JSONObject data = new JSONObject();
data.put("alert", existing);
findTextAreaPush().setText(data.toString());
} catch (JSONException ex) {
// Ignore error and initialize to default
findTextAreaPush().setText("{\n"
+ " \"alert\":\"message\""
+ "\n}");
}
} else {
findTextAreaPush().setText("");
}
}
示例3: addPlaylistEdit
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
private void addPlaylistEdit(final Form f)
{
//TODO: Enabled this again when Shai has fixed deleting titlecommands
//if(titleCommand != null)
// f.removeCommand(titleCommand);
ui.removeTitleCommand(f);
// Add command to change playlist-name
Image icon = StateMachine.getResourceFile().getImage("playlist_edit_static.png");
icon.lock();
Image iconPressed = StateMachine.getResourceFile().getImage("playlist_edit_active.png");
iconPressed.lock();
titleCommand = new Command(null, icon){
@Override
public void actionPerformed(ActionEvent evt) {
addPlaylistCancel(f);
onEditPlaylistTitle(f);
}
};
titleCommand.setPressedIcon(iconPressed);
titleCommand.putClientProperty("TitleCommand", Boolean.TRUE);
f.addCommand(titleCommand);
}
示例4: getMenu
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
public Menu getMenu(int val) {
if (Display.getInstance().getCommandBehavior() == Display.COMMAND_BEHAVIOR_NATIVE) {
m = new Menu();
if(commands != null){
for (int iter = 0; iter < commands.size(); iter++) {
final Command cmd = (Command) commands.elementAt(iter);
String txt = UIManager.getInstance().localize(cmd.getCommandName(), cmd.getCommandName());
MenuItem i = new MenuItem(txt, iter, iter) {
public void run() {
Display.getInstance().callSerially(new Runnable() {
public void run() {
impl.getCurrentForm().dispatchCommand(cmd, new ActionEvent(cmd));
}
});
}
};
m.add(i);
}
}
return m;
}
return super.getMenu(val);
}
示例5: addPlaylistCancel
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
private void addPlaylistCancel(final Form f)
{
ui.removeTitleCommand(f);
Image icon = StateMachine.getResourceFile().getImage("playlist_cancel.png");
icon.lock();
Image iconPressed = StateMachine.getResourceFile().getImage("playlist_cancel.png");
iconPressed.lock();
titleCommand = new Command(null, icon){
@Override
public void actionPerformed(ActionEvent evt) {
addPlaylistAdd(f);
ui.hideComponent(ui.findCtnAddPlaylistForm(f));
}
};
titleCommand.setPressedIcon(iconPressed);
titleCommand.putClientProperty("TitleCommand", Boolean.TRUE);
f.addCommand(titleCommand);
}
示例6: 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);
}
}
示例7: setPlayPauseButtonState
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
public void setPlayPauseButtonState(final boolean isPlaying) {
if (Display.getInstance().getCurrent() != null && SideMenuBar.isShowing()) {
ui.sideMenu.getInstance().getParentForm().addShowListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
setPlayPauseButtonState(isPlaying);
}
});
} else {
Image icon = StateMachine.getResourceFile().getImage(isPlaying ? "miniplayer_pause.png" : "miniplayer_play.png");
Image iconPressed = StateMachine.getResourceFile().getImage(isPlaying ? "miniplayer_pause.png" : "miniplayer_play.png");
icon.lock();
iconPressed.lock();
ui.findBtnPlayerPlayPause(EmbPlayerContainer).setIcon(icon);
ui.findBtnPlayerPlayPause(EmbPlayerContainer).setPressedIcon(iconPressed);
}
}
示例8: actionCommandImplNoRecurseComponent
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
/**
* Invoked to allow subclasses of form to handle a command from one point
* rather than implementing many command instances
*/
void actionCommandImplNoRecurseComponent(Command cmd, ActionEvent ev) {
if (cmd == null) {
return;
}
if (comboLock) {
if (cmd == menuBar.getCancelMenuItem()) {
actionCommand(cmd);
return;
}
return;
}
if (cmd != menuBar.getSelectCommand()) {
if (commandListener != null) {
commandListener.fireActionEvent(ev);
if (ev.isConsumed()) {
return;
}
}
actionCommand(cmd);
}
}
示例9: actionPerformed
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
public void actionPerformed(final ActionEvent evt) {
if(Toolbar.isOnTopSideMenu() && (Toolbar.isGlobalToolbar() || Display.getInstance().getCommandBehavior() != Display.COMMAND_BEHAVIOR_SIDE_NAVIGATION)) {
Display.getInstance().getCurrent().getToolbar().closeSideMenu();
cmd.actionPerformed(evt);
return;
}
if (transitionRunning) {
return;
}
//if this is a navigation command clear the current Form to make the
//transition more pleasent
if(cmd instanceof NavigationCommand){
rightPanel.getStyle().setBgImage(null);
parent.getContentPane().setVisible(false);
Image img = updateRightPanelBgImage(null, parent);
rightPanel.getStyle().setBgImage(img);
}
closeMenu();
clean();
parent.addShowListener(pointerDragged);
Display.getInstance().startThread(new ShowWaiter(), "Show Waiter").start();
}
示例10: start
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
public void start() {
if(current != null){
current.show();
return;
}
s = new StateMachine("/theme");
Display.getInstance().addEdtErrorHandler(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
evt.consume();
Log.p("Exception in AppName version " + Display.getInstance().getProperty("AppVersion", "Unknown"));
Log.p("OS " + Display.getInstance().getPlatformName());
Log.p("Error " + evt.getSource());
Log.p("Current Form " + Display.getInstance().getCurrent().getName());
Log.e((Throwable)evt.getSource());
Log.sendLog();
}
});
}
示例11: getFaceBookObject
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
/**
* This method returns immediately and will call the callback when it returns with
* the FaceBook Object data.
*
* @param faceBookId the object id that we would like to query
* @param callback the callback that should be updated when the data arrives
*/
public void getFaceBookObject(String faceBookId, final ActionListener callback) throws IOException {
checkAuthentication();
final FacebookRESTService con = new FacebookRESTService(token, faceBookId, "", false);
con.addResponseListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (!con.isAlive()) {
return;
}
if (callback != null) {
callback.actionPerformed(evt);
}
}
});
if (slider != null) {
SliderBridge.bindProgress(con, slider);
}
for (int i = 0; i < responseCodeListeners.size(); i++) {
con.addResponseCodeListener((ActionListener) responseCodeListeners.elementAt(i));
}
current = con;
NetworkManager.getInstance().addToQueue(con);
}
示例12: capturePictureResult
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
/**
* Callback for the native layer
*/
public static void capturePictureResult(String r) {
dropEvents = false;
if(captureCallback != null) {
if(r != null) {
if(r.startsWith("file:")) {
captureCallback.fireActionEvent(new ActionEvent(r));
} else {
captureCallback.fireActionEvent(new ActionEvent("file:" + r));
}
} else {
captureCallback.fireActionEvent(null);
}
captureCallback = null;
}
}
示例13: getUser
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
/**
* Gets a user from a user id
*
* @param userId the user id or null to get detaild on the authenticated user
* @param user an object to fill with the user details
* @param callback the callback that should be updated when the data arrives
*/
public void getUser(String userId, final User user, final ActionListener callback) throws IOException {
String id = userId;
if (id == null) {
id = "me";
}
getFaceBookObject(id, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Vector v = (Vector) ((NetworkEvent) evt).getMetaData();
Hashtable t = (Hashtable) v.elementAt(0);
if (user != null) {
user.copy(t);
}
if (callback != null) {
callback.actionPerformed(evt);
}
}
});
}
示例14: showShare
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
private Component showShare() {
final Container c = new Container(new BorderLayout());
final ShareButton share = new ShareButton();
final TextArea t = new TextArea("Sharing on Facebook with CodenameOne is a breeze.\n"
+ "http://www.codenameone.com\n"
+ "(Sent from the facebook demo app)");
t.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
share.setTextToShare(t.getText());
}
});
c.addComponent(BorderLayout.CENTER, t);
share.setTextToShare(t.getText());
Container cnt = new Container(new BorderLayout());
cnt.addComponent(BorderLayout.SOUTH, share);
c.addComponent(BorderLayout.EAST, cnt);
return c;
}
示例15: login
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
public static void login(final Form form) {
if (firstLogin()) {
Login logForm = new Login(form);
logForm.show();
} else {
//token exists no need to authenticate
TOKEN = (String) Storage.getInstance().readObject("token");
FaceBookAccess.setToken(TOKEN);
//in case token has expired re-authenticate
FaceBookAccess.getInstance().addResponseCodeListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
NetworkEvent ne = (NetworkEvent) evt;
int code = ne.getResponseCode();
//token has expired
if (code == 400) {
signIn(form);
}
}
});
}
}