awt和swing学习(二)

本文深入探讨了游戏开发领域的关键技术,包括游戏引擎、编程语言、硬件优化等,并重点介绍了AI音视频处理在游戏中的应用,如语音识别、图像处理、AR特效等。同时,文章还涉及了自动化测试、性能优化等现代开发流程,旨在为游戏开发者提供全面的技术指导。

有点乱,有时间再整理

Code:
  1. import java.util.*;   
  2. import java.io.*;   
  3. import java.awt.*;   
  4. import java.awt.event.*;   
  5. import javax.swing.*;   
  6.   
  7. public class TestLayout {   
  8.     public static void main(String[] args) {   
  9.         MyFrame mf = new MyFrame();   
  10.     }   
  11. }   
  12.   
  13. class MyFrame extends JFrame implements ActionListener {   
  14.        
  15.     public MyFrame() {   
  16.         super();   
  17.         this.setTitle("TestMyFrame");   
  18.         this.setSize(800600);   
  19.         this.centerOnScreen();   
  20.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   
  21.         Container p = getContentPane();   
  22.         p.setLayout(new BorderLayout());   
  23.            
  24.         JMenuBar jmb = new JMenuBar();   
  25.         JMenu[] jm = new JMenu[3];   
  26.         JMenuItem[][] jmi = { {new JMenuItem("打开"),new JMenuItem("保存")},   
  27.                               {new JMenuItem("选择")},   
  28.                               {new JMenuItem("新窗口")}   
  29.                             };   
  30.         String[] mName = {"文件""颜色""窗口"};   
  31.         for(int i=0; i<jm.length; i++) {   
  32.             jm[i] = new JMenu(mName[i]);   
  33.             for(int j=0; j<jmi[i].length; j++) {   
  34.               jmi[i][j].addActionListener(this);   
  35.                 jm[i].add(jmi[i][j]);   
  36.             }   
  37.             jmb.add(jm[i]);   
  38.       }   
  39.         this.setJMenuBar(jmb);   
  40.            
  41.         setVisible(true);      
  42.     }   
  43.        
  44.     public void actionPerformed(ActionEvent e) {   
  45.         if(e.getActionCommand()=="打开") {   
  46.             JFileChooser chooseFile = new JFileChooser();   
  47.             int returnVal = chooseFile.showOpenDialog(null);   
  48.       if(returnVal == chooseFile.APPROVE_OPTION) {   
  49.         File f = chooseFile.getSelectedFile();   
  50.         JOptionPane.showConfirmDialog(this"你选择的文件名是:"+chooseFile.getName(f),   
  51.                                       "确认",JOptionPane.ERROR_MESSAGE);   
  52.         }   
  53.         } else if(e.getActionCommand()=="保存") { //也可以用getsource()方法获得那个变量   
  54.             JFileChooser chooseFile = new JFileChooser();   
  55.             int returnVal = chooseFile.showSaveDialog(null);   
  56.       if(returnVal == chooseFile.APPROVE_OPTION) {   
  57.         File f = chooseFile.getSelectedFile();   
  58.        JOptionPane.showConfirmDialog(this,chooseFile.getName(f));   
  59.       }   
  60.         } else if(e.getActionCommand()=="选择") {   
  61.             Color tmpColor = JColorChooser.showDialog(this"调色板", Color.red);   
  62.         } else if(e.getActionCommand()=="新窗口") {   
  63.             MySmallFrame msf = new MySmallFrame("Just for fun !");   
  64.         } else {   
  65.         }   
  66.     }   
  67.        
  68.     public void centerOnScreen() {   
  69.         Dimension displaySize = getToolkit().getScreenSize();   
  70.         Dimension winSize = getSize();   
  71.         int x = (displaySize.width - winSize.width) / 2;   
  72.         int y = (displaySize.height - winSize.height) / 2;   
  73.         if(x < 0) {   
  74.             x = 0;   
  75.         }   
  76.         if(y < 0) {   
  77.             y = 0;   
  78.         }   
  79.         setLocation(x, y);   
  80.     }   
  81. }   
  82.   
  83. class MyFlowLayout extends FlowLayout {   
  84. }   
  85. class MyGridLayout extends GridLayout {   
  86. }   
  87. class MyBorderLayout extends BorderLayout {   
  88. }   
  89.   
  90. class MySmallFrame extends JFrame implements ActionListener {   
  91.     Container p;   
  92.     JPanel viewPane1,viewPane2,viewPane3;   
  93.     JTextField textIn;   
  94.     JButton btnExpert;   
  95.     JTextArea textOut;   
  96.     public MySmallFrame(String s) {   
  97.         super();   
  98.         p = getContentPane();   
  99.         viewPane1 = new JPanel();               //视图一   
  100.         p.add(viewPane1, BorderLayout.NORTH);   //把视图一添加到北边   
  101.         //viewPane1.setLayout();   
  102.         viewPane1.setBackground(Color.green);   //设置视图一的背景色   
  103.         viewPane2 = new JPanel();                   
  104.         p.add(viewPane2, BorderLayout.CENTER);  //把视图二添加到面板中间   
  105.            
  106.         viewPane3 = new JPanel();   
  107.         viewPane3.setLayout(null);   
  108.         JLabel labeTips = new JLabel();   
  109.         labeTips.setBounds(45,20,200,21);   
  110.         labeTips.setText("请在下框中输入土壤湿度:");   
  111.         labeTips.setForeground(new Color(00255));   
  112.         textIn = new JTextField();   
  113.         textIn.addActionListener(this);   
  114.         textIn.setBounds(60,46,120,21);   
  115.         textIn.setBackground(new Color(216191216));   
  116.         viewPane3.add(labeTips);   
  117.         viewPane3.add(textIn);   
  118.         JLabel labeImag = new JLabel();   
  119.     labeImag.setBounds(15, -15300400);   
  120.     labeImag.setIcon(new ImageIcon("20.jpg"));   
  121.     viewPane3.add(labeImag);   
  122.     btnExpert = new JButton();   
  123.     btnExpert.setText("咨询专家");   
  124.     btnExpert.setBackground(new Color(216191216));   
  125.     btnExpert.setForeground(new Color(25500));   
  126.     btnExpert.setBounds(7530090,23);   
  127.     btnExpert.addActionListener(this);   
  128.     viewPane3.add(btnExpert);      
  129.        
  130.     GridLayout gl = new GridLayout(0,2);       
  131.         viewPane2.setLayout(gl);                  //把面板二分成面板三和输出面板   
  132.         viewPane2.add(viewPane3);   
  133.         textOut = new JTextArea("专家的意见:/n       ");   
  134.         textOut.setFont(new Font("", Font.BOLD, 18));   
  135.         textOut.setBackground(new Color(238130238));   
  136.         viewPane2.add(textOut);    
  137.            
  138.         setTitle(s);   
  139.         setBounds(500,200,500,400);   
  140.         JLabel labe = new JLabel();   
  141.         labe.setBounds(20,20,200,500);   
  142.         labe.setForeground(Color.red);   
  143.         labe.setText("及时和适量的供水是保证苹果丰产、优质的重要措施。");   
  144.         labe.setFont(new Font("", Font.BOLD, 15));   
  145.         viewPane1.add(labe);   
  146.            
  147.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   
  148.         setVisible(true);   
  149.     }   
  150.        
  151.     public void actionPerformed(ActionEvent e) {   
  152.         String s = textIn.getText();   
  153.         if(e.getSource()==btnExpert) {   
  154.             textOut.append(s);   
  155.         }   
  156.     }   
  157. }  

 

标题SpringBoot智能在线预约挂号系统研究AI更换标题第1章引言介绍智能在线预约挂号系统的研究背景、意义、国内外研究现状及论文创新点。1.1研究背景与意义阐述智能在线预约挂号系统对提升医疗服务效率的重要性。1.2国内外研究现状分析国内外智能在线预约挂号系统的研究与应用情况。1.3研究方法及创新点概述本文采用的技术路线、研究方法及主要创新点。第2章相关理论总结智能在线预约挂号系统相关理论,包括系统架构、开发技术等。2.1系统架构设计理论介绍系统架构设计的基本原则常用方法。2.2SpringBoot开发框架理论阐述SpringBoot框架的特点、优势及其在系统开发中的应用。2.3数据库设计与管理理论介绍数据库设计原则、数据模型及数据库管理系统。2.4网络安全与数据保护理论讨论网络安全威胁、数据保护技术及其在系统中的应用。第3章SpringBoot智能在线预约挂号系统设计详细介绍系统的设计方案,包括功能模块划分、数据库设计等。3.1系统功能模块设计划分系统功能模块,如用户管理、挂号管理、医生排班等。3.2数据库设计与实现设计数据库表结构,确定字段类型、主键及外键关系。3.3用户界面设计设计用户友好的界面,提升用户体验。3.4系统安全设计阐述系统安全策略,包括用户认证、数据加密等。第4章系统实现与测试介绍系统的实现过程,包括编码、测试及优化等。4.1系统编码实现采用SpringBoot框架进行系统编码实现。4.2系统测试方法介绍系统测试的方法、步骤及测试用例设计。4.3系统性能测试与分析对系统进行性能测试,分析测试结果并提出优化建议。4.4系统优化与改进根据测试结果对系统进行优化改进,提升系统性能。第5章研究结果呈现系统实现后的效果,包括功能实现、性能提升等。5.1系统功能实现效果展示系统各功能模块的实现效果,如挂号成功界面等。5.2系统性能提升效果对比优化前后的系统性能
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值