网站导航网学 原创论文 原创专题 网站设计 最新系统 原创论文 论文降重 发表论文 论文发表 UI设计定制 论文答辩PPT格式排版 期刊发表 论文专题
返回网学首页
网学原创论文
最新论文 推荐专题 热门论文 论文专题
当前位置: 网学 > 交易代码 > Java精品代码 > 正文

java小游戏-贪吃蛇-JSP教程,Java技巧及代码

论文降重修改服务、格式排版等 获取论文 论文降重及排版 论文发表 相关服务
;speed-2", "speed-3", "speed-4", "speed-5"};

  speeditem = new jradiobuttonmenuitem[speeditem_name.length];

  for( int i = 0; i < speeditem_name.length; i++ )

  {

  speeditem[i] = new jradiobuttonmenuitem( speeditem_name[i] );

  inner_menu[0].add( speeditem[i] );

  speeditem[i].setfont( new font( "courier", font.plain, 12 ) );

  speeditem[i].additemlistener( new itemhandler() );

  temp1.add( speeditem[i] );

  }

  buttongroup temp2 = new buttongroup();

  string[] modelitem_name = { "linux", "mac", "windows" };

  modelitem = new jradiobuttonmenuitem[modelitem_name.length];

  for( int i = 0; i < modelitem_name.length; i++ )

  {

  modelitem[i] = new jradiobuttonmenuitem( modelitem_name[i] );

  inner_menu[1].add( modelitem[i] );

  modelitem[i].setfont( new font( "courier", font.plain, 12 ) );

  modelitem[i].additemlistener( new itemhandler() );

  temp2.add( modelitem[i] );

  }

  buttongroup temp3 = new buttongroup();

  string[] standarditem_name = { "60 * 40", "45 * 30", "30 * 20" };

  standarditem = new jradiobuttonmenuitem[standarditem_name.length];

  for( int i = 0; i < standarditem_name.length; i++ )

  {

  standarditem[i] = new jradiobuttonmenuitem( standarditem_name[i] );

  inner_menu[2].add( standarditem[i] );

  standarditem[i].setfont( new font( "courier", font.plain, 12 ) );

  standarditem[i].additemlistener( new itemhandler() );

  temp3.add( standarditem[i] );

  }

  looks = uimanager.getinstalledlookandfeels();

  }

  private class actionhandler implements actionlistener

  {

  public void actionperformed( actionevent e )

  {

  if( e.getsource() == menuitem[0] )

  {

  owner.resetgame();

  configmenu.this.setvisible( false );

  }

  else if( e.getsource() == menuitem[1] )

  {

  owner.stopgame();

  configmenu.this.setvisible( true );

  configmenu.this.setmenuenable( true );

  }

  else if( e.getsource() == menuitem[2] )

  {

  system.exit( 0 );

  }

  else if( e.getsource() == menuitem[3] )

  {

  configdialog temp = new configdialog( owner );

  temp.setvisible( true );

  }

  else if( e.getsource() == menuitem[4] )

  {

  joptionpane.showmessagedialog( null, "sanke game 2.0 version!\n\n" +

  "author: finalcore\n\n" );

  }

  }

  }

  private class itemhandler implements itemlistener

  {

  public void itemstatechanged( itemevent e )

  {

  for( int i = 0; i < speeditem.length; i++ )

  {

  if( e.getsource() == speeditem[i] )

  {

  owner.snaketimer.setdelay( 150 - 30 * i );

  }

  }

  if( e.getsource() == standarditem[0] )

  {

  owner.setgrid( 60, 40, 5 );

  }

  else if( e.getsource() == standarditem[1] )

  {

  owner.setgrid( 45, 30, 10 );

  }

  else if( e.getsource() == standarditem[2] )

  {

  owner.setgrid( 30, 20, 15 );

  }

  for( int i = 0; i < modelitem.length; i++ )

  {

  if( e.getsource() == modelitem[i] )

  {

  try

  {

  uimanager.setlookandfeel( looks[i].getclassname() );

  }catch(exception ex){}

  }

  }

  }

  }

  public void setmenuenable( boolean temp )

  {

  menu[1].setenabled( temp );

  }

  }

  configdialog.java

  package snakegame;

  import java.awt.*;

  import java.awt.event.*;

  import javax.swing.*;

  public class configdialog extends jdialog

  {

  private container c;

  private jframe owner;

  private ownpanel[] panel = new ownpanel[4];

  box box1, box2;

  private jbutton commitbutton, cancelbutton;

  color[] color = new color[4];

  public configdialog( frame owner )

  {

  this.owner = (jframe) owner;

  this.setsize( 400, 200 );

  this.setresizable( false );

  this.settitle( "config your game"

  • 上一篇资讯: 记事本的JAVA源代码
  • 设为首页 | 加入收藏 | 网学首页 | 原创论文 | 计算机原创
    版权所有 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2020 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号 常年法律顾问:王律师