Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package shalYIT;
- import javax.swing.*;
- import java.awt.*;
- public class JPaneDemo2 {
- JTabbedPane jtp;
- JTextField tf;
- JPanel jp;
- JFrame jf;
- JPaneDemo2(){
- jtp = new JTabbedPane();
- jtp.add("SIS", new JSisPanel());
- jtp.add("RADIO", new JColorPanel());
- jp = new JPanel();
- jp.setLayout(new FlowLayout());
- jp.add(jtp);
- jf = new JFrame();
- jf.getContentPane().add(jp);
- jf.setSize(400, 500);
- jf.setVisible(true);
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- new JPaneDemo2();
- }
- }
- class JSisPanel extends JPanel{
- JComboBox<String> jc;
- JSisPanel(){
- jc = new JComboBox<String>();
- jc.addItem("abc");
- jc.addItem("def");
- jc.addItem("ghi");
- jc.addItem("jkl");
- jc.addItem("mno");
- add(jc);
- }
- }
- class JColorPanel extends JPanel{
- JRadioButton r1, r2, r3, r4;
- ButtonGroup bg;
- JColorPanel(){
- r1 = new JRadioButton("A");
- r2 = new JRadioButton("B");
- r3 = new JRadioButton("C");
- r4 = new JRadioButton("D");
- bg = new ButtonGroup();
- bg.add(r1);
- bg.add(r2);
- bg.add(r3);
- bg.add(r4);
- add(r1);add(r2);add(r3);add(r4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement