background preloader

IT

Facebook Twitter

Programming Contests, Software Development, and Employment Services at TopCoder. Corner Article: Understanding Layouts in SWT. Overview When writing applications in the Standard Widget Toolkit (SWT), you may need to use layouts to give your windows a specific look.

Corner Article: Understanding Layouts in SWT

A layout controls the position and size of children in a Composite. Layout classes are subclasses of the abstract class Layout. SWT provides several standard layout classes, and you can write custom layout classes. In SWT, positioning and sizing does not happen automatically. The diagram below illustrates a few general terms that are used when discussing layouts. The preferred size of a widget is the minimum size needed to show its content. Standard Layouts The standard layout classes in the SWT library are: FillLayout lays out equal-sized widgets in a single row or column RowLayout lays out widgets in a row or rows, with fill, wrap, and spacing options GridLayout lays out widgets in a grid FormLayout lays out widgets by creating attachments for each of their sides To use the standard layouts, you need to import the SWT layout package: FillLayout RowLayout.

CSDN.NET - 全球最大中文IT社区,为IT专业技术人员提供最全面的信息传播和服务平台. Java基础教程-GUI - liyang999的专栏. 建立GUIs 本模块讲述图形用户界面的建立及布局。

java基础教程-GUI - liyang999的专栏

它介绍了抽象视窗工具包(AWT),一种建立GUIs的类包。 AWT提供用于所有Java applets及应用程序中的基本GUI组件,还为应用程序提供与机器的界面。 这将保证一台计算机上出现的东西与另一台上的相一致。 在学AWT之前,简单回顾一下对象层次。 显示在屏幕上的每个GUI组件都是抽象类组件的子类。 Container是Component的一个抽象子类,它允许其它的组件被嵌套在里面。 Java.awt包 Java.awt包包含生成WIDGETS和GUI组件的类。 建立图形用户界面 Container Container有两个主要类型:Window和Panel Window是Java.awt.Window.的对象。 Window有两种形式:Frame(框架)和Dialog(对话框)。 Panel是Java.awt.Panel的对象。 滚动块也是Window的一个子类。 定位组件 容器里的组件的位置和大小是由布局管理器决定的。 组件大小 因为布局管理器负责容器里的组件的位置和大小,因此不需要总是自己去设定组件的大小或位置。 如果必须控制组件的大小或位置,而使用标准布局管理器做不到,那就可能通过将下述方法调用发送到容器中来中止布局管理器: setLayout(null); 做完这一步,必须对所有的组件使用setLocation(),setSize()或setBounds(),来将它们定位在容器中。 Frames Frames是Window的一个子类。 框架类中的构造程序 Frame(String)用由String规定的标题来创建一个新的不可见的框架对象。 1. import java.awt 2. public class MyFrame extends Frame { 3. public static void main (String args[]) { 6. 7. fr.setSize(500,500); 4. fr.setBackground(Color.blue); 5. fr.setVisible(true); 7. public MyFrame (String str) { 8. super(str); 上述程序创建了下述框架,它有一个具体的标题、大小及背景颜色。

Panels 象Frames一样,Panels提供空间来连接任何GUI组件,包括其它面板。 完成端口详解 - 手把手教你玩转网络编程系列之三 - 小猪的网络编程. 手把手叫你玩转网络编程系列之三 完成端口(Completion Port)详解 ----- By PiggyXP(小猪) 前 言 本系列里完成端口的代码在两年前就已经写好了,但是由于许久没有写东西了,不知该如何提笔,所以这篇文档总是在酝酿之中……酝酿了两年之后,终于决定开始动笔了,但愿还不算晚…..

完成端口详解 - 手把手教你玩转网络编程系列之三 - 小猪的网络编程

编程相关 - 幻境. Grails中你可以使用quartz插件来定时执行一个任务(如同unix上的crontab一样)。

编程相关 - 幻境

本文通过构建这样一个RSS阅读器的例子演示了这一功能。 首先创建一个grails应用:grails create-app feedreader cd feedreader grails install-plugin quartzgrails create-domain-class Post ... 对于JSF的应用,你可能会在HTTP的头信息中看到这样的字样:Server : Apache/2.0.61 (Unix) X-Powered-By : JSF/1.2让用户知道这些消息没有太大意义,而且可能造成安全漏洞。 需要屏蔽的话可以参考以下步骤:隐藏Server信息:在apache里控制的,在httpd.conf里加入一行 ServerTokens Prod... 关于Java Collection Framework,你可能已经知道如下一些事实Vector是线程安全的,ArrayList不是 ArrayList的读操作比LinkedList快,LinkedList的append操作比ArrayList快 Set中不可能有两个相等的元素,也就是说,如果e1和e2都在同一个Set中,那么不可能有e1.equals(e2) H...