Pages

ads ads ads ads ads ads ads ads

Jumat, 24 Desember 2010

PROGRAM TABBED PANEL PADA JAVA




import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TabbedPaneDemo extends JFrame {
        private JTabbedPane tabPane;
        private JLabel label1, label2, label3;
        private JPanel panel1, panel2, panel3;

        public TabbedPaneDemo () {
               super ("Tabbed Pane Demo");

               tabPane = new JTabbedPane ();
               label1 = new JLabel ("Panel pertama", SwingConstants.CENTER);
               panel1 = new JPanel ();
               panel1.add(label1);
               tabPane.addTab ("Tab Pertama", null, panel1, "Panel Pertama");               

               label2 = new JLabel ("Panel kedua", SwingConstants.CENTER);
               panel2 = new JPanel ();
               panel2.setBackground(Color.ORANGE);
               panel2.add(label2);
               Icon icon = new ImageIcon ("images/new.gif");
               tabPane.addTab ("Tab Kedua", icon, panel2, "Panel Kedua");          

               label3 = new JLabel ("Panel ketiga", SwingConstants.CENTER);
               panel3 = new JPanel ();
               panel3.setBackground(Color.YELLOW);
               panel3.setLayout(new BorderLayout());
               panel3.add(new JButton ("North"), BorderLayout.NORTH);
               panel3.add(new JButton ("West"),  BorderLayout.WEST);
               panel3.add(new JButton ("East"),  BorderLayout.EAST);
               panel3.add(new JButton ("South"), BorderLayout.SOUTH);
               panel3.add(label3);
               tabPane.addTab ("Tab Ketiga", null, panel3, "Panel Ketiga");

               getContentPane().add(tabPane);       

               setSize (400,300);
               setLocationRelativeTo (null);
               setVisible (true);
        }      

        public static void main (String args[]) {
               TabbedPaneDemo test = new TabbedPaneDemo ();
               test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
}

sumber:contoh program.info

Tidak ada komentar:

Posting Komentar

baca blog biasakan tinggalkan komentar, karena saya perlu kritik dan saran dari anda guna kemajuan blog saya ini..

ads Tukar Link
>>>>TERIMA KASIH ANDA TELAH BERKUNJUNG DI BLOG SUGIK>>>>>
 
Copyright (c) sugik boy - dunia info di dukung oleh kumpulan tugas kuliah - di seponsori oleh kumpullbloger