package hj.exam.fram;
import javax.swing.*;
public class test extends JFrame {
private JButton button;
private JLabel label;
public test() {
JPanel pane = new JPanel();
button = new JButton("<html>第一行<br>第二行</html>");
label = new JLabel("<html>第1行<br>第2行</html>");
pane.add(button);
pane.add(label);
setContentPane(pane);
setLocationRelativeTo(null);//窗體居中
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// 調整此窗口的大小,以適合其子組件的首選大小和布局。
// 如果該窗口和/或其所有者還不可顯示,則在計算首選
// 大小之前都將變得可顯示。在計算首選大小之后,將會驗證該窗口。
pack();
setVisible(true);
}
public static void main(String args[]) {
test t = new test();
}
}