【问题标题】:Java Card game GUI using JLabel, JPanel and Jframe使用 JLabel、JPanel 和 Jframe 的 Java Card 游戏 GUI
【发布时间】:2022-06-19 03:35:55
【问题描述】:

我有这个项目,我需要在下面制作一个 gui..

Layout of the game

我正在做一些事情:

JLabel label_Image1 = new JLabel();
JButton btn_rpcard1 = new JButton("Replace Card 1");
JPanel MainPanel = new JPanel();
JPanel DealerPanel = new JPanel();
JPanel PlayerPanel = new JPanel();
JPanel RpCardBtnPanel = new JPanel();
JPanel ButtonPanel = new JPanel();
JPanel InfoPanel = new JPanel()

按下更换按钮时,我也需要更换卡片。我以某种方式管理了基础知识,但无法正确完成。帮帮我。谢谢

【问题讨论】:

  • 如果您不向我们展示您的作品,我们将无法为您提供帮助。
  • 添加了我的作品。请帮帮我
  • 如需更好的帮助,请尽快edit添加minimal reproducible example

标签: java swing jframe jlabel game-development


【解决方案1】:

当您可以使用 JCard1.setVisible (true) 显示上面的内容之后,这会在移除卡片时禁用查看功能

JButtonReplace.addActionListener(ee -> {
    JCard.setVisible(false);                     
});

更多帮助插入代码

【讨论】:

  • 您能帮忙编写 GUI 的代码吗?我的代码不起作用。
  • 我已经添加了我的作品
猜你喜欢
  • 1970-01-01
  • 2015-02-04
  • 1970-01-01
  • 2014-04-30
  • 1970-01-01
  • 2012-10-21
  • 1970-01-01
  • 2011-05-25
  • 1970-01-01
相关资源
最近更新 更多