JTabbedPane
private Container con;
private JLabel lb = new JLabel("이것은 탭 팬입니다.");
private JButton bt = new JButton("확인");
private JButton bt1 = new JButton("취소");
private JPanel jp = new JPanel(new FlowLayout(FlowLayout.RIGHT));
private JPanel jp1 = new JPanel(new BorderLayout());
private JTabbedPane jtp = new JTabbedPane(JTabbedPane.LEFT); //JTapbbedPane.LEFT 등으로 위치지정 가능
//두번째 매개변수로, 정책을 설정 가능하다.
//JTabbedPane.SCROLL_TAB_LAYOUT < 폼이 작으면, 스크롤이 생긴다.
//또다른 필드로는 WRAP_TAB_LAYOUT 이 있다.
private JButton bt2 = new JButton("탭");
private JButton bt3 = new JButton("탭2");
private JButton bt4 = new JButton("탭3");
private JButton bt5 = new JButton("탭4");
private JButton bt6 = new JButton("탭5");
public Exam19_sub(){
super("Exam19");
this.init();
this.start();
this.setSize(300,300);
this.setVisible(true);
}
public void init(){
con = this.getContentPane();
con.setLayout(new BorderLayout(5,5));
con.add("North",lb);
jp.add(bt);
jp.add(bt1);
con.add("South",jp);
jtp.add(bt2);
jtp.add(bt3);
jtp.add(bt4,1); // 탭의 순서를 정해서 추가할 수 있다.
jtp.add("Title",bt5); // Title 이란, 탭 타이틀을 지정해 줄수있다.
jtp.addTab("제목",new ImageIcon("aaa.jpg"),bt6,"여긴 툴팁자리");
// 제목, 아이콘 삽입, 툴팁 등을 삽입 할 수 있다.
jp1.add(jtp);
jtp.setBackgroundAt(2,Color.red); // 탭의 배경색 지정
jtp.setDisplayedMnemonicIndexAt(3,0); // 탭의 제목중 첫번째 글자에 밑줄 처리
jtp.setEnabledAt(2,false); // 탭의 활성화 여부
jtp.setForegroundAt(4, Color.BLUE); // 탭의 글자색 지정
jtp.setMnemonicAt(3, KeyEvent.VK_K); // 탭에 alt + @ 단축키 지정
con.add("Center",jp1);
}
기타 등등 !