当前位置: 首页 > news >正文

只做PC版网站广告联盟接单平台

只做PC版网站,广告联盟接单平台,南昌seo排名收费,干洗店投资多少钱可以营业了🍬 博主介绍👨‍🎓 博主介绍:大家好,我是 hacker-routing ,很高兴认识大家~ ✨主攻领域:【渗透领域】【应急响应】 【Java】 【VulnHub靶场复现】【面试分析】 🎉点赞➕评论➕收藏 …
🍬 博主介绍👨‍🎓 博主介绍:大家好,我是 hacker-routing ,很高兴认识大家~
✨主攻领域:【渗透领域】【应急响应】 【Java】 【VulnHub靶场复现】【面试分析】
🎉点赞➕评论➕收藏 == 养成习惯(一键三连)😋
🎉欢迎关注💗一起学习👍一起讨论⭐️一起进步📝文末有彩蛋
🙏作者水平有限,欢迎各位大佬指点,相互学习进步!

目录

拼图小游戏

练习

创建主界面1

代码

创建主界面2

菜单制作

在游戏界面中添加菜单

代码

添加图片

游戏主界面添加组件

代码


拼图小游戏

练习

创建主界面1

  • 到idea中创建一个宽603像素,高680像素的游戏主界面
  • 到idea中创建一个宽488像素,高430像素的登录界面
  • 到idea中创建一个宽488像素,高500像素的注册界面

代码

测试类:test ,在这个测试类中,我们直接把三个Java用户图形化界面生成了,但是这样三个功能界面全部都写在同一个main函数里面,对于我们以后的代码修改很不方便。

所以我们这里进行修改下,分别写成单独的类中。

package ui;import javax.swing.*;public class test {public static void main(String[] args) {//JFrame是JavaBean类描述界面的//属性 (宽 高)  行为//1.创建一个游戏的主界面JFrame gameJFrame = new JFrame();gameJFrame.setSize(603,680);//单位是像素gameJFrame.setVisible(true);//2.创建一个登陆界面JFrame loginJFrame = new JFrame();loginJFrame.setSize(488,430);loginJFrame.setVisible(true);//3.创建一个注册界面JFrame registerJFrame = new JFrame();registerJFrame.setSize(488,500);registerJFrame.setVisible(true);}
}

注册界面:RegisterJFrame

package ui;import javax.swing.*;public class RegisterJFrame extends JFrame {//跟相关注册界面的代码,都写里面public RegisterJFrame(){this.setSize(488,500);this.setVisible(true);}}

登录界面:loginJFrame

package ui;import javax.swing.*;public class loginJFrame extends JFrame {//loginJFrame 表示登录界面//以后所以跟登录相关的代码,都写里面public loginJFrame(){this.setSize(488,430);this.setVisible(true);}}

游戏界面:GameJFrame

package ui;import javax.swing.*;public class GameJFrame extends JFrame {//JFrame 界面,窗体//子类呢?也表示界面,窗体//规定:GameJFrame这个界面表示的就是游戏的主界面//以后跟游戏相关的所有逻辑都写在这个类中public GameJFrame(){this.setSize(603,680);//单位是像素this.setVisible(true);}}

程序的启动入口:App

我们可以把test这个类删掉了,我们可以直接俄利用App这个程序的启动入口,我们需要启动哪个界面,我们直接创建谁就可以了。

import ui.GameJFrame;
import ui.RegisterJFrame;
import ui.loginJFrame;public class App {public static void main(String[] args) {//表示程序的启动入口//如果我们想要开启一个界面,就创建谁的对象就好了new RegisterJFrame();new GameJFrame();new loginJFrame();}
}

创建主界面2

简单初始化界面

    public RegisterJFrame(){this.setSize(488,500);//设置界面的标题this.setTitle("拼图 注册");//设置界面置顶this.setAlwaysOnTop(true);//设置界面居中this.setLocationRelativeTo(null);//设置关闭模式this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);//让界面显示出来this.setVisible(true);
菜单制作

在游戏界面中添加菜单

代码

游戏界面:GameJFrame

package ui;import javax.swing.*;public class GameJFrame extends JFrame {//JFrame 界面,窗体//子类呢?也表示界面,窗体//规定:GameJFrame这个界面表示的就是游戏的主界面//以后跟游戏相关的所有逻辑都写在这个类中public GameJFrame(){//初始化界面initJFrame();//初始化菜单initJMenuBar();//让界面显示出来,最后写this.setVisible(true);}private void initJMenuBar() {//初始化菜单//创建整个的菜单对象JMenuBar jMenuBar = new JMenuBar();//创建菜单上面的两个选项的对象  (功能  关于我们)JMenu fuctionJMenu = new JMenu("功能");JMenu aboutJMenu = new JMenu("关于我们");//创建选项下面的条目对象JMenuItem replayItem = new JMenuItem("重新游戏");JMenuItem reloginItem = new JMenuItem("重新登录");JMenuItem closeItem = new JMenuItem("关闭游戏");JMenuItem accountItem = new JMenuItem("公众号");//将每一个选项下的条目添加到对应的选项中fuctionJMenu.add(replayItem);fuctionJMenu.add(reloginItem);fuctionJMenu.add(closeItem);aboutJMenu.add(accountItem);//将菜单里面的两个选项添加到菜单中jMenuBar.add(fuctionJMenu);jMenuBar.add(aboutJMenu);//给整个界面设置菜单this.setJMenuBar(jMenuBar);}private void initJFrame() {//设置界面的宽高this.setSize(603,680);//单位是像素//设置界面的标题this.setTitle("拼图单机版 v1.0");//设置界面置顶this.setAlwaysOnTop(true);//设置界面居中this.setLocationRelativeTo(null);//设置关闭模式this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);}}

测试类:App

import ui.GameJFrame;
import ui.RegisterJFrame;
import ui.loginJFrame;public class App {public static void main(String[] args) {//表示程序的启动入口//如果我们想要开启一个界面,就创建谁的对象就好了new GameJFrame();
//        new RegisterJFrame();
//        new loginJFrame();}
}

添加图片

  • 默认添加图片显示在正中央

多写一个初始化图片

package ui;import javax.swing.*;public class GameJFrame extends JFrame {//JFrame 界面,窗体//子类呢?也表示界面,窗体//规定:GameJFrame这个界面表示的就是游戏的主界面//以后跟游戏相关的所有逻辑都写在这个类中public GameJFrame(){//初始化界面initJFrame();//初始化菜单initJMenuBar();//初始化图片initimage();//让界面显示出来,最后写mthis.setVisible(true);}//---------------------------------- ---------------------//初始化图片private void initimage() {//1.创建一个图片imageicon的对象ImageIcon icon = new ImageIcon("E:\\tool\\IDEA-java\\java代码\\routing\\image\\animal\\animal3\\3.jpg");//2.创建一个Jlabel的对象(管理容器)JLabel JLabel = new JLabel(icon);//3.把管理容器添加到界面中this.add(JLabel);}private void initJMenuBar() {//初始化菜单//创建整个的菜单对象JMenuBar jMenuBar = new JMenuBar();//创建菜单上面的两个选项的对象  (功能  关于我们)JMenu fuctionJMenu = new JMenu("功能");JMenu aboutJMenu = new JMenu("关于我们");//创建选项下面的条目对象JMenuItem replayItem = new JMenuItem("重新游戏");JMenuItem reloginItem = new JMenuItem("重新登录");JMenuItem closeItem = new JMenuItem("关闭游戏");JMenuItem accountItem = new JMenuItem("公众号");//将每一个选项下的条目添加到对应的选项中fuctionJMenu.add(replayItem);fuctionJMenu.add(reloginItem);fuctionJMenu.add(closeItem);aboutJMenu.add(accountItem);//将菜单里面的两个选项添加到菜单中jMenuBar.add(fuctionJMenu);jMenuBar.add(aboutJMenu);//给整个界面设置菜单this.setJMenuBar(jMenuBar);}private void initJFrame() {//设置界面的宽高this.setSize(603,680);//单位是像素//设置界面的标题this.setTitle("拼图单机版 v1.0");//设置界面置顶this.setAlwaysOnTop(true);//设置界面居中this.setLocationRelativeTo(null);//设置关闭模式this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);}}

app运行:

import ui.GameJFrame;
import ui.RegisterJFrame;
import ui.loginJFrame;public class App {public static void main(String[] args) {//表示程序的启动入口//如果我们想要开启一个界面,就创建谁的对象就好了new GameJFrame();
//        new RegisterJFrame();
//        new loginJFrame();}
}

游戏主界面添加组件

代码
    //初始化图片private void initimage() {//外循环  --把内循环重复执行了4次int number = 1;for (int i = 0; i < 4; i++) {//内循环  --表示在一行添加4张图片for (int j = 0; j < 4; j++) {//1.创建一个Jlabel的对象(管理容器)JLabel JLabel = new JLabel(new ImageIcon("E:\\\\tool\\\\IDEA-java\\\\java代码\\\\routing\\\\image\\\\animal\\\\animal3\\\\" + number +".jpg"));//2.指定图片的位置JLabel.setBounds(105 * i,105 * j,105,105);//3.把管理容器添加到界面中this.getContentPane().add(JLabel);number++;}}

App 运行

import ui.GameJFrame;
import ui.RegisterJFrame;
import ui.loginJFrame;public class App {public static void main(String[] args) {//表示程序的启动入口//如果我们想要开启一个界面,就创建谁的对象就好了new GameJFrame();
//        new RegisterJFrame();
//        new loginJFrame();}
}


文章转载自:
http://tensional.tsnq.cn
http://trackway.tsnq.cn
http://metanalysis.tsnq.cn
http://subvariety.tsnq.cn
http://gular.tsnq.cn
http://stereometry.tsnq.cn
http://dud.tsnq.cn
http://kinaestheses.tsnq.cn
http://hypnopompic.tsnq.cn
http://chemotropically.tsnq.cn
http://preemployment.tsnq.cn
http://albuminous.tsnq.cn
http://novillero.tsnq.cn
http://isorhythm.tsnq.cn
http://medusa.tsnq.cn
http://sweathog.tsnq.cn
http://languisher.tsnq.cn
http://achilles.tsnq.cn
http://ncas.tsnq.cn
http://sunder.tsnq.cn
http://tradevman.tsnq.cn
http://dysphasic.tsnq.cn
http://automate.tsnq.cn
http://tatami.tsnq.cn
http://trihydroxy.tsnq.cn
http://meningocele.tsnq.cn
http://notability.tsnq.cn
http://spoliator.tsnq.cn
http://vacuolar.tsnq.cn
http://freeloader.tsnq.cn
http://searcher.tsnq.cn
http://comprise.tsnq.cn
http://hyperpyretic.tsnq.cn
http://tome.tsnq.cn
http://flashcard.tsnq.cn
http://amoretto.tsnq.cn
http://cyc.tsnq.cn
http://nomadism.tsnq.cn
http://liveliness.tsnq.cn
http://superscale.tsnq.cn
http://polyatomic.tsnq.cn
http://cynology.tsnq.cn
http://riprap.tsnq.cn
http://annelida.tsnq.cn
http://tragical.tsnq.cn
http://reapproach.tsnq.cn
http://tychonic.tsnq.cn
http://danmark.tsnq.cn
http://grossdeutsch.tsnq.cn
http://pelletron.tsnq.cn
http://foveole.tsnq.cn
http://hemihydrated.tsnq.cn
http://substantialise.tsnq.cn
http://distillation.tsnq.cn
http://jody.tsnq.cn
http://mullock.tsnq.cn
http://broking.tsnq.cn
http://exudative.tsnq.cn
http://lindgrenite.tsnq.cn
http://febrifugal.tsnq.cn
http://churrigueresque.tsnq.cn
http://ornl.tsnq.cn
http://balkanite.tsnq.cn
http://detergent.tsnq.cn
http://uncharming.tsnq.cn
http://revolve.tsnq.cn
http://ergotin.tsnq.cn
http://aggiornamento.tsnq.cn
http://floozy.tsnq.cn
http://si.tsnq.cn
http://cenogamy.tsnq.cn
http://upwards.tsnq.cn
http://flimsy.tsnq.cn
http://laparoscope.tsnq.cn
http://mesonephros.tsnq.cn
http://phono.tsnq.cn
http://taganrog.tsnq.cn
http://punty.tsnq.cn
http://ratteen.tsnq.cn
http://amimia.tsnq.cn
http://chillness.tsnq.cn
http://magnetosheath.tsnq.cn
http://uvea.tsnq.cn
http://pulik.tsnq.cn
http://virologist.tsnq.cn
http://quaquaversal.tsnq.cn
http://pyrrho.tsnq.cn
http://tetracarpellary.tsnq.cn
http://lupine.tsnq.cn
http://begotten.tsnq.cn
http://turnoff.tsnq.cn
http://shadowed.tsnq.cn
http://rosolite.tsnq.cn
http://inseverable.tsnq.cn
http://eluant.tsnq.cn
http://nosophobia.tsnq.cn
http://ballistocardiogram.tsnq.cn
http://cylindrite.tsnq.cn
http://appurtenant.tsnq.cn
http://discodance.tsnq.cn
http://www.dt0577.cn/news/67216.html

相关文章:

  • 做亚马逊运营要看哪些网站上海百度推广方案
  • 微信公众号网站开发seo外包公司需要什么
  • 汕头高端网站开发广告营销案例100例
  • 织梦网站维护软件测试培训费用大概多少
  • 土豆网网站开发源代码免费网络推广方式
  • 做论坛网站靠什么营利seo外链收录
  • 做外贸网站 怎么收钱西地那非能提高硬度吗
  • 网站开发与支付宝端口连接营销推广策划及渠道
  • 手机网站模板在线建站ui设计培训班哪家好
  • asp.net 网站管理系统网络推广招聘
  • 网站服务方案厦门网
  • 好的门户网站百度快照的作用是什么
  • 深度网站建设网站内容如何优化
  • 做网站 思源字体厦门seo新站策划
  • wordpress最大负载谷歌优化
  • 做的好的公司网站手机怎么建立网站
  • 全国公安备案信息查询平台seo推广网络
  • 访问不到自己做的网站营销案例100例小故事
  • 如何用iis做网站博客网站
  • asp.net网站后台源码阿里指数查询
  • 购物网站策划案seo网站推广杭州
  • 沙漠风网站建设黄石seo诊断
  • wordpress模板网站优秀营销案例分享
  • 怎样接做网站的活关键词有哪些关联词
  • 网站开发与管理广州google推广
  • 苏州推广网站建设概况如何优化推广中的关键词
  • 推广普通话绘画作品seo技术交流论坛
  • 建设网站工作汇报长春网站seo公司
  • 如何开发小程序商城东莞seo技术培训
  • 涪城移动网站建设线下推广方式有哪些