Java How to Program学习笔记_第十二章_GUI组件——第一部分-3(GUI Components: Part 1)

Java大学教程(Java How to Program)(第四版)中文版[3] Java大学教程(Java How to Program)(第四版)中文版[3]<br/>国外经典教程 立即下载

 

1. inputEvent方法(判断鼠标右键和鼠标中间键是否被点击)

InputEvent methods that help determine whether the right or center mouse button was clicked
InputEvent methodDescription
isMetaDown()Returns true when the user clicks the right mouse button on a mouse with two or three buttons. To simulate a right-mousebutton click on a one-button mouse, the user can hold down the Meta key on the keyboard and click the mouse button.
isAltDown()Returns true when the user clicks the middle mouse button on a mouse with three buttons. To simulate a middle-mouse-button click on a one- or two-button mouse, the user can press the Alt key and click the only or left mouse button, respectively.

2. 简单画图板的实现

3.  键盘事件捕捉演示

4. 页面布局管理器

5. FlowLayout示例

6. BorderLayout示例

 

7. GridLayout示例

 

8. JPanel示例

 

 

Java大学教程(Java How to Program)(第四版)中文版 pdf 本书以初学者为起点,循序渐进地介绍了面向对象的Java编程语言,系统地讨论了Java的基本概念和编程技术。全书共分为18章,首先从基本的Java理论开始,讲解了Java的基本数据类型和控制结构,Java中的方法、数组和字符串,以及基于对象的编程和面向对象的编程。书中还讨论了很多有关Java的高级课题,包括图形、图形用户界面组件、异常处理、多线程、多媒体、文件和流、网络、数据结构以及Java工具包和位处理。全书内容丰富、构思严谨、条理清晰,写作方法别具一格,并且提供了大量实用、有趣的练习,可以使读者在较短的时间内掌握基本的和最新的编程技术。 本书是高等院校进行编程语言和Java教学的教材,也是软件设计人员进行Java程序开发的宝贵参考资料。 立即下载

相关推荐

Java大学教程(Java How to Program)(第四版)中文版.part2

Java大学教程(Java How to Program)(第四版)中文版.part2

《Java How To Program》Deitel著

RT 转载于:https://www.cnblogs.com/PoeticalJustice/p/8303542.html

weixin_34087503的博客 217

Java大学教程(Java How to Program)(第四版)中文版.part2.rar

Java大学教程(Java How to Program)(第四版)中文版.part2.rar

Java How to Program习题_第十二章_GUI组件——第一部分(GUI Components: Part 1)

这章习题,除了Optional和Making Difference以外,全做完了,剩下的有空可以做做!信心是有了! Self-Review Exercises 12.1 Fill in the blanks in each of the following statements: a) Method mouseMoved is called when the mouse ...

预见未来to50的专栏 826

Java大学教程(Java How to Program)(第四版)中文版.part1.rar

Java大学教程(Java How to Program)(第四版)中文版.part1.rar

Java How to program第九版,彩色印刷

彩印版PDF,下载后压缩包解压即可打开,内容绝对清晰。。

Java How to Program学习笔记_章节小结——第十二章_GUI组件——第一部分(GUI Components: Part 1)

这章的内容挺多的。 Summary Section 12.1 Introduction • A graphical user interface (GUI) presents a user-friendly mechanism for interacting with an application. A GUI gives an application a distinc...

预见未来to50的专栏 405

Java大学教程(Java How to Program)(第四版)中文版[5]

Java大学教程(Java How to Program)(第四版)中文版[5].part5.rar 国外经典教程

Java How to Program学习笔记_第十二章_GUI组件——第一部分-2(GUI Components: Part 1)

  1. JButton示例 2. 复选框示例 3. 单选按钮示例 4. 组合框示例   5. 列表框示例 6. 多选框示例   7. MouseListener and MouseMotionListener的接口方法 MouseListener and MouseMotionListener interface methods Listener M...

预见未来to50的专栏 259

Java大学教程(Java How to Program)(第四版)中文版.pdf

Java大学教程(Java How to Program)(第四版)中文版.pdf

如何将COMSOL与MATLAB联合【超详细,一网打尽】

如何将COMSOL与MATLAB联合 文章目录如何将COMSOL与MATLAB联合前言一、背景二、使用步骤1. 找到 COMSOL Multiphysics 5.5 with MATLAB2. **双击COMSOL Multiphysics 5.5 with MATLAB** 前言 网上搜索教程,发现大部分教程讲得比较初略,或者信息比较分散。本着自己踩过坑就不愿意让别人再踩一遍的原则,写下这篇博文。 提示:以下是本篇文章正文内容,下面案例可供参考 一、背景 COMSOL 5.5 MATLAB 20

fendiman的博客 7万+

Java How to Program学习笔记_第十二章_GUI组件——第一部分-1(GUI Components: Part 1)

1. Swing GUI(图形用户界面)组件示例 2. 使用JOptionPane作为输入输出界面的加法程序 3. 消息对话框中的JOptionPane静态变量 4. Swing基本GUI组件   5. 轻量级Swing组件的共同父类   6. 测试LabelFrame   7. 定位(positioning)常量   8. java.awt.event包中的一些...

预见未来to50的专栏 224

一位海外开发者的 OpenSPG KAG 实践分享

KAG 是一个以创建和操作知识图谱为核心的框架。知识图谱是数据之间相互关联的可视化和结构化表示,对于搜索引擎、推荐系统和机器学习等应用至关重要。KAG 的目标是提供一个强大的平台,使开发者能够:轻松构建图谱;通过增强算法丰富数据;集成人工智能,以进行更精确的推理。通过理解 KAG,可以明显看出,这个框架旨在帮助从初学者到专业开发者,在项目中创造更优的解决方案。它在简便性和集成方面的优势,使其成为下一代基于数据的应用程序的前景工具。

金融机器智能社区 3420

java 按钮组,添加一个按钮组件到Java在Java标签面板

i am trying to create GUI using java swings.I am just a beginner in java swings.My primary idea was to create two tabs and add a button in one of the tabs.I wanted to write a separate class for each t...

weixin_35077079的博客 388

【ERROR】ERROR1: PROJ: proj_create_from_database: Cannot find proj.db - 环境变量配置与路径修复指南

本文详细解析了地理空间数据处理中常见的【ERROR】ERROR1: PROJ: proj_create_from_database: Cannot find proj.db 错误。该错误的根源是PROJ库无法定位其核心数据文件proj.db。文章提供了从问题诊断到修复的完整指南,包括如何在不同系统(Windows/macOS/Linux)和安装方式(Conda/pip/源码编译)下找到正确的proj.db文件路径,并通过设置PROJ_LIB环境变量(临时、代码内或永久)彻底解决问题,同时给出了进阶排查技巧和

m2n3o4p5的博客 562

离线语音识别模块LD3320实战:如何低成本给STM32设备加上‘耳朵’和‘嘴巴’?

本文详细介绍了如何为STM32设备集成LD3320离线语音识别模块,实现低成本语音交互方案。从硬件连接到STM32底层驱动实现,再到指令训练与词条优化技巧,完整解析了唤醒词检测与自定义指令识别的全过程。LD3320作为非特定人声识别芯片,无需网络连接,适用于智能家居、工业控制等场景,是嵌入式开发者的理想选择。

weixin_30906185的博客 560

How to Use HTML in Swing Components

http://download.oracle.com/javase/tutorial/uiswing/components/html.html

不积跬步无以至千里,不积小流无以成江海。 776

ABB机器人发送实时位置给PLC

本文使用中断方式实现,多任务要订购ABB功能包 Profinet总线组变量配置 注:映射为16位和32位均可用 声明数据 VAR num CurrentExAxisPos;!外轴位置 VAR robtarget pCurrentPos;!实时位置 var intnum TrapNum;!中断号 初始化开中断 IDelete TrapNum;!中断号 CONNECT TrapNum WITH iTrapCurPos;!连接中...

澍澍爸的blog 6786

sap for linux下载地址,How to Download sapgui for linux

Hi,As Bobby said, you need to install the SAPGUI for JAVA to access the SAP R/3 from your linux machine. The software is available in the following path,--> Installations and Upgrades--> Entry b...

weixin_42246401的博客 868

SAP FICO实操:如何修改已发生业务数据的成本中心公司代码(附RKACOR06程序运行指南)

本文详细解析了SAP FICO系统中使用RKACOR06程序修改已发生业务数据的成本中心和公司代码的实操方法。通过实战案例分享,提供从前期准备到后期验证的全流程指南,帮助企业应对组织架构重组或财务核算体系调整时的数据迁移挑战,特别适用于跨公司代码的成本中心划转场景。

weixin_27303545的博客 199

uniapp [全端兼容] - 详细实现人脸识别和活体检测功能,实时监测人脸是否进入区域及动作是否正确播报,免费自动提示引导动作及语音,提供提供实名认证、身份证识别、人脸信息采集、刷脸扫脸认证示例代码

uniapp,h5移动端网页,微信小程序,支付宝小程序,Android安卓,苹果ios,app,nvue,人脸识别,扫脸认证,人脸认证,活体认证,身份认证,uni-app人脸识别详细教程,如何在app端实现免费人脸识别教程,如何在小程序端做,最好用的插件,安卓ios百度人脸识别、活体检测、人脸采集APP,H5人脸识别带前后摄像头,适合新手看的人脸识别功能教程,详细示例代码源码,有没有免费的,接入百度,阿里云人脸识别,百度,api,活体检测,数据采集,动作提示指引,语音提示指引,报错,无法核验一直出错,根本用

🏆 前端领域优质创作者 1万+

Creating Components: Object Oriented, Concurrent, and Distributed Computing in Java

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。http://blog.csdn.net/topmvp - topmvpProgrammers can refer to Creating Components: Object Oriented, Concurrent, and Distributed Computing in Java

TopMVP 532

DeepSeek Harness 工程实践与高级特性:从测试到安全的完整指南

AI Agent 能执行命令、读写文件、自主决策,能力越强风险越大——删文件、泄密钥、死循环、竞态条件随时可能发生。本文是 DeepSeek Harness 系列第三篇,深入剖析其工程实践与高级特性:从单元测试到真实 API 冒烟测试的分层策略,拒绝 Mock 依赖、坚持"验证世界而非自我报告";从正交结果、规范化契约到 Dispose 静止的防御式编程铁律;以及跨平台多层进程沙箱、文件系统版本守卫、fail-closed 审批机制、模型编写的工作流引擎与上下文压缩等高级能力。

program哲学 220

Adding Commands to Displayable Components? @ JDJ

<!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--><script type="text/javascript"

zgqtxwd的专栏 499

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

AnAndroid basic components use

Android basic components use1.1Using XML-Based LayoutsWhile it is technically possible to create and attach widgets to our activity purely through Java code, the way we did in Chapter 4, the more comm

eclipseyl的专栏 406

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 学以致用——Java源码——键盘事件演示程序(Keystroke Events Demo Program)
下一篇: Java How to Program学习笔记_章节小结——第十二章_GUI组件——第一部分(GUI Components: Part 1)
预见未来to50
博客等级 码龄20年 6880粉丝 2788原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值