小编Fab*_*bio的帖子

如何在Netbeans平台上获取项目类型?

有没有办法知道所选项目的类型?我想根据项目类型(如J2SE项目)执行一些特定操作.

以下是我发现的唯一方法:

public final class MyAction extends CookieAction { 

@Override 
public boolean isEnabled() { 
  if(this.getActivatedNodes() == null || this.getActivatedNodes().length != 1) { 
        return false; 
    } 

    Lookup lookup = this.getActivatedNodes()[0].getLookup(); 

    // gets the selected project 
    Project currentProject = lookup.lookup(Project.class); 

    // checks if the selected project is a J2SE Project or a Maven Project 
    if(currentProject != null && (currentProject.getClass().getSimpleName().equals("J2SEProject") 
            || currentProject.getClass().getSimpleName().equals("NbMavenProjectImpl"))) { 
        return true; 
    } 

    return false;

}}
Run Code Online (Sandbox Code Playgroud)

java netbeans netbeans-platform

8
推荐指数
1
解决办法
845
查看次数

动画UITextField时的奇怪行为

我正试图制作动画,UITextField但我被一个恼人而奇怪的问题所困扰.我的动画有以下顺序:

第一个州

在第一种状态下,应用程序具有UITextField相机UIButton和取消UIButton后未显示的相机按钮,因为它已被定位在应用程序的限制范围之外.实际上我的应用程序有320的宽度和取消按钮来源是(350,7)

第二州

在第二状态中,当用户触摸时UITextField,相机按钮alpha通道被设置为0并且取消按钮的原点被设置为(247,7).

最终状态

用户触摸键盘的返回按钮或取消按钮后,最终状态与第一状态相同.

在处理期间,UITextField宽度和x轴上的取消按钮原点是动画的.

我的代码是:

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
  barcodeSearchButton.userInteractionEnabled = NO;
  cancelButton.userInteractionEnabled = NO;

   CGFloat cancelButtonXOffset = CGRectGetMaxX(barcodeSearchButton.frame) - cancelButton.frame.size.width;
   CGFloat searchFieldWidth = searchField.frame.size.width - cancelButton.frame.size.width + barcodeSearchButton.frame.size.width;
   [UIView animateWithDuration:0.3
         animations:^{
             searchField.frame = CGRectMake(searchField.frame.origin.x, searchField.frame.origin.y, searchFieldWidth, searchField.frame.size.height);
             cancelButton.alpha = 1.0;                
             cancelButton.frame = CGRectMake(cancelButtonXOffset, cancelButton.frame.origin.y, cancelButton.frame.size.width,cancelButton.frame.size.height);

             barcodeSearchButton.alpha = 0.0;

         }
         completion:^(BOOL finished) {
             barcodeSearchButton.userInteractionEnabled = NO;
             cancelButton.userInteractionEnabled = YES;
         }];    
}

- (void)textFieldDidEndEditing:(UITextField *)textField
{
  barcodeSearchButton.userInteractionEnabled = NO;
  cancelButton.userInteractionEnabled …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c uiviewanimation ios4 ios

5
推荐指数
2
解决办法
3132
查看次数