本文整理汇总了Java中com.codename1.ui.events.ActionEvent类的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent类的具体用法?Java ActionEvent怎么用?Java ActionEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionEvent类属于com.codename1.ui.events包,在下文中一共展示了ActionEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:21,代码来源:TestRecorder.java
示例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("");
}
}
开发者ID:sidiabale,项目名称:parse4cn1,代码行数:20,代码来源:StateMachine.java
示例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);
}
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:27,代码来源:PlaylistView.java
示例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);
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:BlackBerryCanvas.java
示例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);
}
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:20,代码来源:PlaylistOverviewView.java
示例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);
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:LikeButton.java
示例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);
}
}
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:20,代码来源:EmbPlayerView.java
示例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);
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:Form.java
示例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();
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:SideMenuBar.java
示例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();
}
});
}
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:20,代码来源:PushDemo.java
示例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);
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:31,代码来源:FaceBookAccess.java
示例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;
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:19,代码来源:IOSImplementation.java
示例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);
}
}
});
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:FaceBookAccess.java
示例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;
}
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:20,代码来源:FBDemo.java
示例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);
}
}
});
}
}
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:23,代码来源:Login.java
示例16: onMain_BtShowInterstitialAction
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
@Override
protected void onMain_BtShowInterstitialAction(Component c, ActionEvent event) {
_("onMain_BtShowInterstitialAction");
_("Showing interstitial");
Form f = c.getComponentForm();
if (my==null)
{
showInterstitialText = "BAD.";
}
else
{
my.setPlc(tfPlc.getText()); // you must set your plc before you try to show an ad
my.showInterstitial();
showInterstitialText = "OK.";
}
f.add(new SpanLabel("show:\n"+showInterstitialText));
f.invalidate();
f.repaint();
}
开发者ID:amiga,项目名称:aerserv-codenameone-testbed,代码行数:23,代码来源:StateMachine.java
示例17: 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
示例18: actionPerformed
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
/**
* {{@inheritDoc}}
*/
public void actionPerformed(ActionEvent evt) {
if (getComponentForm().getFocused() instanceof TextField) {
return;
}
int keyCode=evt.getKeyEvent();
Object obj = accessKeys.get(new Integer(keyCode));
if (obj!=null) {
if (obj instanceof HTMLLink) {
HTMLLink htmlLink = (HTMLLink)obj;
htmlLink.actionPerformed(null);
} else if (obj instanceof ForLabel) {
((ForLabel)obj).triggerAction();
} else if (obj instanceof Component) {
selectComponent((Component)obj);
}
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:21,代码来源:HTMLComponent.java
示例19: readResponse
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected void readResponse(InputStream input) throws IOException {
StringBuffer buf = new StringBuffer();
byte[] buffer = new byte[256];
int len;
while ((len = input.read(buffer)) > 0) {
String temp = new String(buffer, 0, len, "UTF-8");
int endOfFile = temp.indexOf("/html>");
if( endOfFile > 0){
buf.append(temp.toCharArray(), 0, endOfFile + 6);
break;
}else{
buf.append(temp);
}
}
String s = buf.toString();
// if(s.indexOf("ci=") > -1){
// String ci = s.substring(s.indexOf("ci=") + 3, s.length());
// cid = ci.substring(0, ci.indexOf("&"));
// Storage.getInstance().writeObject("cid", cid);
// Storage.getInstance().flushStorageCache();
// addParam(this, "cid", cid);
// }
fireResponseListener(new ActionEvent(s,ActionEvent.Type.Response));
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:InnerActive.java
示例20: closeCurrentMenu
import com.codename1.ui.events.ActionEvent; //导入依赖的package包/类
/**
* Folds the current side menu if it is open, when the menu is closed it
* will invoke the runnable callback method
*
* @param callback will be invoked when the menu is actually closed
*/
public static void closeCurrentMenu(final Runnable callback) {
if(Toolbar.isOnTopSideMenu() && (Toolbar.isGlobalToolbar() || Display.getInstance().getCommandBehavior() != Display.COMMAND_BEHAVIOR_SIDE_NAVIGATION)) {
Display.getInstance().getCurrent().getToolbar().closeSideMenu();
callback.run();
return;
}
Form f = Display.getInstance().getCurrent();
final SideMenuBar b = (SideMenuBar) f.getClientProperty("cn1$sideMenuParent");
if (b != null && !b.transitionRunning) {
b.parent.addShowListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
b.parent.removeShowListener(this);
callback.run();
}
});
b.closeMenu();
} else {
callback.run();
}
}
开发者ID:codenameone,项目名称:CodenameOne,代码行数:27,代码来源:SideMenuBar.java
注:本文中的com.codename1.ui.events.ActionEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论