1) 给panel加背景色你就能看见了2。请问怎么精确定位JButton在JPanel中的位置? jpanel.setLayout(null);
jbutton.setBounds(x,y,w,h);
jpanel.add(jbutton);3 WindowAdapter类的作用是什么??? 监听窗体事件//GJApp类的作用??? 继承 WindowAdapter
jbutton.setBounds(x,y,w,h);
jpanel.add(jbutton);3 WindowAdapter类的作用是什么??? 监听窗体事件//GJApp类的作用??? 继承 WindowAdapter
jPanel1.setBorder(BorderFactory.createRaisedBevelBorder());
2.
import com.borland.jbcl.layout.*;
...
jPanel1.setLayout(new XYLayout());
jPanel1.add(jbutton, new XYConstraints(94, 16, 138, -1));
3.
Object类作为JTable每个格子存储的对象
GJApp加载应用程序,打开JFrame对象,设置窗口位置
WindowAdapter可以接收窗口事件:
Method Summary
void windowActivated(WindowEvent e)
Invoked when a window is activated.
void windowClosed(WindowEvent e)
Invoked when a window has been closed.
void windowClosing(WindowEvent e)
Invoked when a window is in the process of being closed.
void windowDeactivated(WindowEvent e)
Invoked when a window is de-activated.
void windowDeiconified(WindowEvent e)
Invoked when a window is de-iconified.
void windowGainedFocus(WindowEvent e)
Invoked when the Window is set to be the focused Window, which means that the Window, or one of its subcomponents, will receive keyboard events.
void windowIconified(WindowEvent e)
Invoked when a window is iconified.
void windowLostFocus(WindowEvent e)
Invoked when the Window is no longer the focused Window, which means that keyboard events will no longer be delivered to the Window or any of its subcomponents.
void windowOpened(WindowEvent e)
Invoked when a window has been opened.
void windowStateChanged(WindowEvent e)
Invoked when a window state is changed. 4。f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);//这行是什么意思setDefaultCloseOperation
public void setDefaultCloseOperation(int operation)
Sets the operation that will happen by default when the user initiates a "close" on this frame. You must specify one of the following choices: DO_NOTHING_ON_CLOSE (defined in WindowConstants): Don't do anything; require the program to handle the operation in the windowClosing method of a registered WindowListener object.
HIDE_ON_CLOSE (defined in WindowConstants): Automatically hide the frame after invoking any registered WindowListener objects.
DISPOSE_ON_CLOSE (defined in WindowConstants): Automatically hide and dispose the frame after invoking any registered WindowListener objects.
EXIT_ON_CLOSE (defined in JFrame): Exit the application using the System exit method. Use this only in applications.
The value is set to HIDE_ON_CLOSE by default. 5。ResourceBundle可以动态绑定对象
按照字符串判别所需对象
Object getResource(String key)
JPanel panel = new JPanel();
panel.setLayout(null);
JButton button = new JButton();
button.setBounds(100,100,100,30);
panel.add(button);
setbound()可以用来让你精确定位button,前面必须使panel的布局管理器为空