A frame is a component container that displays its contents in a top-level window with a title bar and buttons to resize, iconify, maximize, and close the frame.

Unlike most Swing containers, adding a component to a frame is not done with the JFrame.add() method. This is because the frame holds several panes and it is necessary to specify a particular pane to which to add the component. The pane that holds child components is called the content pane. This example adds a text area to the content pane of a frame.

See also e559 创建窗口.

    // Create the frame
String title = "Frame Title";
JFrame frame = new JFrame(title); // Create a component to add to the frame
JComponent comp = new JTextArea(); // Add the component to the frame's content pane;
// by default, the content pane has a border layout
frame.getContentPane().add(comp, BorderLayout.CENTER); // Show the frame
int width = 300;
int height = 300;
frame.setSize(width, height);
frame.setVisible(true);
Related Examples

e559. 创建窗口的更多相关文章

  1. Duilib创建窗口双击标题栏禁止窗口最大化

    使用Duilib创建窗口并禁止窗口最大化 第一步: XXXFrame.Create(NULL, _T("XXXFrame"), UI_WNDSTYLE_EX_FRAME, WS_E ...

  2. QT源码解析(一) QT创建窗口程序、消息循环和WinMain函数

    QT源码解析(一) QT创建窗口程序.消息循环和WinMain函数 分类: QT2009-10-28 13:33 17695人阅读 评论(13) 收藏 举报 qtapplicationwindowse ...

  3. MFC程序的启动过程——先全局对象theApp(第一入口),后WinMain(真正入口),会引爆pApp->InitInstance从而创建窗口(程序员入口)

    原文出自:http://blog.csdn.net/yuvmen/article/details/5877271 了解MFC程序的启动过程,对于初学者来讲,了学习MFC很有帮助:对于不常用VC的人来说 ...

  4. MFC应用程序创建窗口的过程 good

    MFC应用程序中处理消息的顺序 1.AfxWndProc()      该函数负责接收消息,找到消息所属的CWnd对象,然后调用AfxCallWndProc 2.AfxCallWndProc()  该 ...

  5. windows程序设计读书笔记1——创建窗口

    第一个win32程序,简单的创建窗口: #include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ...

  6. 【C语言探索之旅】 第三部分第二课:SDL开发游戏之创建窗口和画布

    内容简介 1.第三部分第二课: SDL开发游戏之创建窗口和画布 2.第三部分第三课预告: SDL开发游戏之显示图像 第三部分第二课:SDL开发游戏之创建窗口和画布 在上一课中,我们对SDL这个开源库做 ...

  7. Example003通过按钮创建窗口

    <!--实例003通过按钮创建窗口--> <head> <meta charset="UTF-8"> </head> <for ...

  8. Win32 SDK 编程开始, 创建窗口, 消息的处理, 消息循环

    Windows SDK 编程的一般步骤为: 1. 注册窗口类, 使用到的结构 WNDCLASSEX, 函数 RegisterClassEx. 2. 创建窗口, 函数 CreateWindowEx. 3 ...

  9. emwin之在中断服务程序中创建窗口的结果

    @2019-04-28 [小记] 使用emwin设计器生成的程序,将该窗口创建放在中断服务程序中出现奇怪现象,非死机但功能间歇性异常,将创建窗口程序放于普通程序中则工作正常

随机推荐

  1. .NET+MVC+Alipay的Sdk版单笔转账到支付宝账户接口

    public class AliPayController : Controller { // GET: AliPay public ActionResult Index() { return Red ...

  2. python *和**的用法

    1.使用场景 *和**用在函数参数列表中 2.*作函数参数 以列表的形式提供参数 def foo(*args): for arg in args: print(arg) foo(1, 2, 3) 运行 ...

  3. Django服务端读取excel文件并且传输到接口

    path_name = "opboss_download_" + str(int(time.time())) + ".csv" print(path_name) ...

  4. 苹果电脑快速安装双系统 Winclone镜像包 Winclone安装Win7/Win8.1/Win10镜像

    原文:https://bbs.feng.com/read-htm-tid-9940193.html by:旋律 2015年及以后的安装win8.1及win10(不支持win7) 请根据自己的机型安装合 ...

  5. axublog 1.05代码审计

    00x1 安装漏洞 install/cmsconfig.php function step4(){ $root=$_POST["root"]; $dbuser=$_POST[&qu ...

  6. [转]BigDecimal不整除异常

    通过BigDecimal的divide方法进行除法时当不整除,出现无限循环小数时,就会抛异常的 异   常 :java.lang.ArithmeticException: Non-terminatin ...

  7. Java输出字符串格式问题 .UnknownFormatConversionException

    今天遇到一个问题,使用JSoup挖掘出的数据一直出错 Exception in thread "main" java.util.UnknownFormatConversionExc ...

  8. Oracle锁表查询和解锁方法

    数据库操作语句的分类 DDL:数据库模式定义语言,关键字:create DML:数据操纵语言,关键字:Insert.delete.update DCL:数据库控制语言 ,关键字:grant.remov ...

  9. git 管理 Linux 文件系统

    git 管理 Linux 文件系统有两个问题,第一个是 Linux 根文件系统的 root 权限问题,第二个就是git不上传空文件问题. 一. root权限问题的话就得在 root 用户下git , ...

  10. Linux查看cpu个数

    [root@lidongbo~]# cat /proc/cpuinfo processor       : 0 vendor_id       : GenuineIntel cpu family    ...