资源简介
java-界面组件案例大全(内含139个完整Demo),初学AWT和Swing设计GUI的有用资源!
代码片段和文件信息
/*
* Copyright (c) 1995 2008 Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms with or without
* modification are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS
* IS“ AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL
* EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE DATA OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package layout;
/*
* GridLayoutDemo.java
*
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GridLayoutDemo extends Jframe {
static final String gapList[] = {“0“ “10“ “15“ “20“};
final static int maxGap = 20;
JComboBox horGapComboBox;
JComboBox verGapComboBox;
JButton applyButton = new JButton(“Apply gaps“);
GridLayout experimentLayout = new GridLayout(02);
public GridLayoutDemo(String name) {
super(name);
setResizable(false);
}
public void initGaps() {
horGapComboBox = new JComboBox(gapList);
verGapComboBox = new JComboBox(gapList);
}
public void addComponentsToPane(final Container pane) {
initGaps();
final JPanel compsToExperiment = new JPanel();
compsToExperiment.setLayout(experimentLayout);
JPanel controls = new JPanel();
controls.setLayout(new GridLayout(23));
//Set up components preferred size
JButton b = new JButton(“Just fake button“);
Dimension buttonSize = b.getPreferredSize();
compsToExperiment.setPreferredSize(new Dimension((int)(buttonSize.getWidth() * 2.5)+maxGap
(int)(buttonSize.getHeight() * 3.5)+maxGap * 2));
//Add buttons to experiment with Grid Layout
compsToExperiment.add(new JButton(“Button 1“));
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 22601 2010-09-23 23:13 components\components-BorderDemoProject.zip
文件 9883 2010-09-23 23:15 components\components-ButtonDemoProject.zip
文件 10076 2010-09-23 23:15 components\components-ButtonHtmlDemoProject.zip
文件 85669 2010-09-23 23:16 components\components-CheckBoxDemoProject.zip
文件 61579 2010-09-23 23:16 components\components-ColorChooserDemo2Project.zip
文件 34311 2010-09-23 23:15 components\components-ColorChooserDemoProject.zip
文件 21164 2010-09-23 23:15 components\components-ComboBoxDemo2Project.zip
文件 36103 2010-09-23 23:15 components\components-ComboBoxDemoProject.zip
文件 17040 2010-09-23 23:16 components\components-ConverterProject.zip
文件 36776 2010-09-23 23:13 components\components-CustomComboBoxDemoProject.zip
文件 13779 2010-09-23 23:15 components\components-CustomIconDemoProject.zip
文件 28183 2010-09-23 23:15 components\components-DialogDemoProject.zip
文件 10908 2010-09-23 23:16 components\components-DynamicTreeDemoProject.zip
文件 18258 2010-09-23 23:16 components\components-FileChooserDemo2Project.zip
文件 10099 2010-09-23 23:15 components\components-FileChooserDemoProject.zip
文件 22675 2010-09-23 23:15 components\components-FormattedTextFieldDemoProject.zip
文件 22828 2010-09-23 23:15 components\components-FormatterFactoryDemoProject.zip
文件 12267 2010-09-23 23:15 components\components-fr
文件 7797 2010-09-23 23:15 components\components-fr
文件 8732 2010-09-23 23:15 components\components-fr
文件 14035 2010-09-23 23:15 components\components-GenealogyExampleProject.zip
文件 21636 2010-09-23 23:15 components\components-GlassPaneDemoProject.zip
文件 46683 2010-09-23 23:16 components\components-HtmlDemoProject.zip
文件 169684 2010-09-23 23:17 components\components-IconDemoProject.zip
文件 10073 2010-09-23 23:15 components\components-Internalfr
文件 16110 2010-09-23 23:16 components\components-JWSFileChooserDemoProject.zip
文件 8956 2010-09-23 23:15 components\components-LabelDemoProject.zip
文件 61769 2010-09-23 23:16 components\components-la
文件 48706 2010-09-23 23:16 components\components-la
文件 9923 2010-09-23 23:15 components\components-ListDemoProject.zip
............此处省略126个文件信息
相关资源
- Java--web小网站
- Java微信退款
- java+mysql新闻发布网站(含数据库)
- 网上书城项目源码
- Java调用Webservice接口的jar包
- SM3加密 js版和java版
- 基于java的五子棋程序设计毕业论文
- C#调用java直接调用无需生成.net组件
- KWIC4种架构Java实现及4个Assignment
- 企业日常事务管理系统JAVA+SQL2000
- JAVAIO流学习总结转
- Java SuperVCD
- Java mysql 科研信息管理系统(数据库课
- mysql-connector-java-5.1.8
- 日程安排:jQuery的日历插件 FullCalen
- java版超市管理系统java连接数据库
- java流程图生成器
- java实现企业员工信息管理系统完整版
- 当当网网上书店java源代码
- java课程设计-网上超市系统
- javac1.7源代码(完全版,可运行)
- java开源股票系统
- JAVA与ANYLOGIC的关联用法
- 电影管理系统
- 图书馆管理系统Java 优秀毕业设计论文
- java程序设计--售票系统
- java web实验室管理系统 毕业设计
- JAVA房屋出租管理系统
- Java+Mysql+Swing即时聊天系统,公、私聊
- java与c++通过socket通信
评论
共有 条评论