我一直试图让这个矩形移动我用for循环创建的.这段代码发生的一切就是有一个原始的矩形,然后在那个矩形旁边有一个新的矩形.没有动画发生,只有那两个矩形显示在窗口上.有什么方法可以让这个矩形动画化?
import java.awt.*;
import javax.swing.*;
public class Gunman extends JComponent {
/**
*
*/
private static final long serialVersionUID = 1L;
public int x = 10;
public int y = 10;
public int width = 8;
public int height = 10;
public void paint(Graphics g) {
g.setColor(Color.red);
g.drawRect (x, y, width, height);
g.fillRect (x, y, width, height);
for(int i = 0; i<=1024; i++){
g.setColor(Color.red);
g.drawRect(x++, y, width, height);
g.fillRect(x++, y, width, height);
}
}
}
Run Code Online (Sandbox Code Playgroud) 我已经使用以下代码以编程方式断开调用,但它无法正常工作.
private void callDisconnect(){
try{
TelephonyManager manager = (TelephonyManager)this.getSystemService(this.TELEPHONY_SERVICE);
Class c = Class.forName(manager.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
ITelephony telephony = (ITelephony)m.invoke(manager);
telephony.endcall();
} catch(Exception e){
Log.d("",e.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我吗?我需要更改代码还是什么......?
我需要将图像添加到tabbarcontroller.我将navigationcontroller作为tabbarcontroller中的tabbar项包含在内.那么如何将图像添加到tabbarcontroller.
tabBarController = [[UITabBarController alloc] init];
tabBarController.moreNavigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
tabBarController.moreNavigationController.topViewController.view.backgroundColor=[UIColor clearColor];
tabBarController.delegate=self;
Dashboard_iPhone *dash = [[Dashboard_iPhone alloc] init];
UINavigationController *tabItem0 = [[[UINavigationController alloc] initWithRootViewController:dash] autorelease];
tabItem0.view.backgroundColor=[UIColor clearColor];
TrackProgram_iPhone *rep = [[TrackProgram_iPhone alloc] init];
UINavigationController *tabItem1 = [[[UINavigationController alloc] initWithRootViewController:rep] autorelease];
tabBarController.tabBarItem.title=@"TrackProgram";
tabItem1.view.backgroundColor=[UIColor clearColor];
TrackClinic_iPhone *loc = [[TrackClinic_iPhone alloc] init];
UINavigationController *tabItem2 = [[[UINavigationController alloc] initWithRootViewController:loc] autorelease];
tabBarController.tabBarItem.title=@"TrackClinic ";
tabItem2.view.backgroundColor=[UIColor clearColor];
tabBarController.viewControllers=[NSArray arrayWithObjects:tabItem0,tabItem1,tabItem2,nil];
[self.view insertSubview:tabBarController.view belowSubview:dash.view ];
[self presentModalViewController:tabBarController animated:NO];
Run Code Online (Sandbox Code Playgroud)
请帮我添加图像到tabbarcontroller.
我的代码中有以下声明:
String[] array1 = new String[];
Run Code Online (Sandbox Code Playgroud)
如果array1有1.000.000个元素(所有80个字符的字符串)有多重?我的意思是RAM内存.
假设我们有一个带有'A'列的表,其值从0到N.我想为每列具有相同值的30%选择"A"列.
So if I have this:
A| B
-------
0 hello
0 test
0 hi
1 blah1
1 blah2
1 blah3
1 blah4
1 blah5
1 blah6
Result:
A| B
-------
0 hello
1 blah1
1 blah4
Run Code Online (Sandbox Code Playgroud)
它可能是blah1或任何其他不是blah4的blah4,而blah4可能是任何其他不是blah1的blah,基本上它可能是随机的或跳过的.
顺便说一句,实际的表是巨大的,谈论太字节,所以考虑性能.