Mã:
package gui;
import java.awt.BorderLayout;
public class testtab extends JFrame {
private JPanel contentPane;
private JButton btnTab1;
private JButton btnTab2;
private JTabbedPane tabbedPane;
private JPanel panel_1;
private JPanel panel_2;
/**
* Launch the application.
*/
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable e) {
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
testtab frame = new testtab();
frame.setVisible(true);
//frame.doShow();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public testtab() {
createGUI();
createEvent();
}
private void createGUI(){
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 529, 367);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setBounds(124, 0, 389, 328);
contentPane.add(tabbedPane);
panel_1 = new JPanel();
//tabbedPane.addTab("New tab", null, panel_1, null);
panel_2 = new JPanel();
//tabbedPane.addTab("New tab", null, panel_2, null);
JPanel panel = new JPanel();
panel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
panel.setBounds(0, 0, 121, 328);
contentPane.add(panel);
panel.setLayout(null);
btnTab1 = new JButton("bac si");
btnTab1.setBounds(0, 0, 121, 32);
panel.add(btnTab1);
btnTab2 = new JButton("benh nhan");
btnTab2.setBounds(0, 31, 121, 32);
panel.add(btnTab2);
}
private void createEvent(){
btnTab1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
tabbedPane.addTab("bac si", null, panel_1, null);
tabbedPane.setSelectedIndex(0);
}
});
btnTab2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
tabbedPane.addTab("benh nhan", null, panel_2, null);
tabbedPane.setSelectedIndex(1);
}
});
}
}
Pallet nhựa Long An đã trở thành một trong những lựa chọn phổ biến cho nhu cầu vận chuyển và lưu trữ hàng hóa trong nhiều ngành công nghiệp. Với đặc tính nhẹ nhàng, chắc chắn và dễ vận chuyển, các...
Thanh lý pallet nhựa Long An giá rẻ