小编Sam*_*aan的帖子

在Java中动画化矩形

我一直试图让这个矩形移动我用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)

java animation swing draw

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

如何以编程方式断开传出呼叫

我已经使用以下代码以编程方式断开调用,但它无法正常工作.

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)

任何人都可以帮助我吗?我需要更改代码还是什么......?

android

0
推荐指数
2
解决办法
6437
查看次数

如何自定义tabbarcontroller

我需要将图像添加到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.

iphone uitabbarcontroller

0
推荐指数
1
解决办法
3834
查看次数

java数组有多重?

我的代码中有以下声明:

String[] array1 = new String[];
Run Code Online (Sandbox Code Playgroud)

如果array1有1.000.000个元素(所有80个字符的字符串)有多重?我的意思是RAM内存.

java arrays

0
推荐指数
1
解决办法
299
查看次数

选择每列值的30%

假设我们有一个带有'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,基本上它可能是随机的或跳过的.

顺便说一句,实际的表是巨大的,谈论太字节,所以考虑性能.

sql sql-server random

0
推荐指数
1
解决办法
177
查看次数