做的一个项目,要求大小很准确,必须要用精确定位,但是这就不能拖动窗口大小了。我想加个ComponentListener监听,如果frame大小发生变化,我传几个关于目前画面大小的参数进去,这样只要frame 能重新刷新就可以的
程序片段:(问:componentResized里面应该怎么写
public static void main(String[] args) {
ShiZhanGuanZhan app = new ShiZhanGuanZhan();
app.setLocation(0, 0);
app.setSize(790, 600);
app.setVisible(true);
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
app.addComponentListener(new ComponentListener(){ public void componentHidden(ComponentEvent e) {}
public void componentMoved(ComponentEvent e) {}
public void componentShown(ComponentEvent e) {}
public void componentResized(ComponentEvent e) {
//Todo:
}
});
}
程序片段:(问:componentResized里面应该怎么写
public static void main(String[] args) {
ShiZhanGuanZhan app = new ShiZhanGuanZhan();
app.setLocation(0, 0);
app.setSize(790, 600);
app.setVisible(true);
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
app.addComponentListener(new ComponentListener(){ public void componentHidden(ComponentEvent e) {}
public void componentMoved(ComponentEvent e) {}
public void componentShown(ComponentEvent e) {}
public void componentResized(ComponentEvent e) {
//Todo:
}
});
}
解决方案 »
- 求助(Java画板上不断圆时出现"AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: )
- SSLSocket如何在握手前发送不加密的数据包
- 创建ObjectOutputStream和ObjectInputStream对象顺序
- 很基础的东东,在下不懂
- 转码问题 包含Unicode 转 UTF-8 请进
- 一个提取字符串的问题!!!!!!
- 散分,順便問幾個關於CVS的小問題。Up,大家一起來,WooWoo :)
- 请问wdl文件用什么阅读器阅读啊,哪里有下载?
- 请教一个程序题。
- jdbc for oracle ----oci方式
- 英语障碍
- 菜鸟提问!!
如果可以改变, 那么上面的组件相应的响应方式是如何的?
比如组件放大缩小, 组件不变但居中, 另外有没有Table, Scroll等等组件都会影响布局的设计.
这个问题太简单了, 不能回答啊
那个控制面板大小固定,永远在右上角;整个JFrame大小不固定,向右拖时,围棋界面面板调整;向下拉动时,围棋和聊天面板向下扩充整个JFrame.各位,请提宝贵意见。