如何将我的 JFrame 连接到我的 Dotsgame 程序 [英] how to connect my JFrame to my Dotsgame program

查看:25
本文介绍了如何将我的 JFrame 连接到我的 Dotsgame 程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 JFrame 中输入我的详细信息并单击进入点游戏时不会弹出

When I enter my details in the JFrame and click enter the dots game to doesn't popup

JFrame 的代码

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         

   this.setVisible(false);
   new DotsAndBoxes2().setVisible(true);
   this.dispose();

这是 DOTS 游戏的一些代码.

and this is some of the code for the DOTS game.

package javaapplication5;


import javax.swing.JFrame;

import java.awt.*;

import java.awt.event.*;


public class DotsAndBoxes2



            extends JFrame
            implements ActionListener, ItemListener, Runnable

推荐答案

看起来您的 DotsAndBoxes2 实际上应该扩展 JFrame 而不是 Applet.无论哪种方式您的代码看起来都很糟糕,我建议您不要使用 GUI 生成器来创建代码,这会使调试变得困难.

It looks like your DotsAndBoxes2 should actually be extending JFrame instead of Applet. Either way your code looks horrible, I would suggest you don't use a GUI Builder to create the code and it makes debugging difficult.

这篇关于如何将我的 JFrame 连接到我的 Dotsgame 程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆