社区
JavaScript
帖子详情
getContentPane问题
jin_zh
2014-07-18 12:56:59
提示错误:The method getContentPane() is undefined for the type
...全文
456
4
打赏
收藏
getContentPane问题
提示错误:The method getContentPane() is undefined for the type
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
jin_zh
2014-07-21
打赏
举报
回复
我在FrameTest中继承了一下JFrame就解决问题了
KK3K2005
2014-07-18
打赏
举报
回复
this. getContentPane 把 不然怎么编译怎么找到
KK3K2005
2014-07-18
打赏
举报
回复
好吧 你看的什么书啊 getContentPane 这个东西是谁的呢?呵呵 你看你代码 你那个对象有 getContentPane了 是jframe? class FrameTest { JFrame frameObj; public FrameTest() { frameObj=new JFrame("window"); frameObj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frameObj.setVisible(true); frameObj.setSize(600,400); } public ??? getContentPane(){ //这里的??? 你自己写一下返回类型 return this.frameObj.getContentPane(); } } 另外1合理情况应该FrameTest 继承JFrame 另外JFrame是不是可以直接 add 控件了 你要看看api
jin_zh
2014-07-18
打赏
举报
回复
试过了,不行,他是继承类,我把整个程序都贴出来吧 package test; import javax.swing.*; import java.awt.*; class FrameTest { JFrame frameObj; public FrameTest() { frameObj=new JFrame("window"); frameObj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frameObj.setVisible(true); frameObj.setSize(600,400); } } class ButtonTest extends FrameTest { JButton buttonObj1; JButton buttonObj2; JButton buttonObj3; JButton buttonObj4; public ButtonTest() { buttonObj1=new JButton("播放"); buttonObj2=new JButton("上一首"); buttonObj3=new JButton("下一首"); buttonObj4=new JButton("暂停"); getContentPane().add("West",buttonObj1); getContentPane().add(buttonObj2); getContentPane().add(buttonObj3); getContentPane().add(buttonObj4); } } class FlowLayoutTest extends ButtonTest { FlowLayoutTest layoutObj; public FlowLayoutTest() { layoutObj=new FlowLayoutTest(); getContentPane().setLayout(layoutObj); } } public class J1_Frame { public static void main(String[] args) { new FlowLayoutTest(); } }
第六个范例——布局之
Conte
ntP
ane
博文链接:https://lwj9922.iteye.com/blog/146442
Java课程设计员工管理系统, 包括员工工资,员工职位等
//get
Conte
ntP
ane
().setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); //get
Conte
ntP
ane
().setLayout(new BorderLayout(0, 0)); //添加菜单、菜单项 JMenuBar menuBar = new JMenuBar(); setJMenuBar...
订单管理系统 课程设计{少数据源} 下完整版的吧
get
Conte
ntP
ane
().setLayout(null);//设置布局 //为空间放置具体位置 jLabel1.setText("订单号"); get
Conte
ntP
ane
().add(jLabel1); jLabel1.setBounds(30, 30, 70, 20); jLabel2.setText("商品"); ...
视频的分割格式转换视频的分割
this.get
Conte
ntP
ane
().setLayout(null); jTextField1.setText("我们的口号: 只有想不到,没有做不到"); // 加入文本内容 jTextField1.setEditable(false); jTextField1.setBounds(new Rectangle(1, 29, 239,...
二十Java图形化界面设计中间容器Jp
ane
l.pdf
可以使用 get
Conte
ntP
ane
() 方法获得 JFrame 的内容面板,然后将组件添加到该面板中。例如: ```java frame.get
Conte
ntP
ane
().add(childComponent); ``` 方式二:使用 set
Conte
ntP
ane
() 方法 可以使用 ...
JavaScript
87,995
社区成员
224,693
社区内容
发帖
与我相关
我的任务
JavaScript
Web 开发 JavaScript
复制链接
扫一扫
分享
社区描述
Web 开发 JavaScript
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章