JAVA_eclipse插件绘制GUI界面过程
JAVA_eclipse插件绘制GUI界面过程
- 安装eclipse插件
安装WindowBuilder插件
选择相应的版本install
等待下载安装完成重新启动eclipse
- 插件的使用
新建项目,选择其他
新建Application Window
生成代码界面和design界面
选择design进行gui界面编辑
例如创建一个简易的计算器4*4界面布局
首先需要是使用布局
其次创建一个文本框TextField
添加一个面板Panel
同时面板布局采用GridLayout,自动排列,往面板添加按钮
左下角设置按钮参数
依次添加全部按钮最后结果
自动生成的代码块如下(部分)
/*** Launch the application.*/public static void main(String[] args) {EventQueue.invokeLater(new Runnable() {public void run() {try {caculatetest window = new caculatetest();window.frame.setVisible(true);} catch (Exception e) {e.printStackTrace();}}});}/*** Create the application.*/public caculatetest() {initialize();}/*** Initialize the contents of the frame.*/private void initialize() {frame = new JFrame();frame.setBounds(100, 100, 522, 504);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);textField = new JTextField();textField.setColumns(10);JPanel panel = new JPanel();GroupLayout groupLayout = new GroupLayout(frame.getContentPane());groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addContainerGap().addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(textField, GroupLayout.PREFERRED_SIZE, 484, GroupLayout.PREFERRED_SIZE).addComponent(panel, GroupLayout.PREFERRED_SIZE, 485, GroupLayout.PREFERRED_SIZE)).addContainerGap(13, Short.MAX_VALUE)));groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(textField, GroupLayout.PREFERRED_SIZE, 82, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(panel, GroupLayout.PREFERRED_SIZE, 349, GroupLayout.PREFERRED_SIZE).addContainerGap(20, Short.MAX_VALUE)));panel.setLayout(new GridLayout(4, 4, 0, 0));btnNewButton_1 = new JButton("+");btnNewButton_1.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_1);btnNewButton = new JButton("-");btnNewButton.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton);btnNewButton_2 = new JButton("x");btnNewButton_2.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_2);btnNewButton_3 = new JButton("/");btnNewButton_3.setEnabled(true);btnNewButton_3.setFont(new Font("Dialog", Font.PLAIN, 17));panel.add(btnNewButton_3);btnNewButton_4 = new JButton("1");btnNewButton_4.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_4);btnNewButton_5 = new JButton("2");btnNewButton_5.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_5);btnNewButton_6 = new JButton("3");btnNewButton_6.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_6);btnNewButton_7 = new JButton("0");btnNewButton_7.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_7);btnNewButton_8 = new JButton("4");btnNewButton_8.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_8);btnNewButton_9 = new JButton("5");btnNewButton_9.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_9);btnNewButton_10 = new JButton("6");btnNewButton_10.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_10);btnNewButton_11 = new JButton("c");btnNewButton_11.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_11);btnNewButton_12 = new JButton("7");btnNewButton_12.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_12);btnNewButton_13 = new JButton("8");btnNewButton_13.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_13);btnNewButton_14 = new JButton("9");btnNewButton_14.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_14);btnNewButton_15 = new JButton("=");btnNewButton_15.setFont(new Font("宋体", Font.PLAIN, 17));panel.add(btnNewButton_15);frame.getContentPane().setLayout(groupLayout);
JAVA_eclipse插件绘制GUI界面过程相关推荐
- Qt 快速利用qt designer Layout绘制GUI界面
文章目录 前言 一.目的 二.实现过程 1.界面使用的元素介绍: 2.实现步骤 总结 前言 最近用qt画一个项目界面,本文主要记录了如何通过qt designer使用layout进行快速绘制,下文中的 ...
- pyqt5如何循环遍历控件名_利用Python的PyQt5编写GUI界面教学,QT5还是比较难的
由于学校课程的项目,最近最近在学习如何利用Python语言和SQL Server编写一个读者图书借阅.查询管理的小程序.以此为契机吧,自己便开始了学习之路~ 这篇文章主要介绍自己如何使用PyQt5编写 ...
- python界面开发 web_使用 web 技术构建 python 的 GUI 界面
一般来说,选择用于应用程序的 GUI 工具箱会是一个棘手的事情,Python 也不例外.对于 Python 来说,可以选择的工具箱种类繁多.就我所知道的而言,比较常用的就有 TkInter, wxPy ...
- python实现的、带GUI界面电影票房数据可视化程序
代码地址如下: http://www.demodashi.com/demo/14588.html ##详细说明: Tushare是一个免费.开源的python财经数据接口包.主要实现对股票等金融数据从 ...
- Python量化交易平台开发教程系列7-顶层GUI界面开发(1)
原创文章,转载请注明出处:用Python的交易员 前言 终于有时间来写第一篇顶层GUI界面开发相关的教程了,之前实在是事情太多,跟各位读者抱个歉. 整合底层接口的各项功能到中层引擎中后,当我们开发顶层 ...
- 【Qt设计开发】GUI界面设计开发
文章目录 一.Qt简介和下载安装 二.Qt入门 2.1 创建第一个项目 2.2 快捷键和命名规范 2.3 Qt项目和VS2022项目相互转换 三.Qt基础 3.1 Qt对象树和窗口坐标系概念 3.2 ...
- 【Visual C++】游戏开发五十六 浅墨DirectX教程二十三 打造游戏GUI界面(一)
本系列文章由zhmxy555(毛星云)编写,转载请注明出处. 文章链接: http://blog.csdn.net/poem_qianmo/article/details/16384009 作者:毛星 ...
- 《UnityAPI.GUI界面》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+GUI+DrawTexture+FocusControl+Toggle+立钻哥哥++OK++)
<UnityAPI.GUI界面> 版本 作者 参与者 完成日期 备注 UnityAPI_GUI_V01_1.0 严立钻 2020.07.23 #<UnityAPI.GUI界面> ...
- Matlab简易版美图秀秀(GUI界面实现)
该项目为数字图像处理课程的期末大项目,主要内容是用matlab软件实现一些美图秀秀相关功能,比如对图像进行水平垂直翻转,旋转,裁剪,抠图等基础功能:对图像添加浮雕,艺术噪声,灰度胶片,动感模糊,素描, ...
最新文章
- shell版俄罗斯方块
- 关键路径法及C语言实现
- C++基本序列式容器 vector (一)
- python 提高文件查询效率_Python 大量小文件存储提高效率的简单示例
- python hashlib模块(提供常见摘要算法)
- VMware NAT模式
- 服务器日志显示意外关闭,服务器事件日志
- 用pythonnet为计算机视觉做图像整理
- Struts1.x系列教程(17):使用IncludeAction和ForwardAction类包含和转入Web资源
- [Java] 蓝桥杯ADV-65 算法提高 格子位置
- Android Alertdialog之多选对话框
- 银行业如何搭建自服务的数据平台?
- html ios视频播放器,iOS 视频播放器(整理)
- 用计算机怎么弹星辰大海,【计算机学院】你们的征途将是星辰大海~
- 华三F100 系列防火墙 - 浮动路由联动NQA 实现双线路自动切换
- 了解LabVIEW编程
- android_x86安装arm转译
- kafka消费端Attempt to heartbeat failed since group is rebalancing
- 《手Q Android线程死锁监控与自动化分析实践》
- Katago+Sabaki个人围棋AI工具安装配置