• 简单的Java界面展示


     1 package com.barry;
     2 
     3 import java.awt.Color;
     4 import java.beans.IntrospectionException;
     5 import java.lang.annotation.Repeatable;
     6 
     7 import com.rupeng.game.GameCore;//导入游戏引擎包
     8 
     9 
    10 //实现Runnable接口
    11 public class Game_RuPeng implements Runnable {
    12 
    13   public static void main(String[] args) {
    14       GameCore.start(new Game_RuPeng());//生成游戏对象,并让引擎启动它
    15   }
    16 private Object timg;
    17   //覆写接口中的run()方法,控制游戏
    18   @Override
    19   public void run() {
    20       GameCore.setGameSize(1024, 640);//设置游戏窗口大小
    21       GameCore.setGameTitle("马文奇的游戏制作");//设置游戏窗口标题
    22      // GameCore.pause(1000);//设置游戏窗口停留1秒
    23       GameCore.alert("listen to music 一次就好-杨宗纬");
    24       GameCore.loadBgView("timg.jpg");
    25       GameCore.playSound("一次就好-杨宗纬-1774946504.mp3", true);
    26       GameCore.pause(15000);//设置游戏窗口停留15秒
    27       GameCore.loadBgView("aa.jpg");
    28       GameCore.pause(3000);//设置游戏窗口停留3秒
    29       GameCore.alert("listen to music Try Everything");
    30       GameCore.playSound("TriGO! - Try Everything.mp3", true);
    31       GameCore.pause(20000);
    32       boolean b = GameCore.confirm("你觉得好听吗?");
    33       if(b)
    34           GameCore.alert("你的回答是好听");
    35       else
    36           GameCore.alert("你回答的是不好听");
    37       
    38       String n1 = GameCore.input(null, "请输入一个数字");
    39       String n2 = GameCore.input(null, "请再输入一个数字");
    40       
    41       if(n1.length()<=0||n2.length()<=0) {
    42           GameCore.alert("输入内容不正确,即将退出");
    43           GameCore.pause(3000);
    44           
    45       }else {
    46           GameCore.alert("两个个数字的和是:" + (Integer.parseInt(n1) + Integer.parseInt(n2)));
    47       }
    48       GameCore.createText(0,"马文奇");
    49       GameCore.createText(1,"NO PAINS NO GAINS");
    50       GameCore.setTextPosition(0, 100, 100);
    51       GameCore.setTextPosition(1, 100, 200);
    52       GameCore.setTextColor(0, Color.BLUE);
    53       GameCore.setTextColor(1,new Color(255,3,3));
    54       GameCore.setTextFontSize(0, 30);
    55       GameCore.setTextFontSize(1, 18);
    56       if(GameCore.confirm("你想要隐藏文本标签?")) {
    57           GameCore.hideText(0);
    58           GameCore.hideImage(1);
    59       }else {
    60           System.exit(0);
    61       }
    62       GameCore.alert("来一张图");
    63       GameCore.createImage(0, "美女.jpg");
    64       GameCore.setImagePosition(2,400,200);
    65       
    66       GameCore.createImage(1);
    67       GameCore.setImagePosition(4, 500, 500);
    68       
    69       GameCore.alert("显示出来");
    70       GameCore.setImageSource(1, "战狼2.jpg");
    71       GameCore.pause(100000);
    72           
    73       }
    74 
    75      
    76   }

    This moment will nap, you will have a dream; but this moment study, you will interpret a dream.
  • 相关阅读:
    【并发】基于 @Async和 CompletableFuture 实现并发异步操作
    【HTTP】使用 RestTemplete 实现 post请求
    【AICC】2019训练营笔记
    【Hadoop】CDH、Presto配置问题
    【Linux】文件拷贝-Linux当前目录所有文件移动到上一级目录(转)
    【Linux】linux ln文件夹的链接(转)
    【Hadoop】新建hadoop用户以及用户组,给予sudo权限(转)
    【Centos】桌面安装(转)
    【CentOS7】CentOS7各个版本镜像下载地址(转)
    【Spark】ScalaIDE运行spark,A master URL must be set in your configuration
  • 原文地址:https://www.cnblogs.com/mawenqi-barry/p/7688902.html
Copyright © 2020-2023  润新知