第一范文网 - 专业文章范例文档资料分享平台

java贪吃蛇 - 图文

来源:用户分享 时间:2025/8/22 13:49:52 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

selectPanel.add(selectLabel); modePanel.add(briefness); modePanel.add(medium); modePanel.add(difficulty);

northPanel.add(\northPanel.add(\foodPanel = new JPanel();

foodPanel.setLayout(new BorderLayout()); foodColorPanel = new JPanel(); foodSelectPanel = new JPanel(); foodLabel = new JLabel(\食物颜色\foodLabel.setForeground(Color.red); foodBlue = new JRadioButton(\蓝\

foodRed = new JRadioButton(\红\foodGreen = new JRadioButton(\绿\foodYellow = new JRadioButton(\黄\foodOrange = new JRadioButton(\橙\bg2 = new ButtonGroup(); bg2.add(foodBlue); bg2.add(foodRed); bg2.add(foodGreen); bg2.add(foodYellow); bg2.add(foodOrange);

foodColorPanel.add(foodLabel); foodSelectPanel.add(foodBlue); foodSelectPanel.add(foodRed); foodSelectPanel.add(foodGreen); foodSelectPanel.add(foodYellow); foodSelectPanel.add(foodOrange); foodPanel.add(\foodPanel.add(\headPanel = new JPanel();

headPanel.setLayout(new BorderLayout());

headColorPanel = new JPanel(); headSelectPanel = new JPanel(); headLabel = new JLabel(\蛇头颜色\headLabel.setForeground(Color.red); headBlue = new JRadioButton(\蓝\

headRed = new JRadioButton(\红\headGreen = new JRadioButton(\绿\headYellow = new JRadioButton(\黄\headOrange = new JRadioButton(\橙\bg3 = new ButtonGroup(); bg3.add(headBlue); bg3.add(headRed); bg3.add(headGreen); bg3.add(headYellow); bg3.add(headOrange);

headPanel.add(headLabel);

headColorPanel.add(headLabel); headSelectPanel.add(headBlue); headSelectPanel.add(headRed); headSelectPanel.add(headGreen); headSelectPanel.add(headYellow); headSelectPanel.add(headOrange); headPanel.add(\headPanel.add(\bodyPanel = new JPanel();

bodyPanel.setLayout(new BorderLayout()); bodyColorPanel = new JPanel(); bodySelectPanel = new JPanel(); bodyLabel = new JLabel(\蛇身颜色\bodyLabel.setForeground(Color.red); bodyRed = new JRadioButton(\红\

bodyGreen = new JRadioButton(\绿\bodyBlue = new JRadioButton(\蓝\bodyYellow = new JRadioButton(\黄\bodyOrange = new JRadioButton(\橙\

bg4 = new ButtonGroup(); bg4.add(bodyRed); bg4.add(bodyGreen); bg4.add(bodyBlue); bg4.add(bodyYellow); bg4.add(bodyOrange);

bodyPanel.add(bodyLabel);

bodyColorPanel.add(bodyLabel); bodySelectPanel.add(bodyRed); bodySelectPanel.add(bodyGreen); bodySelectPanel.add(bodyBlue); bodySelectPanel.add(bodyYellow); bodySelectPanel.add(bodyOrange); bodyPanel.add(\bodyPanel.add(\centerPanel.add(\centerPanel.add(\centerPanel.add(\showPanel = new JPanel(); defaultPanel = new JPanel(); buttonPanel = new JPanel();

showGrid = new JRadioButton(\显示网格\cancelGrid = new JRadioButton(\取消网格\

bg5 = new ButtonGroup(); bg5.add(showGrid); bg5.add(cancelGrid);

defaultButton = new JButton(\默认设置\confirm = new JButton(\确定\cancel = new JButton(\取消\showPanel.add(showGrid); showPanel.add(cancelGrid); defaultPanel.add(defaultButton); buttonPanel.add(confirm); buttonPanel.add(cancel);

southPanel.add(\southPanel.add(\southPanel.add(\

briefness.setSelected(true); foodBlue.setSelected(true); headBlue.setSelected(true); bodyRed.setSelected(true); cancelGrid.setSelected(true);

this.add(\this.add(\this.add(\

Toolkit tok = Toolkit.getDefaultToolkit(); int width = tok.getScreenSize().width; int height = tok.getScreenSize().height;

this.setBounds((width - 260) / 2, (height - 370) / 2, 260, 405); this.setTitle(\游戏设置\this.setResizable(false);

this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

defaultButton .addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { briefness.setSelected(true); foodBlue.setSelected(true); headBlue.setSelected(true); bodyRed.setSelected(true); cancelGrid.setSelected(true); } });

confirm.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if (briefness.isSelected()) {

搜索更多关于: java贪吃蛇 - 图文 的文档
java贪吃蛇 - 图文.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c1fjjj86lf79pugm7q9ww_2.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top