swing之gridlayout
package gui1; import java.awt.FlowLayout;
import java.awt.GridLayout; import javax.swing.JButton;
import javax.swing.JFrame; public class gridlayout1 extends JFrame{
JButton [] a={null,null,null,null,null,null,null,null};
public static void main(String[] args) {
// TODO Auto-generated method stub
gridlayout1 g1=new gridlayout1();
}
public gridlayout1()
{ a[]=new JButton("瓜子");
a[]=new JButton("话梅");
a[]=new JButton("西瓜");
a[]=new JButton("草莓");
a[]=new JButton("香蕉");
a[]=new JButton("苹果");
a[]=new JButton("栗子");
a[]=new JButton("黄瓜");
//a[8]=new JButton("葡萄"); this.setLayout(new GridLayout(,,,));//默认是边界布局,如果想变成其他布局,加上 this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]);
this.add(a[]); this.setTitle("网格布局gridlayout");
this.setSize(,);
this.setLocation(, );
this.setResizable(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true); }
}

swing之gridlayout的更多相关文章
- java在线聊天项目0.2版本 制作客户端窗体,使用swing(用户界面开发工具包)和awt(抽象窗口工具包) BorderLayout布局与GridLayout布局不同之处 JPanel设置大小
代码如下: package com.swift; import java.awt.BorderLayout; import java.awt.Color; import javax.swing.JBu ...
- 如何使用swing创建一个BeatBox
首先,我们需要回顾一些内容(2017-01-04 14:32:14): 1.Swing组件 Swing的组件(component,或者称之为元件),是较widget更为正确的术语,它们就是会放在GUI ...
- Java Swing interview
http://www.careerride.com/Swing-AWT-Interview-Questions.aspx Swing interview questions and answers ...
- Swing布局管理器介绍
创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://zhangjunhd.blog.51cto.com/113473/128174 当选 ...
- java基础 swing编程实战
1. 实现金山词霸,点击左右收缩 效果图: exmaple code : /* * 词霸 * */ package demo7; import java.awt.*; import java.awt. ...
- Java Swing 第03记 布局管理器
几种Swing常用的布局管理器 BorderLaout 它将容器分为5个部分,即东.南.西.北.中,每一个区域可以容纳一个组件,使用的时候也是通过BorderLayout中5个方位常量来确定组件所在的 ...
- Java——Swing事件处理
import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import javax.swing.JFrame; ...
- 总结-swing、JFrame、JScrollPane、JTabbedPane、JEditorPane
总结-swing.JFrame.JButton.JScrollPane.JLabel.JTabbedPane.JEditorPane 1.JButton内边距(去掉按钮里的空白):setMargin2 ...
- 【Swing】理解Swing中的事件与线程
talk is cheap , show me the code. Swing中的事件 事件驱动 所有的GUI程序都是事件驱动的.Swing当然也是. GUI程序不同于Command Line程序,一 ...
随机推荐
- Understanding When to use RabbitMQ or Apache Kafka
https://content.pivotal.io/rabbitmq/understanding-when-to-use-rabbitmq-or-apache-kafka How do humans ...
- yii异常处理架构
使用方法: use \yii\base\ErrorException; try { exec("curl http://xxx",$out,$retno); if(0 !== $r ...
- 建议47:使用logging记录日志信息
# -*- coding:utf-8 -*- ''' Python中自带的logging 模块提供了日志功能,它将logger 的level 分为5 个级别 DEBUG 详细的信息,在追踪问题的时候使 ...
- iMX6 yocto平台QT交叉编译环境搭建
转:https://blog.csdn.net/morixinguan/article/details/79351909 . /opt/fsl-imx-fb/4.9.11-1.0.0/environm ...
- memcpy与memmove
函数原型: void* memcpy(void *dst,void const *src,size_t count) void* memmove(void *dst,void const *src,s ...
- Docker 配置代理
最近在k8s上部署helm 老提示无法下载镜像,因为伟大的祖国的长城Firewall....导致k8s根本玩不了..... 第一步:配置系统代理 # vim .bashrc export http_p ...
- MSSqlserver的锁模式介绍
一 SQL Server 锁类型的说明 在SQL Server数据库中加锁时,除了可以对不同的资源加锁,还可以使用不同程度的加锁方式,即有多种模式,SQL Server中锁模式包括: 1.共享锁(S) ...
- Efficient Vector Representation for Documents through Corruption-by Minmin Chen阅读
关键词: 词向量.文档向量.文档表示 地址:https://openreview.net/forum?id=B1Igu2ogg¬eId=B1Igu2ogg 首先,论文解决的是Word2V ...
- 【P2401】不等数列(DP)
这个题乍一看就应该是DP,再看一眼数据范围,1000..那就应该是了.然后就向DP的方向想,经过对小数据的计算可以得出,如果我们用f[i][j]来表示前i个数有j个是填了"<" ...
- 【codevs2011】最小距离之和 [LNOI2013](Floyd)
题目网址:http://codevs.cn/problem/2011/ 题目大意:有一个图,每次删一条边(可以重复删),求每次删边之后所有点对的最短距离之和. 看了一眼题目,顿时发现了O(n^4)的暴 ...