GridBagLayout练习
摘自http://blog.csdn.net/qq_18989901/article/details/52403737
GridBagLayout是面板设计中最复杂的布局工具,当然用的好的话也是最方便的。
GridBagLayout其组件的摆放都是有GridBagConstraints控制的。可以将需要设计的界面划分成许多个纵横的小网格,每个网格里面最多放置一个组件,一个组件可以占用多个网格。
网格的定义是由gridx和gridy定义的,前者表示横坐标,后者表示纵坐标,坐标是从0开始,从整个面板的左上角开始算起,所以在上图中,按钮7所在的位置gridx=0,gridy=0;以此类推,后面所有的网格位置都可以这样定义;
但是图中网格的宽度和高度是由什么定义的呢?答案是gridwidth和gridheight,为1表示占用一个网格,为2表示占用两个网格,如上图中"+"的gridwidth=1,gridheight=2;
知道这两个,就可以大体把网格划分清楚,每一个的具体位置也就有了着落。有朋友会说,我也是这样写的,但是组件怎么就那么小呢?那是因为GridBaglayout里面还有一项参数weight,她控制着组件随着面板的变化自身的变化情况,默认情况下weightx=0,weighty=0,意思是组件大小固定,不管面板如何变,自身就那么大,但是如果想让组件随面板变化的话,可以设置weightx和weighty,设置为浮点数也行,其值代表着变化的大小,也就是你宽度设为2,高度设为1的话,拉大面板会使组件越变越宽。
这三个是比较重要的Constraints,另外,还有insets,其有四个参数,表示其上左下右和相邻组件的最小间隔;ipadx和ipady表示组件间距,默认是0(其和insets不同读者可以自己摸索一下);fill参数表示当网格区域比组件大的伤害,组件是以何种方式填充区域,是全方位还是水平或竖直;anchor是区域比组件大时,组件应该显示在区域的哪个方位,西北还是东南;
测试1:
本文主要通过设计一个计算器界面的方式,来学习GridBagLayout的使用。最终的效果如下图所示:

下面是我实现面板显示部分的所有代码:
package com.wst.bj; import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField; public class GridBagTest2 { private JFrame jframe = new JFrame();
private JButton bt1 = new JButton("1");
private JButton bt2 = new JButton("2");
private JButton bt3 = new JButton("3");
private JButton bt4 = new JButton("4");
private JButton bt5 = new JButton("5");
private JButton bt6 = new JButton("6");
private JButton bt7 = new JButton("7");
private JButton bt8 = new JButton("8");
private JButton bt9 = new JButton("9");
private JButton bt0 = new JButton("0");
private JButton btdot = new JButton(".");
private JButton btsignleft = new JButton("(");
private JButton btsignright = new JButton(")");
private JButton btp = new JButton("+");
private JButton btm = new JButton("-");
private JButton btmp = new JButton("*");
private JButton btd = new JButton("/");
private JButton bte = new JButton("=");
private JButton bt = new JButton("00");
private JButton btclear = new JButton("cl");
private JTextField textField = new JTextField(); public GridBagTest2() {
init();
} private void init()
{
FrameUtil.initFram(jframe, 300, 400);
JPanel jpanel = createPanel();
jframe.add(jpanel);
} private JPanel createPanel(){
JPanel panel = new JPanel(); GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbs = new GridBagConstraints();
panel.setLayout(gbl); panel.add(bt7);panel.add(bt8);panel.add(bt9);panel.add(btp);
panel.add(bt4);panel.add(bt5);panel.add(bt6);
// panel.add(bt1);panel.add(bt2);panel.add(bt9);panel.add(btp);
panel.add(bt1);panel.add(bt2);panel.add(bt3);panel.add(btm);
panel.add(bt0);panel.add(btdot);
panel.add(btsignleft);panel.add(btsignright);panel.add(bte);panel.add(btmp);
panel.add(btclear);panel.add(bt); panel.add(btd);
panel.add(textField); gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=0;
gbl.setConstraints(bt7, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=1;gbs.gridy=0;
gbl.setConstraints(bt8, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=2;gbs.gridy=0;
gbl.setConstraints(bt9, gbs); gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=2;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=3;gbs.gridy=0;
gbl.setConstraints(btp, gbs); gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=1;
gbl.setConstraints(bt4, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=1;gbs.gridy=1;
gbl.setConstraints(bt5, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=2;gbs.gridy=1;
gbl.setConstraints(bt6, gbs); gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=2;
gbl.setConstraints(bt1, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=1;gbs.gridy=2;
gbl.setConstraints(bt2, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=2;gbs.gridy=2;
gbl.setConstraints(bt3, gbs); gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=2;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=3;gbs.gridy=2;
gbl.setConstraints(btm, gbs); gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=2;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=3;
gbl.setConstraints(bt0, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=2;gbs.gridy=3;
gbl.setConstraints(btdot, gbs); gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=4;
gbl.setConstraints(btsignleft, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=1;gbs.gridy=4;
gbl.setConstraints(btsignright, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=2;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=2;gbs.gridy=4;
gbl.setConstraints(bte, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=3;gbs.gridy=4;
gbl.setConstraints(btmp, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=5;
gbl.setConstraints(btclear, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=1;gbs.gridy=5;
gbl.setConstraints(bt, gbs);
gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=3;gbs.gridy=5;
gbl.setConstraints(btd, gbs); gbs.fill=GridBagConstraints.BOTH;gbs.gridwidth=4;gbs.gridheight=3;
gbs.insets=new Insets(5, 5, 5, 5);gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=6;
gbl.setConstraints(textField, gbs); return panel;
}
}
测试2:

package com.wst.bj; import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets; import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField; public class GridBagTest4 { private JFrame jframe = new JFrame();
private JButton bt1 = new JButton("1");
private JButton bt2 = new JButton("2");
private JButton bt3 = new JButton("3");
private JButton bt4 = new JButton("4");
private JButton bt5 = new JButton("5");
private JButton bt6 = new JButton("6");
private JButton bt7 = new JButton("7");
private JButton bt8 = new JButton("8");
private JButton bt9 = new JButton("9");
private JButton bt0 = new JButton("0");
private JButton btdot = new JButton(".");
private JButton btsignleft = new JButton("(");
private JButton btsignright = new JButton(")");
private JButton btp = new JButton("+");
private JButton btm = new JButton("-");
private JButton btmp = new JButton("*");
private JButton btd = new JButton("/");
private JButton bte = new JButton("=");
private JButton bt = new JButton("00");
private JButton btclear = new JButton("cl");
private JTextField textField = new JTextField(); public GridBagTest4() {
init();
} private void init()
{
FrameUtil.initFram(jframe, 300, 400);
JPanel jpanel = createPanel();
jframe.add(jpanel);
} private JPanel createPanel(){
JPanel panel = new JPanel(); GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbs = new GridBagConstraints();
panel.setLayout(gbl); panel.add(bt7);panel.add(bt8);panel.add(bt9);panel.add(btp);
panel.add(bt4);panel.add(bt5);panel.add(bt6);
panel.add(bt1);panel.add(bt2);panel.add(bt3);panel.add(btm);
panel.add(bt0);panel.add(btdot);
panel.add(btsignleft);panel.add(btsignright);panel.add(bte);panel.add(btmp);
panel.add(btclear);panel.add(bt); panel.add(btd);
panel.add(textField); gbs.fill=GridBagConstraints.NONE;
// gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.ipadx = 100;
// gbs.ipady = 100;
gbs.anchor = GridBagConstraints.WEST;
gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=0;
gbl.setConstraints(bt7, gbs); gbs.fill=GridBagConstraints.NONE;
// gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.NORTHEAST;
gbs.gridx=1;gbs.gridy=0;
gbl.setConstraints(bt8, gbs); gbs.fill=GridBagConstraints.NONE;
// gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.SOUTH;
gbs.gridx=2;gbs.gridy=0;
gbl.setConstraints(bt9, gbs);
//
gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=2;
//// gbs.insets=new Insets(5, 5, 5, 5);
//// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=3;gbs.gridy=0;
gbl.setConstraints(btp, gbs);
// =====================================================
gbs.fill=GridBagConstraints.VERTICAL;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.WEST;
gbs.gridx=0;gbs.gridy=1;
gbl.setConstraints(bt4, gbs);
//
gbs.fill=GridBagConstraints.VERTICAL;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.SOUTHEAST;
gbs.gridx=1;gbs.gridy=1;
gbl.setConstraints(bt5, gbs); gbs.fill=GridBagConstraints.VERTICAL;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.CENTER;
gbs.gridx=2;gbs.gridy=1;
gbl.setConstraints(bt6, gbs);
// =====================================================
gbs.fill=GridBagConstraints.HORIZONTAL;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.NORTH;
gbs.gridx=0;gbs.gridy=2;
gbl.setConstraints(bt1, gbs); gbs.fill=GridBagConstraints.HORIZONTAL;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.SOUTHEAST;
gbs.gridx=1;gbs.gridy=2;
gbl.setConstraints(bt2, gbs); gbs.fill=GridBagConstraints.HORIZONTAL;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.CENTER;
gbs.gridx=2;gbs.gridy=2;
gbl.setConstraints(bt3, gbs); gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=2;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=3;gbs.gridy=2;
gbl.setConstraints(btm, gbs);
// =====================================================
gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=2;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=3;
gbl.setConstraints(bt0, gbs); gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=2;gbs.gridy=3;
gbl.setConstraints(btdot, gbs);
// =====================================================
gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=4;
gbl.setConstraints(btsignleft, gbs); gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=1;
gbs.insets=new Insets(7, 7, 2, 2);
// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=1;gbs.gridy=4;
gbl.setConstraints(btsignright, gbs); gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=2;
gbs.insets=new Insets(0, 0, 0, 0);
// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=2;gbs.gridy=4;
gbl.setConstraints(bte, gbs); gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=3;gbs.gridy=4;
gbl.setConstraints(btmp, gbs);
// =====================================================
gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
gbs.weightx=0;gbs.weighty=0;
gbs.gridx=0;gbs.gridy=5;
gbl.setConstraints(btclear, gbs); gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.gridx=1;gbs.gridy=5;
gbl.setConstraints(bt, gbs); gbs.fill=GridBagConstraints.NONE;
gbs.gridwidth=1;gbs.gridheight=1;
// gbs.insets=new Insets(5, 5, 5, 5);
// gbs.weightx=1;gbs.weighty=1;
gbs.anchor = GridBagConstraints.EAST;
gbs.gridx=3;gbs.gridy=5;
gbl.setConstraints(btd, gbs);
// =====================================================
gbs.fill=GridBagConstraints.BOTH;
gbs.gridwidth=4;gbs.gridheight=3;
// gbs.insets=new Insets(5, 5, 5, 5);
gbs.weightx=1;gbs.weighty=1;
gbs.gridx=0;gbs.gridy=6;
gbl.setConstraints(textField, gbs);
// // =====================================================
gbs.anchor = GridBagConstraints.NORTH;
return panel;
}
}
GridBagLayout练习的更多相关文章
- Java GridBagLayout 简单使用
这里只介绍了很基础布局构建及使用,主要是关于 GridBagLayout. 首先整套流程大概是, 声明一个 GridBagLayout 对象 private GridBagLayout gridBag ...
- Java基础之创建窗口——使用GridBagLayout管理器(TryGridBagLayout)
控制台程序. java.awt.GridBagLayout管理器比前面介绍的其他布局管理器灵活得多,因此使用起来也比较复杂.基本机制就是在随意的矩形网格中布局组件,但网格的行和列不一定拥有相同的高度和 ...
- 关于GridBagLayout的讲解哦
13-08-29 17:01:10| 分类: Java | 标签:gridbaglayout gridbagconstraints 添加方法 |字号 订阅 GridBagLayout ...
- GridBagLayout()的使用方法
GridBagLayout是java里面最重要的布局管理器之一,可以做出很复杂的布局,可以说GridBagLayout是必须要学好的的, GridBagLayout 类是一个灵活的布局管理器,它不要求 ...
- GridBagLayout:网格包布局管理器
GridBagLayout:网格包布局管理器 GridBagLayout可以说是布局管理器Layout中最复杂的一个,其中涉及到的参数也比较得多,比如说: GridBagConstraints g ...
- GridBagLayout占多行效果注意
如果想要出现按钮2占两行的效果,必须按键3.按钮4同时存在且同时可见. 如果缺少按钮4,则按钮2不会占两行: 如果缺少按钮3.4,则按钮2也不会占两行. package com.wst.bj; imp ...
- javax.Swing 使用GridBagLayout的程序栗子
摘自https://zhidao.baidu.com/question/110748776.html javax.Swing 使用GridBagLayout的程序栗子 总共两个文件,第一个是启动文件, ...
- 使用GridBagLayout控制行列的高度和宽度
摘自http://bbs.csdn.net/topics/340189065使用GridBagLayout控制行列的高度和宽度 gridwidth 指定组件显示区域的某一行中的单元格数. 默认值1,水 ...
- Java 的布局管理器GridBagLayout的使用方法(转)
GridBagLayout是java里面最重要的布局管理器之一,可以做出很复杂的布局,可以说GridBagLayout是必须要学好的的, GridBagLayout 类是一个灵活的布局管理器,它不要求 ...
随机推荐
- Android --- 字符串\n的换行问题
我的一段文字"测试文本\n测试文本\n测试文本\n测试文本\n测试文本\n测试文本\n". 该段文字放在一个txt文本内. 我用流读取后,显示在一个TextView里. 我期望的显 ...
- [重磅] 让HTML5达到原生的体验 系列之中的一个 避免切页白屏
非常多人都想.甚至曾使用HTML5开发跨平台App.而且想达到原生App的体验. 最后的结果都是无奈的放弃.HTML5貌似美好,但坑太多.想做到原生App的体验差点儿不可为. 也曾有过著名的faceb ...
- UVa 10256 The Great Divide,推断两个凸包是否相离
先从给出的两个点集中分别计算出两个凸包, 然后推断两个凸包是否相离. #include<cstdio> #include<vector> #include<cmath&g ...
- E514:write error(file system full?)
vi编辑某文件,保存时报错,提示:E514: write error (file system full?)---写入错误,磁盘满了? 查看磁盘空间:df -h根目录磁盘空间已满,used%100. ...
- EffectiveC#3--选择is或者as操作符而不是做强制类型转换
1.用as运算符进行类型转换.因为比起盲目的强制转换它更安全,而且在运行时效率更高. 安全体现在:as操作符就算是转化一个null的引用时,也会安全的返回一个null而不会像强制转换抛出异常. 2.a ...
- CLR via C# - Char_String
.NET中Char表示为16为的Unicode值,Char提供两个public const字段MinValue('\0',写成'\u0000'也是一样的)和MaxValue('\uffff'). Ch ...
- solr热身
入博客园快满一年,居然没写一篇博客,好惭愧. 公司的搜索系统需要从Lucene.net(更新相当不给力)换成solr了,最近一直在学习solr,相关资料是相当的少啊,特别是还要在.net环境下开发.准 ...
- 触控(Touch)
1 使用触控实现一个简易的画板 1.1 问题 触控(Touch)是一个UITouch类型的对象,当用户触摸了屏幕上的视图时自动被创建,通常使用触控实现绘图.涂鸦.手写等功能.本案例使用触控实现一个简易 ...
- javaScript增加样式规则(新增样式)
<html> <head> <link rel="stylesheet" type="text/css" href="b ...
- OpenCV——Sobel和拉普拉斯变换
Sobel变换和拉普拉斯变换都是高通滤波器. 什么是高通滤波器呢?就是保留图像的高频分量(变化剧烈的部分),抑制图像的低频分量(变化缓慢的部分).而图像变化剧烈的部分,往往反应的就是图像的边沿信息了. ...