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

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

论文降重修改服务、格式排版等 获取论文 论文降重及排版 论文发表 相关服务
);

  this.c = this.getcontentpane();

  this.c.setbackground( color.white );

  this.c.setlayout( new flowlayout() );

  this.box1 = box.createverticalbox();

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

  {

  panel[i] = new ownpanel();

  panel[i].addactionlistener( new actionhandler() );

  this.box1.add( panel[i] );

  this.box1.add( box.createverticalstrut( 4 ) );

  }

  this.panel[0].settext( " background" );

  this.panel[1].settext( " snake" );

  this.panel[2].settext( " bean" );

  this.panel[3].settext( " eatedbean" );

  this.panel[0].setback( colorgroup.color_back );

  this.panel[1].setback( colorgroup.color_snake );

  this.panel[2].setback( colorgroup.color_bean );

  this.panel[3].setback( colorgroup.color_eatedbean );

  this.box2 = box.createhorizontalbox();

  this.commitbutton = new jbutton( "确定" );

  this.commitbutton.setfont( font.getfont( "fixedsys" ) );

  this.commitbutton.addactionlistener( new actionhandler() );

  this.cancelbutton = new jbutton( "取消" );

  this.cancelbutton.setfont( font.getfont( "fixedsys" ) );

  this.cancelbutton.addactionlistener( new actionhandler() );

  this.box2.add( this.commitbutton );

  this.box2.add( box.createhorizontalstrut( 20 ) );

  this.box2.add( this.cancelbutton );

  this.box1.add( this.box2 );

  this.c.add( this.box1, borderlayout.north );

  this.setlocation( ( this.gettoolkit().getscreensize().width - this.getwidth() )/2,

  ( this.gettoolkit().getscreensize().height - this.getheight() )/2 );

  this.setvisible( true );

  }

  public void setownercolor( color temp )

  {

  this.owner.getcontentpane().setbackground( temp );

  }

  private class actionhandler implements actionlistener

  {

  public void actionperformed( actionevent e )

  {

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

  {

  if( e.getsource() == panel[i].rebutton() )

  {

  color[i] = jcolorchooser.showdialog( configdialog.this,

  "choose background color",

  color.white );

  if( color[i] != null )

  {

  panel[i].setback( color[i] );

  }

  }

  }

  if( e.getsource() == commitbutton )

  {

  color[0] = (color[0]==null?colorgroup.color_back:color[0]);

  color[1] = (color[1]==null?colorgroup.color_snake:color[1]);

  color[2] = (color[2]==null?colorgroup.color_bean:color[2]);

  color[3] = (color[3]==null?colorgroup.color_eatedbean:color[3]);

  configdialog.this.setvisible( false );

  colorgroup.setcolor_back( color[0] );

  owner.getcontentpane().setbackground( color[0] );

  colorgroup.setcolor_snake( color[1] );

  colorgroup.setcolor_bean( color[2] );

  colorgroup.setcolor_eatedbean( color[3] );

  configdialog.this.dispose();

  }

  else if( e.getsource() == cancelbutton )

  {

  configdialog.this.setvisible( false );

  configdialog.this.dispose();

  }

  }

  }

  }

  class ownpanel extends jpanel

  {

  private jlabel temp1;

  private jtextfield temp2;

  private jbutton temp3;

  ownpanel()

  {

  temp1 = new jlabel();

  temp1.setfont( font.getfont( "fixedsys" ) );

  temp2 = new jtextfield();

  temp3 = new jbutton( "change" );

  temp3.setfont( font.getfont( "fixedsys" ) );

  temp2.seteditable( false );

  temp2.setcolumns( 10 );

  this.add( temp1 );

  this.add( temp2 );

  this.add( temp3 );

  this.setlayout( new gridlayout( 1, 3 ) );

  }

  public void setbuttonname( string temp )

  {

  temp3.setname( temp );

  }

  public void setback( color temp )

  {

  temp2.setbackground( temp );

  }

  public void settext( string temp )

  {

  temp1.settext( temp );

  }

  public object rebutton()

  {

  return temp3;

  }

  public void addactionlistener( actionlistener ac )

  {

  temp3.addacti

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