e571. Creating a Container

A container holds one or more child components. A container has a layout that determines how the child components are arranged within the container. This example creates a frame with a text area in the center and a row of buttons at the bottom. The buttons are placed in a container.
    // Create a container with a flow layout, which arranges its children horizontally
    Panel panel = new Panel();
    
    // A container can also be created with a specific layout
    panel = new Panel(new FlowLayout(FlowLayout.RIGHT));
    
    // Add several buttons to the container
    panel.add(new Button("A"));
    panel.add(new Button("B"));
    panel.add(new Button("C"));
    
    // Create frame with a text area in the center
    Frame frame = new Frame();
    Component comp = new TextArea();
    frame.add(comp, BorderLayout.CENTER);
    
    // Add the container to the bottom of the frame
    frame.add(panel, BorderLayout.SOUTH);
    
    // Show the frame
    int width = 300;
    int height = 300;
    frame.setSize(width, height);
    frame.setVisible(true);

 

Related Examples
Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.tez.TezTask. Application application_1744630663935_9695576 failed 2 times due to AM Container for appattempt_1744630663935_9695576_000002 exited with exitCode: 255 Failing this attempt.Diagnostics: [2025-11-19 16:01:26.790]Exception from container-launch. Container id: container_e37_1744630663935_9695576_02_000001 Exit code: 255 Exception message: Launch container failed Shell error output: Nonzero exit code=255, error message='Unknown error code' Shell output: main : command provided 1 main : run as user is simba main : requested yarn user is simba Getting exit code file... Creating script paths... Writing pid file... Writing to tmp file /opt2/hadoop/yarn/local/nmPrivate/application_1744630663935_9695576/container_e37_1744630663935_9695576_02_000001/container_e37_1744630663935_9695576_02_000001.pid.tmp Writing to cgroup task files... Creating local dirs... Launching container... [2025-11-19 16:01:26.792]Container exited with a non-zero exit code 255. Error file: prelaunch.err. Last 4096 bytes of prelaunch.err : Last 4096 bytes of stderr : Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... [2025-11-19 16:01:26.792]Container exited with a non-zero exit code 255. Error file: prelaunch.err. Last 4096 bytes of prelaunch.err : Last 4096 bytes of stderr : Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... For more detailed output, check the application tracking page: http://dmp-datakun-master01:8188/applicationhistory/app/application_1744630663935_9695576 Then click on links to logs of each attempt. . Failing the application.
11-20
Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.tez.TezTask. Application application_1744630663935_9685292 failed 2 times due to AM Container for appattempt_1744630663935_9685292_000002 exited with exitCode: 255 Failing this attempt.Diagnostics: [2025-11-19 10:37:41.735]Exception from container-launch. Container id: container_e37_1744630663935_9685292_02_000001 Exit code: 255 Exception message: Launch container failed Shell error output: Nonzero exit code=255, error message='Unknown error code' Shell output: main : command provided 1 main : run as user is simba main : requested yarn user is simba Getting exit code file... Creating script paths... Writing pid file... Writing to tmp file /opt2/hadoop/yarn/local/nmPrivate/application_1744630663935_9685292/container_e37_1744630663935_9685292_02_000001/container_e37_1744630663935_9685292_02_000001.pid.tmp Writing to cgroup task files... Creating local dirs... Launching container... [2025-11-19 10:37:41.736]Container exited with a non-zero exit code 255. Error file: prelaunch.err. Last 4096 bytes of prelaunch.err : Last 4096 bytes of stderr : Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... [2025-11-19 10:37:41.736]Container exited with a non-zero exit code 255. Error file: prelaunch.err. Last 4096 bytes of prelaunch.err : Last 4096 bytes of stderr : Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... Halting due to Out Of Memory Error... For more detailed output, check the application tracking page: http://dmp-datakun-master01:8188/applicationhistory/app/application_1744630663935_9685292 Then click on links to logs of each attempt. . Failing the application.
11-20
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值