1、打开eclipse软件。
2、建立一个java工程。菜单栏中依次点击“file”-“new”-“java project”;然后,在工程列表中选中工程单击鼠标右键,选中“new”-“class”,在配置自己的类。
3、添加属性,载入属性代码。
private JPanel jp=new JPanel();
private JButton[] jbArray=new JButton[]{new JButton("前移动"),
new JButton("后移动"),new JButton("第一个"),
new JButton("最后个"),new JButton("第三个")}。
4、.建立卡片类,代码如下:
class MyCard extends JPanel{
int index;
public MyCard(int index){
this.index=index+1;
}
public void paint(Graphics g){
g.clearRect(0, 0, 250, 250);
g.drawString("这是Card"+index, 100, 100)。
5、运行程序点击编译并运行按钮。
6、安最后一个的按钮后,即可出现效果。
final Button bt2=(Button) findViewById(R.id.要跳转的按键名称);
bt2.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Intent ss=new Intent();
ss.setClass(现在所在的界面名称.this,跳转过去界面的名称.class);
现在所在的界面名称.this.startActivity(ss);
}});