Disordering of Tabs in TabbedPane

Here i have some n(say 10)number of tabs in a tabbed pane.
in JDK1.3.1 every tab were in one row only.
But in JDK1.4 these tab are coming in two rows(say 5 + 5).
I need all tabs in one row only.
What is the solution for the same using JDK1.4 ?????

tabbedPane.setLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT)

Similar Messages

  • How to change tabs in tabbedPane using buttons

    I have designed 2 tabs using tabbedPane.
    In the first tab I have a button. When I click on the button, I want it to automatically to switch to the second tab without having to click on the tab itself.

    Thank You!!
    That worked brilliantly :)

  • Thumbnail view of tabs in tabbedpane

    Hi all,
    I am doing a desktop app . In my app i am using JTabbedPane . In order to view the contents of all tabs in one shot,i need to bring the JPanel in each tab into a single frame,that contains a scrollbar.i.e,something like a thumbnail view of all the tabs.Is it possible to do so? Since i have several components like button, textbox,images,etc in each tab,and have set the layout property of the panel to null,i cannot reduce the size of the panel to thumbnail size.I have set layout property of jpanel in each tab to null,because i have enabled dragging of objects like buttons,textarea,images,etc.Can anyone help me to sort out this problem.
    Thanks in advance
    Ravisenan

    Ok - you only gave iPhoto '11 - I assumed up to date
    Glad you found it anyway
    You are welcome
    LN

  • Problem with file and tabbedpanes

    Hi
    i am reading a file on my program .in that file i am written 4lines .but i want that from that file 2 lines on one tab and another two lines on another tab using tabbedpanes
    Edited by: nirmala on Dec 26, 2007 7:26 AM

    i am written some code see this public void actionPerformed(ActionEvent e) {
    // Handle open button action.
    if (e.getSource() == browse) {
    int returnVal = fc.showOpenDialog(NnsClient.this);
    if (returnVal == JFileChooser.APPROVE_OPTION ) {
    File file = fc.getSelectedFile();
    // This is where a real application would open the file.
    log.setText(file.getParent());
    } else {
    log.setText("Open command cancelled by user." + newline);
    log.setCaretPosition(log.getDocument().getLength());
    // Handle update button action.
    } else if (e.getSource() == update) {
    File file = fc.getSelectedFile();
    String val = file.getAbsolutePath();
    File file1 = new File (val);
    try
    RandomAccessFile ra = new RandomAccessFile(file1,"r");
    //System.out.println(ra);
    long last = ra.length();
    System.out.println(last);
    FileReader fis = new FileReader (file1);
    //LineNumberReader lr = new LineNumberReader(fis);
    //System.out.println(lr);
    //lr.skip(last);
    //int countRec = lr.getLineNumber()-1;
    //System.out.println(countRec);
    BufferedReader bis = new BufferedReader(fis);
    StringBuffer sb = new StringBuffer();
    String line = null;
    while((line= bis.readLine())!=null)
         //int i = line.length();
         System.out.print(line.toString());
         //System.out.println(line);
         //sb.append(line);
    System.out.println(sb.append(line));
         sb.append("\n");
    tf.setText(sb.toString());
    ra.close();
    fis.close();
    //dis.close();
    bis.close();
    catch(FileNotFoundException e2)
    e2.printStackTrace();
    catch(IOException e1)
    e1.printStackTrace();
    }this is for action performed in this code only i want to develop that when i click on update i wanto get the file data on different tabs
    JTabbedPane tp = new JTabbedPane();
    JPanel pa = new JPanel();
    pa.add(scroll);
    //pa.add(ns.ta.setText(sb.toString()));
    JPanel pb = new JPanel();
    pb.add(tf);
    t.setEditable(false);
    //setPrefferedSize(new Dimension(30,40));
    //tf.setText(sb.toString());
    tp.addTab("tab1", pb);
    tp.addTab("tab2",pa);
    content.add(tp,BorderLayout.SOUTH);this code is for tabbedpanes on my program

  • How can i place button on top right hand corner of the tabbed pane

    Hi all,
    i want to place button on top right hand corner of the tabbed pane, just run the code below, i have add button(it going to insert tab into tabbedpane), i want to place that tab into top right hand corner of the tabbedpane (not inside the tab itself). if i set tab policy setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT), it will give two button at right hand corner along with those buttons i want to and one more add button.
    please suggest so that i can move forward.
    Thanks in advance
    import java.awt.Dimension;
    import java.util.HashMap;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    * @author  Dayananda.BV
    public class TabpaneDemo extends javax.swing.JFrame {
        /** Creates new form TabpaneDemo */
        HashMap<Integer, tabpanel> panelMap = new HashMap<Integer, tabpanel>();
        public TabpaneDemo() {
            initComponents();
            createFloorPlan();
            getContentPane().setPreferredSize(new Dimension(400,400));
            jTabbedPane1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            jTabbedPane1 = new javax.swing.JTabbedPane();
            add_tab_button = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            add_tab_button.setText("+");
            add_tab_button.setMargin(new java.awt.Insets(0, 0, 0, 0));
            add_tab_button.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    add_tab_buttonActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(308, Short.MAX_VALUE)
                    .addComponent(add_tab_button, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(67, 67, 67))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(add_tab_button)
                    .addGap(8, 8, 8)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 292, Short.MAX_VALUE))
            pack();
        }// </editor-fold>                       
        private void createFloorPlan(){
            tabpanel floorplan_Panel = new tabpanel(panelMap.size()+1);
            panelMap.put(floorplan_Panel.getTabIndex(), floorplan_Panel);
            jTabbedPane1.add(floorplan_Panel, floorplan_Panel.getTabName());
            jTabbedPane1.setSelectedIndex(jTabbedPane1.getTabCount()-1);
        private void add_tab_buttonActionPerformed(java.awt.event.ActionEvent evt) {                                              
            createFloorPlan();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TabpaneDemo().setVisible(true);
        // Variables declaration - do not modify                    
        private javax.swing.JButton add_tab_button;
        private javax.swing.JTabbedPane jTabbedPane1;
        // End of variables declaration                  
        class tabpanel extends JPanel{
            private int tabIndex = 0;
            private String tabName ;
            public tabpanel(int tabIndex) {
                this.tabIndex = tabIndex;
                if(tabIndex >= 10) {
                    tabName = "Floor Map"+tabIndex;
                } else{
                    tabName = "Floor Map"+tabIndex+"  ";
            public int getTabIndex(){
                return tabIndex;
            public String getTabName(){
                return tabName;
    }Thanks
    Dayananda B V

    This part of tabbed pane is not customizable as it lies in the ComponentUI(TabbedpaneUI) portion of the tabbedpane.
    But I can point out the place u can change to bring the desired feature into effect.
    U can find an Inner class called ScrollableTabSupport
    Look for the methods createButtons where u can create extra buttons and add to the tabbed pane.
    The Inner class also implements actionListener where u can implement the action for the button u added.
    By this method U have to use your own extended TabbedPaneUI which u cant escape from.
    Hope this will help u.

  • TabbedPane L&F changed

    Hi, I have a GUI with TabbedPane the tabs of which were displayed in gray color with setOpaque property set to true. This is set for all UI container components to get a gray background overall. However, without any change to code (could be the upgrade to Java 6 that we did recently ?) , the tabs of TabbedPane have started showing a windows L&F when selected. they still show the gray when not selected. Can anyone help.

    To get better help sooner, post a SSCCE that clearly demonstrates your problem.
    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    db

  • Alignment of the components inside tab in JTabbedPane

    I want to align the components inside the tab in tabbedpane.
    I have three tabs in the tabbed pane For each tab I added the components on the panel and added the panel as a tab.
    But as the number of components on each tab are not same the components inside the tab doesn't get aligned properly.
    The components gets aligned in the center and I want to align them at top. How can I do that?
    Please help..

    How does
    the number of components on each tab are not samerelates to
    the components inside the tab doesn't get aligned properly. The components gets aligned in the center and I want to align them at top??

  • JTabbedPane, switch of auto resizing of the tab header possible?

    Hi,
    Is it possible to prevent the tab header from auto resizing?
    In this code the tab "Page 1" fills the whole row at start up, but I would like to prevent it from taking more space than needed.
    import java.awt.*;
    import javax.swing.*;
    class TabbedPaneExample
            extends     JFrame
        private        JTabbedPane tabbedPane;
        private        JPanel        panel1;
        private        JPanel        panel2;
        private        JPanel        panel3;
        public TabbedPaneExample()
            // NOTE: to reduce the amount of code in this example, it uses
            // panels with a NULL layout.  This is NOT suitable for
            // production code since it may not display correctly for
            // a look-and-feel.
            setTitle( "Tabbed Pane Application" );
            setSize( 140, 200 );
            setBackground( Color.gray );
            JPanel topPanel = new JPanel();
            topPanel.setLayout( new BorderLayout() );
            getContentPane().add( topPanel );
            // Create the tab pages
            createPage1();
            createPage2();
            createPage3();
            // Create a tabbed pane
            tabbedPane = new JTabbedPane();
            tabbedPane.addTab( "Page 1", panel1 );
            tabbedPane.addTab( "Page 2", panel2 );
            tabbedPane.addTab( "Page 3", panel3 );
            topPanel.add( tabbedPane, BorderLayout.CENTER );
        public void createPage1()
            panel1 = new JPanel();
            panel1.setLayout( null );
        public void createPage2()
            panel2 = new JPanel();
            panel2.setLayout( new BorderLayout() );
        public void createPage3()
            panel3 = new JPanel();
            panel3.setLayout( new GridLayout( 3, 2 ) );
        // Main method to get things started
        public static void main( String[] args )
            // Create an instance of the test application
            TabbedPaneExample mainFrame    = new TabbedPaneExample();
            mainFrame.setVisible( true );
    }Edited by: user6102378 on 2010-okt-07 06:51

    Unfortunately, the answer seems to be "no" - looks like the exact behaviour is even different across different LAFs. Nothing short of re-writing the layout code in the xxTabbedPaneUI will help.
    Just curious: how comes that we have so many tabbedPane related questions recently?
    Cheers
    Jeanette

  • How can control tab(lenght, width)  size  in JTabbedPane plz ??

    hi,
    i want to put icon t in tab of tabbedpane .. but that tab size is larger than that icon size .. i want that size of tab should exact size of icon how can i do this plz

    Never tried it but you may be able to change it for your entire application by using:
    UIManager.put("TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0,6);
    Or you might be able to extend MetalTabbedPaneUI and override getTabAreaInsets(...) if you only need this for a single tabbed pane.

  • Tabbed pane and panel

    hi everybody!
    how can insert several panel into a tabbed pane ???
    thanks

    hi,
    i mean into a tab of tabbedpane!!
    haleh

  • Please help me in creating a form using Swing.

    (I m sorry if I've posted similar post in some other thread.I am new to this forum..:))
    There are several problems which I am facing while coding a form.
    1. In the form I have one JComboBox
    of Country and other of State. Now I want it in such a way that when
    I select a country from the Country JComboBox ,the corresponding states
    automatically appears in the State JComboBox.
    2. I need to add picture frame in the 6th tab so that the picture shows up when clicked browse and open.
    3.I need to add tables in 1st and 5th tab which shows up the details through database when added through several textboxes and combo boxes.
    so please help me!
    Here's my code
    ==========================================================
    import javax.swing.JFrame;
    import javax.swing.JTabbedPane;
    import javax.swing.JPanel;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JCheckBox;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import javax.swing.Box;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Design extends JFrame
    public Design()
    super("Tenant Form");
    setLayout(new BorderLayout());
    JTabbedPane tabbedPane=new JTabbedPane(); //creating tabbed buttons
    //<--------coding for first tab--------->
    JPanel panel1=new JPanel();
    tabbedPane.addTab("Detail of Landlord",null,panel1,"first tab"); //here panel1 is created for tab1
    GridBagConstraints gbc=new GridBagConstraints();
    gbc.insets=new Insets(2,2,2,2);
    gbc.anchor=GridBagConstraints.WEST;
    JPanel jp11 = new JPanel(); //1st panel in 1st tab for top labels and buttons
    jp11.setLayout(new GridBagLayout());
    JLabel l241 = new JLabel("Name Of LandLord");
    jp11.add(l241,gbc);
    JComboBox jc01=new JComboBox();
    jc01.addItem("Select");
    jc01.addItem("Mr.");
    jc01.addItem("Mrs.");
    gbc.gridx=1;
    jp11.add(jc01,gbc);
    JTextField f01=new JTextField(10);
    gbc.gridx=2;
    jp11.add(f01,gbc);
    JLabel l251 = new JLabel("Sex");
    gbc.gridx=5;
    gbc.insets=new Insets(2,20,2,2);
    jp11.add(l251,gbc);
    JComboBox jc11=new JComboBox();
    jc11.addItem("Select");
    jc11.addItem("Male");
    jc11.addItem("Female");
    gbc.gridx=6;
    gbc.insets=new Insets(2,2,2,2);
    jp11.add(jc11,gbc);
    JLabel l261 = new JLabel("Age(Yrs)");
    gbc.gridx=8;
    gbc.insets=new Insets(2,20,2,2);
    jp11.add(l261,gbc);
    JTextField f11=new JTextField(3);
    gbc.gridx=9;
    gbc.insets=new Insets(2,2,2,2);
    jp11.add(f11,gbc);
    JLabel l271 = new JLabel("Occupation");
    gbc.gridx= 11;
    gbc.insets=new Insets(2,20,2,2);
    jp11.add(l271,gbc);
    JComboBox jc21=new JComboBox();
    jc21.addItem("Select");
    jc21.addItem("Engineer");
    jc21.addItem("Business");
    gbc.gridx=12;
    gbc.insets=new Insets(2,2,2,2);
    jp11.add(jc21,gbc);
    JButton ab1=new JButton("ADD");
    gbc.gridx=14;
    gbc.insets=new Insets(2,20,2,2);
    jp11.add(ab1,gbc);
    panel1.add(jp11);
    //<--coding for adding table with scroll pane #yet to be coded#-->
    JTable jtab1=new JTable();
    //start of p21 panel. 1st of two titledborder panels in tab 1
    JPanel jp21=new JPanel();
    jp21.setBorder(new TitledBorder("Address Of Landlord Property"));
    jp21.setLayout(new GridBagLayout());
    JLabel l11=new JLabel("Property/House/Building Address");
    gbc.gridx=0;
    gbc.gridy=0;
    jp21.add(l11,gbc);
    JTextArea ta11=new JTextArea(3,15);
    ta11.setLineWrap(true);
    int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
    int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
    JScrollPane scroll11=new JScrollPane(ta11,v,h);
    gbc.gridx=1;
    jp21.add(scroll11);
    jp21.add(ta11,gbc);
    JLabel l21=new JLabel("Land Mark");
    gbc.gridx=0;
    gbc.gridy=1;
    gbc.ipady=0;
    gbc.gridheight=1;
    jp21.add(l21,gbc);
    JTextField tf21=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=1;
    jp21.add(tf21,gbc);
    JLabel l31=new JLabel("Country");
    gbc.gridx=0;
    gbc.gridy=2;
    jp21.add(l31,gbc);
    JComboBox c11=new JComboBox();
    c11.addItem("India");
    c11.addItem("US");
    c11.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=2;
    jp21.add(c11,gbc);
    JLabel l41=new JLabel("State");
    gbc.gridx=0;
    gbc.gridy=3;
    jp21.add(l41,gbc);
    JComboBox c21=new JComboBox();
    c21.addItem("Rajasthan");
    c21.addItem("Delhi");
    c21.addItem("Maharastra");
    gbc.gridx=1;
    gbc.gridy=3;
    jp21.add(c21,gbc);
    JLabel l51=new JLabel("District");
    gbc.gridx=0;
    gbc.gridy=4;
    jp21.add(l51,gbc);
    JComboBox c31=new JComboBox();
    c31.addItem("jaipur");
    c31.addItem("ajmer");
    c31.addItem("alwar");
    gbc.gridx=1;
    gbc.gridy=4;
    jp21.add(c31,gbc);
    JLabel l61=new JLabel("City/Town");
    gbc.gridx=0;
    gbc.gridy=5;
    jp21.add(l61,gbc);
    JTextField tf31=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=5;
    jp21.add(tf31,gbc);
    JLabel l71=new JLabel("Police District");
    gbc.gridx=0;
    gbc.gridy=6;
    jp21.add(l71,gbc);
    JComboBox c41=new JComboBox();
    c41.addItem("Jaipur");
    c41.addItem("Alwar");
    c41.addItem("Ajmer");
    gbc.gridx=1;
    gbc.gridy=6;
    jp21.add(c41,gbc);
    JLabel l81=new JLabel("Police Circle");
    gbc.gridx=0;
    gbc.gridy=7;
    jp21.add(l81,gbc);
    JComboBox c51=new JComboBox();
    c51.addItem("India");
    c51.addItem("US");
    c51.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=7;
    jp21.add(c51,gbc);
    JLabel l91=new JLabel("Police station");
    gbc.gridx=0;
    gbc.gridy=8;
    jp21.add(l91,gbc);
    JComboBox c61=new JComboBox();
    c61.addItem("Bani Park");
    c61.addItem("Raja Park");
    c61.addItem("Malviya Nagar");
    gbc.gridx=1;
    gbc.gridy=8;
    jp21.add(c61,gbc);
    JLabel l101=new JLabel("Pin No.");
    gbc.gridx=0;
    gbc.gridy=9;
    jp21.add(l101,gbc);
    JTextField tf41=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=9;
    jp21.add(tf41,gbc);
    JLabel l111=new JLabel("Phone No.(R)");
    gbc.gridx=0;
    gbc.gridy=10;
    jp21.add(l111,gbc);
    JTextField tf51=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=10;
    jp21.add(tf51,gbc);
    //start of p31.2nd of two titledborder panels in tab 1
    JPanel jp31=new JPanel();
    jp31.setBorder(new TitledBorder("Address Of Landlord Office"));
    jp31.setLayout(new GridBagLayout());
    JLabel l121=new JLabel("Office Address");
    gbc.gridx=0;
    gbc.gridy=0;
    jp31.add(l121,gbc);
    JTextArea ta61=new JTextArea(3,15);
    ta61.setLineWrap(true);
    JScrollPane scroll2=new JScrollPane(ta61);
    gbc.gridx=1;
    gbc.gridy=0;
    jp31.add(ta61,gbc);
    JLabel l131=new JLabel("Country");
    gbc.gridx=0;
    gbc.gridy=1;
    gbc.gridheight=1;
    jp31.add(l131,gbc);
    JComboBox c12=new JComboBox();
    c12.addItem("India");
    c12.addItem("US");
    c12.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=1;
    jp31.add(c12,gbc);
    JLabel l141=new JLabel("State");
    gbc.gridx=0;
    gbc.gridy=2;
    jp31.add(l141,gbc);
    JComboBox c22=new JComboBox();
    c22.addItem("Rajasthan");
    c22.addItem("Delhi");
    c22.addItem("Maharastra");
    gbc.gridx=1;
    gbc.gridy=2;
    jp31.add(c22,gbc);
    JLabel l151=new JLabel("District");
    gbc.gridx=0;
    gbc.gridy=3;
    jp31.add(l151,gbc);
    JComboBox c32=new JComboBox();
    c32.addItem("jaipur");
    c32.addItem("ajmer");
    c32.addItem("alwar");
    gbc.gridx=1;
    gbc.gridy=3;
    jp31.add(c32,gbc);
    JLabel l161=new JLabel("City/Town");
    gbc.gridx=0;
    gbc.gridy=4;
    jp31.add(l161,gbc);
    JTextField tf71=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=4;
    jp31.add(tf71,gbc);
    JLabel l171=new JLabel("Police District");
    gbc.gridx=0;
    gbc.gridy=5;
    jp31.add(l171,gbc);
    JComboBox c42=new JComboBox();
    c42.addItem("Jaipur");
    c42.addItem("Alwar");
    c42.addItem("Ajmer");
    gbc.gridx=1;
    gbc.gridy=5;
    jp31.add(c42,gbc);
    JLabel l181=new JLabel("Police Circle");
    gbc.gridx=0;
    gbc.gridy=6;
    jp31.add(l181,gbc);
    JComboBox c52=new JComboBox();
    c52.addItem("India");
    c52.addItem("US");
    c52.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=6;
    jp31.add(c52,gbc);
    JLabel l191=new JLabel("Police station");
    gbc.gridx=0;
    gbc.gridy=7;
    jp31.add(l191,gbc);
    JComboBox c62=new JComboBox();
    c62.addItem("Bani Park");
    c62.addItem("Raja Park");
    c62.addItem("Malviya Nagar");
    gbc.gridx=1;
    gbc.gridy=7;
    jp31.add(c62,gbc);
    JLabel l201=new JLabel("Pin No.");
    gbc.gridx=0;
    gbc.gridy=8;
    jp31.add(l201,gbc);
    JTextField tf81=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=8;
    jp31.add(tf81,gbc);
    JLabel l211=new JLabel("Phone No.(O)");
    gbc.gridx=0;
    gbc.gridy=9;
    jp31.add(l211,gbc);
    JTextField tf91=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=9;
    jp31.add(tf91,gbc);
    JLabel l221=new JLabel("Phone No.(M)");
    gbc.gridx=0;
    gbc.gridy=10;
    gbc.gridheight=1;
    jp31.add(l221,gbc);
    JTextField tf101=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=10;
    jp31.add(tf101,gbc);
    JLabel l231=new JLabel("E-mail");
    gbc.gridx=0;
    gbc.gridy=11;
    gbc.gridheight=1;
    jp31.add(l231,gbc);
    JTextField tf111=new JTextField(15);
    gbc.gridx=1;
    gbc.gridy=11;
    jp31.add(tf111,gbc);
    JPanel jp41=new JPanel(); //adding above two panels p21 and p31 to p41 panel.
    jp41.setLayout(new BoxLayout(jp41,BoxLayout.X_AXIS));
    jp41.add(jp21);
    jp41.add(Box.createHorizontalStrut(50));
    jp41.add(jp31);
    panel1.add(jp41); //adding p41 panel to panel1
    //<--------coding for second tab--------->
    JPanel panel2 = new JPanel();
    tabbedPane.addTab("Id of Landlord",null,panel2,"second tab");
    panel2.setLayout(new FlowLayout());
    //adding radiobutton above TitledBorder panel
    JPanel jp02=new JPanel();
    JLabel l12=new JLabel("Identity Known");
    JRadioButton jrb12=new JRadioButton("Yes");
    JRadioButton jrb22=new JRadioButton("No");
    ButtonGroup bg12=new ButtonGroup();
    bg12.add(jrb12);
    bg12.add(jrb22);
    jp02.add(l12);
    jp02.add(jrb12);
    jp02.add(jrb22);
    //adding TitledBorder panel
    JPanel jp12=new JPanel();
    jp12.setBorder(new TitledBorder("Identity Detail"));
    jp12.setLayout(new GridBagLayout());
    gbc.insets=new Insets(5,5,5,5);
    JLabel l22=new JLabel("Identity Card");
    gbc.gridx=0;
    gbc.gridy=0;
    jp12.add(l22,gbc);
    JTextField jtf12=new JTextField(10);
    gbc.gridx=1;
    jp12.add(jtf12,gbc);
    JLabel l32=new JLabel("Date of Issue");
    gbc.gridx=0;
    gbc.gridy=1;
    jp12.add(l32,gbc);
    JTextField jtf22=new JTextField(10);
    gbc.insets=new Insets(5,5,5,25);
    gbc.gridx=1;
    jp12.add(jtf22,gbc);
    JLabel l42=new JLabel("Identity Number");
    gbc.insets=new Insets(5,5,5,5);
    gbc.gridx=2;
    jp12.add(l42,gbc);
    JTextField jtf32=new JTextField(10);
    gbc.gridx=3;
    jp12.add(jtf32,gbc);
    JLabel l52=new JLabel("Name Of Issuer");
    gbc.gridx=0;
    gbc.gridy=2;
    jp12.add(l52,gbc);
    JTextField jtf42=new JTextField(10);
    gbc.insets=new Insets(5,5,5,25);
    gbc.gridx=1;
    jp12.add(jtf42,gbc);
    JLabel l62= new JLabel("Place Of Issuer");
    gbc.insets=new Insets(5,5,5,5);
    gbc.gridx=2;
    jp12.add(l62,gbc);
    JTextField jtf52=new JTextField(10);
    gbc.gridx=3;
    jp12.add(jtf52,gbc);
    gbc.gridx=0;
    gbc.gridy=2;
    Box b12 =Box.createVerticalBox(); //adding both panels to vertica box and adding it to panel2
    b12.add(jp02);
    b12.add(jp12);
    panel2.add(b12);
    //<--------coding for third tab--------->
    JPanel panel3 = new JPanel();
    tabbedPane.addTab("Detail of Tenant",null,panel3,"third tab");
    //adding panel for top data
    JPanel jp13=new JPanel(); //jp13 panel for details above 3 TitledBorder panels
    jp13.setLayout(new GridBagLayout());
    JLabel l13=new JLabel("Name");
    gbc.insets=new Insets(2,2,2,2);
    gbc.gridx=0;
    gbc.gridy=0;
    jp13.add(l13,gbc);
    JComboBox c13=new JComboBox();
    c13.addItem("Select");
    c13.addItem("Mr.");
    c13.addItem("Mrs.");
    gbc.gridx=1;
    jp13.add(c13,gbc);
    JTextField jtf13=new JTextField(16);
    gbc.gridx=2;
    gbc.gridwidth=2;
    jp13.add(jtf13,gbc);
    JLabel l23=new JLabel("Sex");
    gbc.insets=new Insets(2,20,2,2);
    gbc.gridx=4;
    gbc.gridwidth=1;
    jp13.add(l23,gbc);
    JComboBox c23=new JComboBox();
    c23.addItem("Select");
    c23.addItem("Male");
    c23.addItem("Female");
    gbc.insets=new Insets(2,2,2,2);
    gbc.gridx=5;
    jp13.add(c23,gbc);
    JLabel l33=new JLabel("Father/Mother/Husband's Name");
    gbc.gridy=1;
    gbc.gridx=0;
    jp13.add(l33,gbc);
    JComboBox c33=new JComboBox();
    c33.addItem("Select");
    c33.addItem("Mr.");
    c33.addItem("Mrs.");
    gbc.gridx=1;
    jp13.add(c33,gbc);
    JComboBox c43=new JComboBox();
    c43.addItem("Select");
    c43.addItem("Mr.");
    c43.addItem("Mrs.");
    gbc.gridx=2;
    jp13.add(c43,gbc);
    JTextField jtf23=new JTextField(10);
    gbc.gridx=3;
    jp13.add(jtf23,gbc);
    JLabel l43=new JLabel("Age(Yrs)");
    gbc.insets=new Insets(2,20,2,2);
    gbc.gridx=4;
    jp13.add(l43,gbc);
    JTextField jtf33=new JTextField(3);
    gbc.insets=new Insets(2,2,2,2);
    gbc.gridx=5;
    jp13.add(jtf33,gbc);
    JLabel l53=new JLabel("Citizenship");
    gbc.gridy=2;
    gbc.gridx=0;
    jp13.add(l53,gbc);
    JComboBox c53=new JComboBox();
    c53.addItem("Select");
    c53.addItem("Indian");
    c53.addItem("Australian");
    gbc.gridx=1;
    gbc.gridwidth=2;
    jp13.add(c53,gbc);
    JLabel l63=new JLabel("Occupation");
    gbc.insets=new Insets(2,20,2,2);
    gbc.gridx=4;
    gbc.gridwidth=1;
    jp13.add(l63,gbc);
    JComboBox c63=new JComboBox();
    c63.addItem("Select");
    c63.addItem("Engineer");
    c63.addItem("Doctor");
    gbc.insets=new Insets(2,2,2,2);
    gbc.gridx=5;
    jp13.add(c63,gbc);
    panel3.add(jp13);
    JPanel jp23=new JPanel(); //first of 3 TitledBorder panels
    jp23.setBorder(new TitledBorder("Local Address"));
    jp23.setLayout(new GridBagLayout());
    JLabel l73=new JLabel("Local Address");
    gbc.gridx=0;
    gbc.gridy=0;
    jp23.add(l73,gbc);
    JTextArea ta43=new JTextArea(3,10);
    ta43.setLineWrap(true);
    JScrollPane scroll13=new JScrollPane(ta43);
    gbc.gridx=1;
    gbc.gridy=0;
    jp23.add(ta43,gbc);
    JLabel l83=new JLabel("Country");
    gbc.gridx=0;
    gbc.gridy=1;
    gbc.gridheight=1;
    jp23.add(l83,gbc);
    JComboBox c73=new JComboBox();
    c73.addItem("India");
    c73.addItem("US");
    c73.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=1;
    jp23.add(c73,gbc);
    JLabel l93=new JLabel("State");
    gbc.gridx=0;
    gbc.gridy=2;
    jp23.add(l93,gbc);
    JComboBox c83=new JComboBox();
    c83.addItem("Rajasthan");
    c83.addItem("Delhi");
    c83.addItem("Maharastra");
    gbc.gridx=1;
    gbc.gridy=2;
    jp23.add(c83,gbc);
    JLabel l103=new JLabel("District");
    gbc.gridx=0;
    gbc.gridy=3;
    jp23.add(l103,gbc);
    JComboBox c93=new JComboBox();
    c93.addItem("jaipur");
    c93.addItem("ajmer");
    c93.addItem("alwar");
    gbc.gridx=1;
    gbc.gridy=3;
    jp23.add(c93,gbc);
    JLabel l113=new JLabel("City/Town");
    gbc.gridx=0;
    gbc.gridy=4;
    jp23.add(l113,gbc);
    JTextField tf53=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=4;
    jp23.add(tf53,gbc);
    JLabel l123=new JLabel("Police District");
    gbc.gridx=0;
    gbc.gridy=5;
    jp23.add(l123,gbc);
    JComboBox c103=new JComboBox();
    c103.addItem("Jaipur");
    c103.addItem("Alwar");
    c103.addItem("Ajmer");
    gbc.gridx=1;
    gbc.gridy=5;
    jp23.add(c103,gbc);
    JLabel l133=new JLabel("Police Circle");
    gbc.gridx=0;
    gbc.gridy=6;
    jp23.add(l133,gbc);
    JComboBox c113=new JComboBox();
    c113.addItem("India");
    c113.addItem("US");
    c113.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=6;
    jp23.add(c113,gbc);
    JLabel l143=new JLabel("Police station");
    gbc.gridx=0;
    gbc.gridy=7;
    jp23.add(l143,gbc);
    JComboBox c123=new JComboBox();
    c123.addItem("Bani Park");
    c123.addItem("Raja Park");
    c123.addItem("Malviya Nagar");
    gbc.gridx=1;
    gbc.gridy=7;
    jp23.add(c123,gbc);
    JLabel l153=new JLabel("Pin No.");
    gbc.gridx=0;
    gbc.gridy=8;
    jp23.add(l153,gbc);
    JTextField tf63=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=8;
    jp23.add(tf63,gbc);
    JLabel l163=new JLabel("Phone No.(R)");
    gbc.gridx=0;
    gbc.gridy=9;
    jp23.add(l163,gbc);
    JTextField tf73=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=9;
    jp23.add(tf73,gbc);
    JLabel l173=new JLabel("E-mail");
    gbc.gridx=0;
    gbc.gridy=10;
    gbc.gridheight=1;
    jp23.add(l173,gbc);
    JTextField tf83=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=10;
    jp23.add(tf83,gbc);
    JPanel jp33=new JPanel(); //second of 3 TitledBorder panels
    jp33.setBorder(new TitledBorder("Permanent Address"));
    jp33.setLayout(new GridBagLayout());
    JLabel l183=new JLabel("Perm. Address");
    gbc.gridx=0;
    gbc.gridy=0;
    jp33.add(l183,gbc);
    JTextArea ta93=new JTextArea(5,10);
    JScrollPane scroll23=new JScrollPane(ta43);
    ta93.setLineWrap(true);
    gbc.gridx=1;
    gbc.gridy=0;
    jp33.add(ta43,gbc);
    JLabel l193=new JLabel("Country");
    gbc.gridx=0;
    gbc.gridy=1;
    gbc.gridheight=1;
    jp33.add(l193,gbc);
    JComboBox c133=new JComboBox();
    c133.addItem("India");
    c133.addItem("US");
    c133.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=1;
    jp33.add(c133,gbc);
    JLabel l203=new JLabel("State");
    gbc.gridx=0;
    gbc.gridy=2;
    jp33.add(l203,gbc);
    JComboBox c143=new JComboBox();
    c143.addItem("Rajasthan");
    c143.addItem("Delhi");
    c143.addItem("Maharastra");
    gbc.gridx=1;
    gbc.gridy=2;
    jp33.add(c143,gbc);
    JLabel l213=new JLabel("District");
    gbc.gridx=0;
    gbc.gridy=3;
    jp33.add(l213,gbc);
    JComboBox c153=new JComboBox();
    c153.addItem("jaipur");
    c153.addItem("ajmer");
    c153.addItem("alwar");
    gbc.gridx=1;
    gbc.gridy=3;
    jp33.add(c153,gbc);
    JLabel l223=new JLabel("City/Town");
    gbc.gridx=0;
    gbc.gridy=4;
    jp33.add(l223,gbc);
    JTextField tf103=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=4;
    jp33.add(tf103,gbc);
    JLabel l233=new JLabel("Police District");
    gbc.gridx=0;
    gbc.gridy=5;
    jp33.add(l233,gbc);
    JComboBox c163=new JComboBox();
    c163.addItem("Jaipur");
    c163.addItem("Alwar");
    c163.addItem("Ajmer");
    gbc.gridx=1;
    gbc.gridy=5;
    jp33.add(c163,gbc);
    JLabel l243=new JLabel("Police Circle");
    gbc.gridx=0;
    gbc.gridy=6;
    jp33.add(l243,gbc);
    JComboBox c173=new JComboBox();
    c173.addItem("India");
    c173.addItem("US");
    c173.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=6;
    jp33.add(c173,gbc);
    JLabel l253=new JLabel("Police station");
    gbc.gridx=0;
    gbc.gridy=7;
    jp33.add(l253,gbc);
    JComboBox c183=new JComboBox();
    c183.addItem("Bani Park");
    c183.addItem("Raja Park");
    c183.addItem("Malviya Nagar");
    gbc.gridx=1;
    gbc.gridy=7;
    jp33.add(c183,gbc);
    JLabel l263=new JLabel("Pin No.");
    gbc.gridx=0;
    gbc.gridy=8;
    jp33.add(l263,gbc);
    JTextField tf113=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=8;
    jp33.add(tf113,gbc);
    JLabel l273=new JLabel("Phone No.(R)");
    gbc.gridx=0;
    gbc.gridy=9;
    jp33.add(l273,gbc);
    JTextField tf123=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=9;
    jp33.add(tf123,gbc);
    JLabel l283=new JLabel("phone No.(M)");
    gbc.gridx=0;
    gbc.gridy=10;
    gbc.gridheight=1;
    jp33.add(l283,gbc);
    JTextField tf133=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=10;
    jp33.add(tf133,gbc);
    JPanel jp43=new JPanel(); //third of 3 TitledBorder panels
    jp43.setBorder(new TitledBorder("Ex-Home Address"));
    jp43.setLayout(new GridBagLayout());
    JLabel l293=new JLabel("Address");
    gbc.gridx=0;
    gbc.gridy=0;
    jp43.add(l293,gbc);
    JTextArea ta143=new JTextArea(3,10);
    ta143.setLineWrap(true);
    JScrollPane scroll33=new JScrollPane(ta143);
    gbc.gridx=1;
    gbc.gridy=0;
    jp43.add(ta143,gbc);
    JLabel l303=new JLabel("Country");
    gbc.gridx=0;
    gbc.gridy=1;
    gbc.gridheight=1;
    jp43.add(l303,gbc);
    JComboBox c193=new JComboBox();
    c193.addItem("India");
    c193.addItem("US");
    c193.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=1;
    jp43.add(c193,gbc);
    JLabel l313=new JLabel("State");
    gbc.gridx=0;
    gbc.gridy=2;
    jp43.add(l313,gbc);
    JComboBox c203=new JComboBox();
    c203.addItem("Rajasthan");
    c203.addItem("Delhi");
    c203.addItem("Maharastra");
    gbc.gridx=1;
    gbc.gridy=2;
    jp43.add(c203,gbc);
    JLabel l323=new JLabel("District");
    gbc.gridx=0;
    gbc.gridy=3;
    jp43.add(l323,gbc);
    JComboBox c213=new JComboBox();
    c213.addItem("jaipur");
    c213.addItem("ajmer");
    c213.addItem("alwar");
    gbc.gridx=1;
    gbc.gridy=3;
    jp43.add(c213,gbc);
    JLabel l333=new JLabel("City/Town");
    gbc.gridx=0;
    gbc.gridy=4;
    jp43.add(l333,gbc);
    JTextField tf153=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=4;
    jp43.add(tf153,gbc);
    JLabel l343=new JLabel("Police District");
    gbc.gridx=0;
    gbc.gridy=5;
    jp43.add(l343,gbc);
    JComboBox c223=new JComboBox();
    c223.addItem("Jaipur");
    c223.addItem("Alwar");
    c223.addItem("Ajmer");
    gbc.gridx=1;
    gbc.gridy=5;
    jp43.add(c223,gbc);
    JLabel l353=new JLabel("Police Circle");
    gbc.gridx=0;
    gbc.gridy=6;
    jp43.add(l353,gbc);
    JComboBox c233=new JComboBox();
    c233.addItem("India");
    c233.addItem("US");
    c233.addItem("Australia");
    gbc.gridx=1;
    gbc.gridy=6;
    jp43.add(c233,gbc);
    JLabel l363=new JLabel("Police station");
    gbc.gridx=0;
    gbc.gridy=7;
    jp43.add(l363,gbc);
    JComboBox c243=new JComboBox();
    c243.addItem("Bani Park");
    c243.addItem("Raja Park");
    c243.addItem("Malviya Nagar");
    gbc.gridx=1;
    gbc.gridy=7;
    jp43.add(c123,gbc);
    JLabel l373=new JLabel("Pin No.");
    gbc.gridx=0;
    gbc.gridy=8;
    jp43.add(l373,gbc);
    JTextField tf163=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=8;
    jp43.add(tf163,gbc);
    JLabel l383=new JLabel("Phone");
    gbc.gridx=0;
    gbc.gridy=9;
    jp43.add(l383,gbc);
    JTextField tf173=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=9;
    jp43.add(tf173,gbc);
    JLabel l393=new JLabel("Leaving Date");
    gbc.gridx=0;
    gbc.gridy=10;
    gbc.gridheight=1;
    jp43.add(l393,gbc);
    JTextField tf183=new JTextField(10);
    gbc.gridx=1;
    gbc.gridy=10;
    jp43.add(tf183,gbc);
    /*JCheckBox cb13=new JCheckBox("Approx");
    gbc.gridx=2;
    gbc.gridy=10;
    jp43.add(cb13);*/
    JPanel jp53=new JPanel(); //panel for addin all 3 TitledBorder panels
    jp53.setLayout(new BoxLayout(jp53,BoxLayout.X_AXIS));
    jp53.add(jp23);
    jp53.add(Box.createHorizontalStrut(30)); //giving space between each TitledBorder panel
    jp53.add(jp33);
    jp53.add(Box.createHorizontalStrut(30));
    jp53.add(jp43);
    panel3.add(jp53); //adding panel which contains all 3 TitledBorder panels to panel3
    JPanel jp63=new JPanel(); //jp63 panel for bottom data
    jp63.setBorder(new TitledBorder("Tennancy Start/End"));
    JLabel l403=new JLabel("From Date");
    jp63.add(l403);
    JTextField jtf193=new JTextField(12);
    jp63.add(jtf193);
    JCheckBox jcb23=new JCheckBox("Approx");
    jp63.add(jcb23);
    JLabel l413=new JLabel("To Date");
    jp63.add(l413);
    JTextField jtf203=new JTextField(12);
    jp63.add(jtf203);
    JCheckBox jcb33=new JCheckBox("Approx");
    jp63.add(jcb33);
    panel3.add(jp63); //adding bottom details panel jp63 to panel3
    //<--------coding for fourth tab--------->
    JPanel panel4 = new JPanel();
    tabbedPane.addTab("Id of Tenant",null,panel4,"fourth tab");
    panel4.setLayout(new FlowLayout());
    //adding radiobutton above TitledBorder panel jp14
    JPanel jp04=new JPanel();
    JLabel l14=new JLabel("Identity Known");
    JRadioButton jrb14=new JRadioButton("Yes");
    JRadioButton jrb24=new JRadioButton("No");
    ButtonGroup bg14=new ButtonGroup();
    bg14.add(jrb14);
    bg14.add(jrb24);
    jp04.add(l14);
    jp04.add(jrb14);
    jp04.add(jrb24);
    //adding TitledBorder panel jp14
    JPanel jp14=new JPanel();
    jp14.setBorder(new TitledBorder("Identity Detail"));
    jp14.setLayout(new GridBagLayout());
    gbc.insets=new Insets(5,5,5,5);
    JLabel l24=new JLabel("Identity Card");
    gbc.gridx=0;
    gbc.gridy=0;
    jp14.add(l24,gbc);
    JTextField jtf14=new JTextField(10);
    gbc.gridx=1;
    jp14.add(jtf14,gbc);
    JLabel l34=new JLabel("Date of Issue");
    gbc.gridx=0;
    gbc.gridy=1;
    jp14.add(l34,gbc);
    JTextField jtf24=new JTextField(10);
    gbc.insets=new Insets(5,5,5,25);
    gbc.gridx=1;
    jp14.add(jtf24,gbc);
    JLabel l44=new JLabel("Identity Number");
    gbc.insets=new Insets(5,5,5,5);
    gbc.gridx=2;
    jp14.add(l44,gbc);
    JTextField jtf34=new JTextField(10);
    gbc.gridx=3;
    jp14.add(jtf34,gbc);
    JLabel l54=new JLabel("Name Of Issuer");
    gbc.gridx=0;
    gbc.gridy=2;
    jp14.add(l54,gbc);
    JTextField jtf44=new JTextField(10);
    gbc.insets=new Insets(5,5,5,25);
    gbc.gridx=1;
    jp14.add(jtf44,gbc);
    JLabel l64=new JLabel("Place Of Issuer");
    gbc.insets=new Insets(5,5,5,5);
    gbc.gridx=2;
    jp14.add(l64,gbc);
    JTextField jtf54=new JTextField(10);
    gbc.gridx=3;
    jp14.add(jtf54,gbc);
    gbc.gridx=0;
    gbc.gridy=2;
    Box b14=Box.createVerticalBox(); //adding both panels to panel4 in vertical box
    b14.add(jp04);
    b14.add(jp14);
    panel4.add(b14);
    //<--------coding for fifth tab--------->
    JPanel panel5 = new JPanel();
    tabbedPane.addTab("Info Of Other Members",null,panel5,"fifth tab");
    JPanel jp15=new JPanel(); //top panel jp15 for details above add delete buttons
    jp15.setLayout(new GridBagLayout());
    JLabel l15=new JLabel("Name");
    gbc.gridx=0;
    gbc.gridy=0;
    gbc.insets=new Insets(10,10,10,10);
    jp15.add(l15,gbc);
    JTextField jtf15=new JTextField(10);
    gbc.gridx=1;
    jp15.add(jtf15,gbc);
    JLabel l25=new JLabel("Sex");
    gbc.gridx=2;
    gbc.insets=new Insets(10,80,10,10);
    jp15.add(l25,gbc);
    JComboBox jcb15=new JComboBox();
    jcb15.addItem("Male");
    jcb15.addItem("Female");
    gbc.gridx=3;
    gbc.insets=new Insets(10,10,10,10);
    jp15.add(jcb15,gbc);
    JLabel l35=new JLabel("Relation");
    gbc.gridx=0;
    gbc.gridy=1;
    gbc.insets=new Insets(10,10,40,10);
    jp15.add(l35,gbc);
    JTextField jtf25=new JTextField(10);
    gbc.gridx=1;
    jp15.add(jtf25,gbc);
    JLabel l45=new JLabel("Age");
    gbc.gridx=2;
    gbc.insets=new Insets(10,80,40,10);
    jp15.add(l45,gbc);
    JTextField jtf35 =new JTextField(10);
    gbc.gridx=3;
    gbc.insets=new Insets(10,10,40,10);
    jp15.add(jtf35,gbc);
    JPanel jp25=new JPanel(); //middle panel jp25 for adding "add" and "delete" buttons
    JButton jb15=new JButton("Add");
    JButton jb25=new JButton("Delete");
    jp25.add(jb15);
    jp25.add(jb25);
    //adding table #yet to be coded#
    Box b15=Box.createVerticalBox();
    b15.add(jp15);
    b15.add(jp25);
    panel5.add(b15); //adding jp15 and jp25 to panel5 in vertical box
    //<--------coding for sixth tab--------->
    JPanel panel6 = new JPanel();
    tabbedPane.addTab("Related To Office",null,panel6,"sixth tab");
    panel6.setLayout(new GridBagLayout());
    //adding 4 labels and textfields vertically
    JLabel l16=new JLabel("Investigation Officer");
    gbc.gridx=0;
    gbc.gridy=0;
    gbc.insets=new Insets(40,40,20,10);
    panel6.add(l16,gbc);
    JTextField jtf16 =new JTextField(10);
    gbc.gridx=1;
    gbc.insets=new Insets(40,20,20,40);
    panel6.add(jtf16,gbc);
    JLabel l26=new JLabel("S.No.");
    gbc.gridx=0;
    gbc.gridy=1;
    gbc.insets=new Insets(10,40,20,10);
    panel6.add(l26,gbc);
    JTextField jtf26 =new JTextField(10);
    gbc.gridx=1;
    gbc.insets=new Insets(10,20,20,40);
    panel6.add(jtf26,gbc);
    JLabel l36=new JLabel("Page No.");
    gbc.gridx=0;
    gbc.gridy=2;
    gbc.insets=new Insets(10,40,20,10);
    panel6.add(l36,gbc);
    JTextField jtf36 =new JTextField(10);
    gbc.gridx=1;
    gbc.insets=new Insets(10,20,20,40);
    panel6.add(jtf36,gbc);
    JLabel l46=new JLabel("Date");
    gbc.gridx=0;
    gbc.gridy=3;
    gbc.insets=new Insets(10,40,20,10);
    panel6.add(l46,gbc);
    JTextField jtf46=new JTextField(10);
    gbc.gridx=1;
    gbc.insets=new Insets(10,20,20,40);
    panel6.add(jtf46,gbc);
    /* Canvas c16=new Canvas(); //creating a rectangle frame for adding image
    Image i16=c.createImage(200,100);
    gbc.gridx=2;
    gbc.gridy=0;
    gbc.insets=new Insets(40,20,20,40);
    gbc.gridheight=3;
    panel6.add(i16,gbc);*/
    JButton jb16=new JButton("Browse"); //adding "browse" and "save" buttons
    gbc.insets=new Insets(10,20,20,40);
    gbc.gridy=3;
    panel6.add(jb16,gbc);
    JButton jb26=new JButton("Save");
    gbc.insets=new Insets(50,20,20,40);
    gbc.gridy=4;
    panel6.add(jb26,gbc);
    //<-------end of sixth tab------->
    add(tabbedPane);
    //lower panel for cancel button
    JPanel jp1=new JPanel();
    jp1.setLayout(new FlowLayout(FlowLayout.RIGHT));
    JButton can=new JButton("Cancel"); //initialising cancel button
    jp1.add(can);
    add(jp1,BorderLayout.SOUTH);
    class Blistener implements ActionListener // class for action listener
    public void actionPerformed(ActionEvent ae)
    Object obj=ae.getSource();
    try{
    if(obj == can) //condition for cancel button
    System.exit(0);
    }catch(Exception e)
    {System.out.println(e);
    public class Project
    public static void main(String args[]) //main method for the program
    Design tabbedwin= new Design();
    tabbedwin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    tabbedwin.setSize(900,700);
    tab

    First things first. Next time please use the code formating tags when posting your code.
    Secondly, we cant help you do your entire project or more specifically we cant do it for you. We can probably help you with one section at a time.
    Thirdly, do not post your entire code. Create a Short, Self Contained, Compilable Example (SSCCE) that demonstrates the problem section, and that is independent of any third party libraries and can compiled instantly and tested.
    Now, lets see if we can answer one problem here.
    Ques 1. In the form I have one JComboBox of Country and other of State. Now I want it in such a way that whenI select a country from the Country JComboBox ,the corresponding states automatically appears in the State JComboBox.
    Ans 1: Use an ItemListener or an ActionListener (javax.swing.event) for this. Once an item is selected, the event will be fired and then you populate your ComboBox with the requried data.
    Ques 2. I need to add picture frame in the 6th tab so that the picture shows up when clicked browse and open.
    Ans 2: You haven't created the JButton for the browse action, nor have you created the JLabel to show the picture in. Create the JButton, then the JLabel, attach an ActionListener to the button to listen for the button click, open a JFileChooser, select the image file, create an ImageIcon and pass the File object returned to it. Then call the JLabel.setIcon( the ImageIcon) to display the picture. You'll have to store the picture File information some where so can reference it when saving.
    Ques 3.I need to add tables in 1st and 5th tab which shows up the details through database when added through several textboxes and combo boxes.
    You need to do some reading. The Swing Tutorial has everything you need, from How to use Tables to How to connect to databases. There are also some examples in your JDK installation folder, ie, jdk/demos/jfc/tableExample. Here is the link to the swing tutorial on how to use Tables: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html. You find other useful links there.
    ICE

  • Plz help me out!! Custom components not showed in JTabbedPane....

    Hi!!
    I am extending a JPanel and adding some components to it and finally when I create an object and add it to the JTAbbedPane its not being shown....If i do it disrectly on JPanel instead of my class its is being shown.can anybody...please help me out and tell where the problem is ...My code is as follows....
    public class TabColorExample extends JPanel {
    public TabColorExample() {
    setLayout(new BorderLayout());
    UIManager.put("TabbedPane.selected", Color.green);
    JTabbedPane tabbedPane = new JTabbedPane();
    String tabs[] = {"One", "Two", "Three", "Four"};
    Color[] colors = {null, Color.red, null, null};
    for (int i=0;i<tabs.length;i++) {
    tabbedPane.addTab(tabs, createPane(tabs[i]));
    tabbedPane.setBackgroundAt(i, colors[i]);
    tabbedPane.setSelectedIndex(0);
    add(tabbedPane, BorderLayout.CENTER);
    JPanel createPane(String s) {
    return new panel(s);
    public static void main(String[] args) {
    JFrame frame = new JFrame("Tab color Example");
    frame.addWindowListener( new WindowAdapter() {
    public void windowClosing( WindowEvent e ) {
    System.exit(0);
    frame.getContentPane().add( new TabColorExample() );
    frame.setSize( 200, 100 );
    frame.setVisible(true);
    class panel extends javax.swing.JPanel
         panel(String s)
              super();
              JPanel p = new JPanel();
              p.add(new JLabel(s));
    Thanx in advance...
    Krtrao

    Hi there,
    Having that string in a mapping of DSO when DSO will process the SIDs it doesn't like that string and therefore throws an error.
    You could for example transform that field in for example start routine or customer exit R/3 side, like for example split string with commas, and concatenate everything like this: 01,02,03 should retrieve 010203.
    Other option is to first create master data texts datasource for that field PDP and for each key retrieves a string, like this for example:
    010203 - text 01,02,03, or text MDTDWD
    than when you fill the DSO with that field aready fixed in the form 010203, you can in the query represent it with text, it should represent in the form 01,02,03 or MDTDWD, see the picture?
    You can do this kind of fixing of the filed 01,02,03 or in the start routine, or the transfer structure.
    And to only get those records with the field being there, just write in the start routine something like:
    DELETE <SOURCE_PACKAGE> where your_field is initial.
    Hope this helps,
    Diogo.

  • Need help with assignment for class. its for my high school project :(

    i really need help, my problem is that with my code i cannot get the "previous", "done" and "next" buttons to work.they cannot seem to find the items from each other. so could someone look at those buttons in the code and tell me how to fix please? the code is as follows:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class GradeCalculator extends JFrame {
         private JTextField gradeA = new JTextField(3);
         private JTextField gradeB = new JTextField(3);
         private JTextField gradeC = new JTextField(3);
         private JTextField gradeD = new JTextField(3);
         private JTextField gradeE = new JTextField(3);
         private JTextField studentsName = new JTextField(15);
         private JTextField assignmentOne = new JTextField(5);
         private JTextField assignmentTwo = new JTextField(5);
         private JTextField assignmentThree = new JTextField(5);
         private JTextField examOne = new JTextField(5);
         private JTextField examTwo = new JTextField(5);
         private JTextArea textOutput;
         private JPanel buttonJPanel;
         public GradeCalculator(){
              JMenu fileMenu = new JMenu("File");
              JMenuItem aboutItem = new JMenuItem( "About" );
    fileMenu.add( aboutItem );
    aboutItem.addActionListener(
    new ActionListener()
    public void actionPerformed( ActionEvent event )
    JOptionPane.showMessageDialog( GradeCalculator.this,
    "Grade Calculator Version 1.00. \nMade by Carlson Smith.\nSchool: Pre-University\nSubject: Cape Computer Science.",
    "About", JOptionPane.PLAIN_MESSAGE );
              JMenuItem exitItem = new JMenuItem( "Exit" );
    fileMenu.add( exitItem );
    exitItem.addActionListener(
    new ActionListener()
    public void actionPerformed( ActionEvent event )
    System.exit( 0 );
              JMenuBar bar = new JMenuBar();
              setJMenuBar(bar);
              bar.add(fileMenu);     
              JTabbedPane tabbedPane = new JTabbedPane();
              buttonJPanel = new JPanel();
              buttonJPanel.setLayout(new GridLayout(1,2));
              JButton ok = new JButton("OK");
              ok.addActionListener(new OkBtnListener());
              JButton edit = new JButton("EDIT");
              edit.addActionListener(new EditBtnListener());
              /**JButton previous = new JButton("PREVIOUS");
              previous.addActionListener(new PreviousBtnListener());
              JButton done = new JButton("DONE");
              done.addActionListener(new DoneBtnListener());
              JButton next = new JButton("NEXT");
              next.addActionListener(new NextBtnListener());
              JPanel contentPane = new JPanel();
              contentPane.setLayout(new FlowLayout());
              contentPane.add(new JLabel("Grade A")/**,BorderLayout.NORTH*/);
              contentPane.add(gradeA/**,BorderLayout.NORTH*/);
              contentPane.add(new JLabel("Grade B")/**,BorderLayout.WEST*/);
              contentPane.add(gradeB/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade C")/**,BorderLayout.WEST*/);
              contentPane.add(gradeC/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade D")/**,BorderLayout.WEST*/);
              contentPane.add(gradeD/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade E")/**,BorderLayout.WEST*/);
              contentPane.add(gradeE/**,BorderLayout.WEST*/);
              tabbedPane.addTab("Grade Entry Tab", null, contentPane, "Grade Tab");
              //contentPane.add(ok,BorderLayout.WEST);
              //contentPane.add(edit,BorderLayout.WEST);
              buttonJPanel.add(ok);
              buttonJPanel.add(edit);
              contentPane.add(buttonJPanel, BorderLayout.WEST);
              JPanel content = new JPanel();
              content.setLayout(new FlowLayout());
              content.add(new JLabel("Student's Name")/**,BorderLayout.EAST*/);
              content.add(studentsName/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 1 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentOne/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 2 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentTwo/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 3 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentThree/**,BorderLayout.EAST*/);
              content.add(new JLabel("Exam 1 score:")/**,BorderLayout.EAST*/);
              content.add(examOne/**,BorderLayout.EAST*/);
              content.add(new JLabel("Exam 2 score:")/**,BorderLayout.EAST*/);
              content.add(examTwo/**,BorderLayout.EAST*/);
              //content.add(previous,BorderLayout.EAST);
              //content.add(done,BorderLayout.EAST);
              //content.add(next,BorderLayout.EAST);
              Box box = Box.createVerticalBox();
              String output = "test";
              String outputTwo = output;
              textOutput = new JTextArea(outputTwo,10,30);
              box.add(new JScrollPane(textOutput));
              textOutput.setEditable(false);
              content.add(box,BorderLayout.SOUTH);
              tabbedPane.addTab("Calculator Tab", null, content, "Calculation & Output Tab");
              setContentPane(tabbedPane);
              pack();
              setTitle("Grade Calculator");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setLocationRelativeTo(null);
              class OkBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        String gradeAA = gradeA.getText();
                        double gradA = Double.parseDouble(gradeAA);
                        gradeA.setText(" "+gradA);
                        String gradeBB = gradeB.getText();
                        double gradB = Double.parseDouble(gradeBB);
                        gradeB.setText(" "+gradB);
                        String gradeCC = gradeC.getText();
                        double gradC = Double.parseDouble(gradeCC);
                        gradeC.setText(" "+gradC);
                        String gradeDD = gradeD.getText();
                        double gradD = Double.parseDouble(gradeDD);
                        gradeD.setText(" "+gradD);
                        String gradeEE = gradeE.getText();
                        double gradE = Double.parseDouble(gradeEE);
                        gradeE.setText(" "+gradE);
                        gradeA.setEditable(false);
                        gradeB.setEditable(false);
                        gradeC.setEditable(false);
                        gradeD.setEditable(false);
                        gradeE.setEditable(false);
              class EditBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        gradeA.setEditable(true);
                        gradeB.setEditable(true);
                        gradeC.setEditable(true);
                        gradeD.setEditable(true);
                        gradeE.setEditable(true);
              /**class PreviousBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        if (i <= 0){
                             i = 0;
                        }else if(i > 0){
                             i = i-1;
              class DoneBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        output = "Results \n";
                        output+= studentName[i]+" Assignment Average = "+averageO[i]+" Exam Average = "+averageT[i]+" Overall average = ";
                        output+= tAverage[i]+" Letter Grade = "+letterGrade;
              class NextBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        String [] studentName = new String [40];
                        double [] assignOne = new double [40];
                        double [] assignTwo = new double [40];
                        double [] assignThree = new double [40];
                        double [] gradeOne = new double [40];
                        double [] gradeTwo = new double [40];
                        double [] averageO = new double [40];
                        double [] averageT = new double [40];
                        double [] tAverage = new double [40];
                        char [] letterGrade = new char [40];
                        double max = 0;
                        double min = 100;
                        int i = 0;
                        while(i < studentName.length){
                             studentName[i] = studentsName.getText();
                             studentsName.setText(studentName[i]);
                             String aOne = assignmentOne.getText();
                             assignOne[i] = Double.parseDouble(aOne);
                             assignmentOne.setText(assignOne[i]);
                             String aTwo = assignmentTwo.getText();
                             assignTwo[i] = Double.parseDouble(aTwo);
                             assignmentTwo.setText(assignTwo[i]);
                             String aThree = assignmentThree.getText();
                             assignThree[i] = Double.parseDouble(aThree);
                             assignmentThree.setText(assignThree[i]);
                             String gOne = examOne.getText();
                             gradeOne[i] = Double.parseDouble(gOne);
                             examOne.setText(gradeOne[i]);
                             String gTwo = examTwo.getText();
                             gradeTwo = Double.parseDouble(gTwo);
                             examTwo.setText(gradeTwo[i]);
                             averageO[i] = (assignOne[i]+assignTwo[i]+assignThree[i])/3;
                             averageT[i] = (gradeOne[i]+gradeTwo[i])/2;
                             tAverage[i] = (averageO[i]+averageT[i])/2;
                             if (tAverage[i] >= gradeA){
                                  letterGrade[i] = 'A';
                             }else if(tAverage[i] >= gradeB){
                                  letterGrade[i] = 'B';
                             }else if(tAverage[i] >= gradeC){
                                  letterGrade[i] = 'C';
                             }else if(tAverage[i] >= gradeD){
                                  letterGrade[i] = 'D';
                             }else if(tAverage[i] <= gradeE){
                                  letterGrade[i] = 'E';
              public static void main(String[]args){
                   GradeCalculator calWindow = new GradeCalculator();
                   calWindow.setVisible(true);

    i have to apologize to jittei for the misunderstand i do not know which defination of terms is for which line of code but i know what they do, to solve the problem i have actually made another class in the workspace file called students and now all the bottons work, all i have to do now is properly arrange and put in some additional lines of code and it will be completed. teacher gave me the idea of putting in a new class to help in calling codes from other subclasses in the main program. ah well guess non of you could think of that thanks for the help-ish and hope yall will atleast try to be nice to new people that come in the room. the new coding is:
    of course all the commented out lines are not being used in the program anymore but just there till i have the program working with everything in it runs and performs the actions required now though ^_^
    *Group CAPE Computer Science 2007/8
    *GradeCalculator.java
    *@author Carlson Smith
    *@version 3.01          07/02/2008
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class GradeCalculator extends JFrame {
         private JTextField gradeA = new JTextField(3);
         private JTextField gradeB = new JTextField(3);
         private JTextField gradeC = new JTextField(3);
         private JTextField gradeD = new JTextField(3);
         private JTextField gradeE = new JTextField(3);
         private JTextField studentsName = new JTextField(15);
         private JTextField assignmentOne = new JTextField(5);
         private JTextField assignmentTwo = new JTextField(5);
         private JTextField assignmentThree = new JTextField(5);
         private JTextField examOne = new JTextField(5);
         private JTextField examTwo = new JTextField(5);
         private JTextArea  textOutput;
         private JPanel buttonJPanel;
         private JPanel buttonJPanelTwo;
         private Student [] students = new Student[40];
         private int current = 0;
         private String output;
         public GradeCalculator(){
              JMenu fileMenu = new JMenu("File");
              JMenuItem aboutItem = new JMenuItem( "About" );
              for (int i=0;i<40;i++){
                   students[i] = new Student("");
            fileMenu.add( aboutItem );
            aboutItem.addActionListener(
               new ActionListener()
                  public void actionPerformed( ActionEvent event )
                     JOptionPane.showMessageDialog( GradeCalculator.this,
                        "Grade Calculator Version 1.00. \nMade by Carlson Smith.\nSchool: Pre-University\nSubject: Cape Computer Science.",
                        "About", JOptionPane.PLAIN_MESSAGE );
              JMenuItem exitItem = new JMenuItem( "Exit" ); 
            fileMenu.add( exitItem );
            exitItem.addActionListener(
               new ActionListener()
                  public void actionPerformed( ActionEvent event )
                     System.exit( 0 );
              JMenuBar bar = new JMenuBar();
              setJMenuBar(bar);
              bar.add(fileMenu);     
              JTabbedPane tabbedPane = new JTabbedPane();
              buttonJPanel = new JPanel();
              buttonJPanel.setLayout(new GridLayout(1,2));
              JButton ok = new JButton("OK");
              ok.addActionListener(new OkBtnListener());
              JButton edit = new JButton("EDIT");
              edit.addActionListener(new EditBtnListener());
              buttonJPanelTwo = new JPanel();
              buttonJPanelTwo.setLayout(new GridLayout(1,3));
              JButton previous = new JButton("PREVIOUS");
              previous.addActionListener(new PreviousBtnListener());
              JButton done = new JButton("DONE");
              done.addActionListener(new DoneBtnListener());
              JButton next = new JButton("NEXT");
              next.addActionListener(new NextBtnListener());
              JPanel contentPane = new JPanel();
              contentPane.setLayout(new FlowLayout());
              contentPane.add(new JLabel("Grade A")/**,BorderLayout.NORTH*/);
              contentPane.add(gradeA/**,BorderLayout.NORTH*/);
              contentPane.add(new JLabel("Grade B")/**,BorderLayout.WEST*/);
              contentPane.add(gradeB/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade C")/**,BorderLayout.WEST*/);
              contentPane.add(gradeC/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade D")/**,BorderLayout.WEST*/);
              contentPane.add(gradeD/**,BorderLayout.WEST*/);
              contentPane.add(new JLabel("Grade E")/**,BorderLayout.WEST*/);
              contentPane.add(gradeE/**,BorderLayout.WEST*/);
              tabbedPane.addTab("Grade Entry Tab", null, contentPane, "Grade Tab");
              //contentPane.add(ok,BorderLayout.WEST);
              //contentPane.add(edit,BorderLayout.WEST);
              buttonJPanel.add(ok);
              buttonJPanel.add(edit);
              contentPane.add(buttonJPanel, BorderLayout.WEST);
              JPanel content = new JPanel();
              content.setLayout(new FlowLayout());
              content.add(new JLabel("Student's Name")/**,BorderLayout.EAST*/);
              content.add(studentsName/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 1 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentOne/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 2 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentTwo/**,BorderLayout.EAST*/);
              content.add(new JLabel("Assignment 3 score:")/**,BorderLayout.EAST*/);
              content.add(assignmentThree/**,BorderLayout.EAST*/);
              content.add(new JLabel("Exam 1 score:")/**,BorderLayout.EAST*/);
              content.add(examOne/**,BorderLayout.EAST*/);
              content.add(new JLabel("Exam 2 score:")/**,BorderLayout.EAST*/);
              content.add(examTwo/**,BorderLayout.EAST*/);
              //content.add(previous,BorderLayout.EAST);
              //content.add(done,BorderLayout.EAST);
              //content.add(next,BorderLayout.EAST);
              buttonJPanelTwo.add(previous);
              buttonJPanelTwo.add(done);
              buttonJPanelTwo.add(next);
              content.add(buttonJPanelTwo, BorderLayout.EAST);
              Box box = Box.createVerticalBox();
              //String outputTwo = output;
              //textOutput.setText(output);
              textOutput = new JTextArea(output,10,30);
              box.add(new JScrollPane(textOutput));
              //textOutput.setEditable(true);
              content.add(box,BorderLayout.SOUTH);
              tabbedPane.addTab("Calculator Tab", null, content, "Calculation & Output Tab");
              setContentPane(tabbedPane);
              pack();
              setTitle("Grade Calculator");
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setLocationRelativeTo(null);
              class OkBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        String gradeAA = gradeA.getText();
                        double gradA = Double.parseDouble(gradeAA);
                        gradeA.setText(" "+gradA);
                        String gradeBB = gradeB.getText();
                        double gradB = Double.parseDouble(gradeBB);
                        gradeB.setText(" "+gradB);
                        String gradeCC = gradeC.getText();
                        double gradC = Double.parseDouble(gradeCC);
                        gradeC.setText(" "+gradC);
                        String gradeDD = gradeD.getText();
                        double gradD = Double.parseDouble(gradeDD);
                        gradeD.setText(" "+gradD);
                        String gradeEE = gradeE.getText();
                        double gradE = Double.parseDouble(gradeEE);
                        gradeE.setText(" "+gradE);
                        gradeA.setEditable(false);
                        gradeB.setEditable(false);
                        gradeC.setEditable(false);
                        gradeD.setEditable(false);
                        gradeE.setEditable(false);
              class EditBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        gradeA.setEditable(true);
                        gradeB.setEditable(true);
                        gradeC.setEditable(true);
                        gradeD.setEditable(true);
                        gradeE.setEditable(true);
              class PreviousBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        Student currentStudent = students[current];
                        currentStudent.setStudentName(studentsName.getText());          
                        currentStudent.setAssignOne(Double.parseDouble(assignmentOne.getText()));
                        currentStudent.setAssignTwo(Double.parseDouble(assignmentTwo.getText()));
                        currentStudent.setAssignThree(Double.parseDouble(assignmentThree.getText()));
                        currentStudent.setExamOneGrade(Double.parseDouble(examOne.getText()));
                        currentStudent.setExamTwoGrade(Double.parseDouble(examTwo.getText()));
                        currentStudent = students[current];
                        if (current <= 0){
                             current = 0;
                        }else if(current > 0){
                             current = current-1;
                        refresh();               
                        System.out.println(current);
              class DoneBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
                        Student currentStudent = students[current];
                        //output = "Result \n";
                        output = currentStudent.getStudentName()+". Assignment Average = "+currentStudent.getAverage()+". Exam Average = "+currentStudent.getExamAverage()+". Overall average = ";
                        output+= currentStudent.getTotalAverage()/**+" Letter Grade = "+letterGrade[current]*/;
                        textOutput.setText(output);
                        System.out.println(output);
                        currentStudent = students[current];
              class NextBtnListener implements ActionListener{
                   public void actionPerformed(ActionEvent e){
    //                    String [] studentName = new String [40];
    //                    double [] assignOne = new double [40];
    //                    double [] assignTwo = new double [40];
    //                    double [] assignThree = new double [40];
    //                    double [] gradeOne = new double [40];
    //                    double [] gradeTwo = new double [40];
    //                    double [] averageO = new double [40];
    //                    double [] averageT = new double [40];
    //                    double [] tAverage = new double [40];
    //                    char [] letterGrade = new char [40];
                        //double max = 0;
                        //double min = 100;
                        Student currentStudent = students[current];
                        currentStudent.setStudentName(studentsName.getText());
                        currentStudent.setAssignOne(Double.parseDouble(assignmentOne.getText()));
                        currentStudent.setAssignTwo(Double.parseDouble(assignmentTwo.getText()));
                        currentStudent.setAssignThree(Double.parseDouble(assignmentThree.getText()));
                        currentStudent.setExamOneGrade(Double.parseDouble(examOne.getText()));
                        currentStudent.setExamTwoGrade(Double.parseDouble(examTwo.getText()));
    //                    currentStudent = students[current];
                        current++;
                        refresh();
    /**                    while(i < studentName.length){
                             String aOne = assignmentOne.getText();
                             assignOne[i] = Double.parseDouble(aOne);
                             assignmentOne.setText(" "+assignOne);
                             String aTwo = assignmentTwo.getText();
                             assignTwo[i] = Double.parseDouble(aTwo);
                             assignmentTwo.setText(" "+assignTwo[i]);
                             String aThree = assignmentThree.getText();
                             assignThree[i] = Double.parseDouble(aThree);
                             assignmentThree.setText(" "+assignThree[i]);
                             String gOne = examOne.getText();
                             gradeOne[i] = Double.parseDouble(gOne);
                             examOne.setText(" "+gradeOne[i]);
                             String gTwo = examTwo.getText();
                             gradeTwo[i] = Double.parseDouble(gTwo);
                             examTwo.setText(" "+gradeTwo[i]);
                             averageO[i] = (assignOne[i]+assignTwo[i]+assignThree[i])/3;
                             averageT[i] = (gradeOne[i]+gradeTwo[i])/2;
                             tAverage[i] = (averageO[i]+averageT[i])/2;
                             if (tAverage[i] >= Double.parseDouble(gradeA.getText())){
                                  letterGrade[i] = 'A';
                             }else if(tAverage[i] >= Double.parseDouble(gradeB.getText())){
                                  letterGrade[i] = 'B';
                             }else if(tAverage[i] >= Double.parseDouble(gradeC.getText())){
                                  letterGrade[i] = 'C';
                             }else if(tAverage[i] >= Double.parseDouble(gradeD.getText())){
                                  letterGrade[i] = 'D';
                             }else if(tAverage[i] <= Double.parseDouble(gradeE.getText())){
                                  letterGrade[i] = 'E';
              public void refresh(){
                   Student currentStudent = students[current];
                   studentsName.setText(currentStudent.getStudentName());
                   assignmentOne.setText(currentStudent.getAssignOne()+"");
                   assignmentTwo.setText(currentStudent.getAssignTwo()+"");
                   assignmentThree.setText(currentStudent.getAssignThree()+"");
                   examOne.setText(currentStudent.getExamOneGrade()+"");
                   examTwo.setText(currentStudent.getExamTwoGrade()+"");
              public static void main(String[]args){
                   GradeCalculator calWindow = new GradeCalculator();
                   calWindow.setVisible(true);
    Second class implemented./**
    *Group CAPE Computer Science 2007/8
    *Student.java
    *@author Carlson Smith
    *@version 3.01          07/02/2008
    public class Student {
         private String studentName;
         private double assignOne;
         private double assignTwo;
         private double assignThree;
         private double examOneGrade;
         private double examTwoGrade;
         public Student(String sName){
              studentName = sName;     
         public String getStudentName(){
              return studentName;
         public double getAssignOne(){
              return assignOne;
         public double getAssignTwo(){
              return assignTwo;
         public double getAssignThree(){
              return assignThree;
         public double getExamOneGrade(){
              return examOneGrade;
         public double getExamTwoGrade(){
              return examTwoGrade;
         public void setStudentName(String sName){
              studentName = sName;
         public void setAssignOne(double assignOne){
              this.assignOne = assignOne;
         public void setAssignTwo(double assignTwo){
              this.assignTwo = assignTwo;
         public void setAssignThree(double assignThree){
              this.assignThree = assignThree;
         public void setExamOneGrade(double examOneGrade){
              this.examOneGrade = examOneGrade;
         public void setExamTwoGrade(double examTwoGrade){
              this.examTwoGrade = examTwoGrade;
         public double getAverage(){
              return (assignOne + assignTwo + assignThree)/3;
         public double getExamAverage(){
              return (examOneGrade + examTwoGrade)/2;
         public double getTotalAverage(){
              return (getAverage() + getExamAverage())/2;
    this thread can be closed now. l8rz :P
    Edited by: Jacal on Feb 10, 2008 7:28 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

  • Layout managers and JTabbedPane

    I have a JTabbed pane on my 'form' on which i want to insert two tables. the problem is that the tables are overstepping the 'boundaries' i have desgned for them ,whivh i suspect is a problem with the layout managers. I just cant seem to be able to restrict the tables within the fames and have scrollpanes, both horizontal and vertical for scrolling tables. I have included the code here:
    import java.awt.*;
    import javax.swing.*;
    public class FrmProducts extends JFrame{
         private          JTabbedPane tabbedPane;
         private          JPanel          factorsTab;
         private          JPanel          productListTab;
         private          JPanel          rateHistoryTab;
         private          JTable          forexFactorsTable;
         private          JTable      otherFactorsTable;
         private      JTable          productListTable;
         public FrmProducts(){
              initializeComponents();
         public  void DisplayForm(){
              java.awt.EventQueue.invokeLater(new Runnable(){
                   public void run(){
         private void initializeComponents(){
              setTitle( "Products administration" );
              setSize( 900, 550 );
              setBackground( Color.gray );
              JPanel topPanel = new JPanel();
              topPanel.setLayout( new BorderLayout() );
              getContentPane().add( topPanel );
              Toolkit kit = getToolkit();
              Dimension screenSize = kit.getScreenSize();
              int screenWidth = screenSize.width;                         //all this is to get
              int screenHeight = screenSize.height;                    //the form size and
              Dimension windowSize = getSize();                       //centre the form on
              int windowWidth = windowSize.width;                         //the screen
              int windowHeight = windowSize.height;
              int upperLeftX = (screenWidth - windowWidth)/2;
              int upperLeftY = (screenHeight - windowHeight)/2;
              setLocation(upperLeftX, upperLeftY);
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              // Create the tab pages
              createPage1();
              createPage2();
              createPage3();
              // Create a tabbed pane
              tabbedPane = new JTabbedPane();
              tabbedPane.addTab( "Facors", factorsTab );
              tabbedPane.addTab( "Products List", productListTab );
              tabbedPane.addTab( "Rate History", rateHistoryTab );
              topPanel.add( tabbedPane, BorderLayout.CENTER );
              setVisible(true);
         public void createPage1()
              factorsTab = new JPanel();
              factorsTab.setLayout( new GridLayout(2,1) );
              JPanel forexFactorsPanel;          //set up a frame with the forex factors details
              forexFactorsPanel = new JPanel();
              forexFactorsPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Forex factors"),
                BorderFactory.createEmptyBorder(5,5,5,5)));
              String forexFactorsColumns[]={"Factor","ZAR","US$"};
              String dummyValues1[][]={ {"Costing exchange rate","485.00",   "3400.00"},
                                          {"Local product exchange rate","430.00","3000.00"},
                                          {"Duty exchange rate1","35.30",          "250.00"},
                                          {"Duty exchange rate2","35.30",          "250.00"}};
              forexFactorsTable=new JTable(dummyValues1,forexFactorsColumns);
              JScrollPane scrollPane1=new JScrollPane(forexFactorsTable);
              forexFactorsPanel.add( scrollPane1, BorderLayout.CENTER );
              factorsTab.add(forexFactorsPanel);
              JPanel otherFactorsPanel;
              otherFactorsPanel=new JPanel();
              otherFactorsPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Other factors"),
                     BorderFactory.createEmptyBorder(5,5,5,5)));
              String otherFactorsColumns[]={"Description","Value"};
              String dummyValues2[][]={{"Landing Factor",                         "1.16"},
                                            {"Duty factor",                        "1.065"},
                                            {"Loading for overseas sourcing",  "1.15"},
                                            {"Extra mark up local",             "0.0"},
                                            {"Extra mark up imports",          "0.0"}};
              otherFactorsTable=new JTable(dummyValues2,otherFactorsColumns);
              JScrollPane scrollPane2=new JScrollPane(otherFactorsTable);
              otherFactorsPanel.add(scrollPane2, BorderLayout.CENTER);
              factorsTab.add(otherFactorsPanel);
         public void createPage2()
              productListTab = new JPanel();
              productListTab.setLayout( new BorderLayout() );
              String productListColumns[]={"Code1","Code2","Code3","Sales Category","Product code","Short Description",
                                             "Long Description","Supplier/Manufacturer","Supplier Product code",
                                             "Units","Master stockist","Lead time","re-Order level","economic order qty",
                                             "APR","min shipping qty"};
              String sampleValues[][]={
                     {"AI","AC","CE","Switchgear inc Starters","AIACCE 270","Timer int pulse start 230v 2C/O 30mins",
                       "Timer interval pulse start 230v 2 closed open 30 minutes","AC/DC South Africa","IAP2 30M","each",
                       "Central Stores","2","500","5000","APR","5000"},
                       {"GI","IN","ZZ","Alternative power and accessories","GIINZZ 174","INV HT SERIES 2500W 12v/230v MOD SWV",
                            "INVERTER HT SERIES 2500W 12v/230v MODIFIED SINEWAVE","SINETECH","HT-P-2500-12","each",
                            "Central Stores","6","1000","5000","APR","10000"}
              productListTable=new JTable(sampleValues,productListColumns);
              JScrollPane scrollPane3=new JScrollPane(productListTable);
              productListTab.add(scrollPane3, BorderLayout.CENTER);
         public void createPage3()
              rateHistoryTab = new JPanel();
              rateHistoryTab.setLayout( new GridLayout( 3, 2 ) );
    }This class is called by invoking the DispalyForm() function from a main form. May you please run it and see how the 'factors' panel needs correcting and help me do that

    wondering if there's a method that can be used to show a window(i.e. dialog) within a frame (much like an MDI form). That is, all windows are shown w/in the frame's border or title bar.
    Here's what I have attempted but to no avail:
    java.awt.Dimension screen = getDefaultToolkit.getScreenSize();
    java.awt.Insets frameInsets = this.getInsets();  // frame's insets
    // set bounds of child (window)
    window1.setbounds(frameInsets.top, frameInsets.top,
       screen.width - frameInsets.top -2, screen.height - frameInsets.top -2);any help is appreciated

  • JDialog jdk1.5 vs jdk1.6

    Hi,
    I'm having a different behaviour when I'm executing the following code on jdk1.5 and 1.6 :
    import java.awt.BorderLayout;
    import java.awt.Color;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextField;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    class test extends JFrame {
         private JTabbedPane tabbedPane;
         private JPanel panel1;
         private JPanel panel2;
         private JPanel panel3;
         // Main method to get things started
         public static void main(String args[]) {
              // Create an instance of the test application
              test mainFrame = new test();
              mainFrame.setVisible(true);
         public test() {
              // NOTE: to reduce the amount of code in this example, it uses
              // panels with a NULL layout. This is NOT suitable for
              // production code since it may not display correctly for
              // a look-and-feel.
              setTitle("Tabbed Pane Application");
              setSize(300, 200);
              setBackground(Color.gray);
              JPanel topPanel = new JPanel();
              topPanel.setLayout(new BorderLayout());
              getContentPane().add(topPanel);
              // Create the tab pages
              createPage1();
              createPage2();
              // Create a tabbed pane
              tabbedPane = new JTabbedPane();
              tabbedPane.addTab("Page 1", panel1);
              tabbedPane.addTab("Page 2", panel2);
              topPanel.add(tabbedPane, BorderLayout.CENTER);
              tabbedPane.addChangeListener(new ChangeListener() {
                   // This method is called whenever the selected tab changes
                   public void stateChanged(ChangeEvent evt) {
                        JTabbedPane pane = (JTabbedPane) evt.getSource();
                        // Get current tab
                        int sel = pane.getSelectedIndex();
                        if (sel == 1) {
                             JDialog dial = new JDialog();
                             dial.setModal(true);
                             dial.setVisible(true);
         public void createPage1() {
              panel1 = new JPanel();
              panel1.setLayout(null);
              JLabel label1 = new JLabel("Username:");
              label1.setBounds(10, 15, 150, 20);
              panel1.add(label1);
              JTextField field = new JTextField();
              field.setBounds(10, 35, 150, 20);
              panel1.add(field);
              JLabel label2 = new JLabel("Password:");
              label2.setBounds(10, 60, 150, 20);
              panel1.add(label2);
              JPasswordField fieldPass = new JPasswordField();
              fieldPass.setBounds(10, 80, 150, 20);
              panel1.add(fieldPass);
         public void createPage2() {
              panel2 = new JPanel();
              panel2.setLayout(new BorderLayout());
              panel2.add(new JButton("North"), BorderLayout.NORTH);
              panel2.add(new JButton("South"), BorderLayout.SOUTH);
              panel2.add(new JButton("East"), BorderLayout.EAST);
              panel2.add(new JButton("West"), BorderLayout.WEST);
              panel2.add(new JButton("Center"), BorderLayout.CENTER);
    }On jdk1.5 when I press the 2nd tab, the popup is displayed but the tab 2 is only displayed when I close the popup.
    On jdk1.6 when I press the 2nd tab, the popup is displayed and tab 2 is also displayed even when I don't close the popup.
    Does anyone had this kind of problem ?
    I would expect to have the same behaviour on 1.5 and 1.6..
    Is there any workaround to display the 2nd tab only when popup is close on jdk 1.6 ?
    Regards
    Tiago

    It can easily be solved by inelegant kludge.
    class test extends JFrame
      private JTabbedPane tabbedPane;
      private JPanel panel1;
      private JPanel panel2;
      private JPanel panel3;
      private boolean dlgShown = false; // *** class variable
        tabbedPane.addChangeListener(new ChangeListener()
          public void stateChanged(ChangeEvent evt)
            JTabbedPane pane = (JTabbedPane) evt.getSource();
            int sel = pane.getSelectedIndex();
            if (sel == 1)
              if (!dlgShown) // ***
                pane.setSelectedIndex(0); // ***
                JDialog dial = new JDialog();
                dial.setModal(true);
                dial.setPreferredSize(new Dimension(200, 100));
                dial.pack();
                dial.setLocationRelativeTo(null);
                dial.setVisible(true);
                dlgShown = !dlgShown; // ***
                pane.setSelectedIndex(1); // ***
              else
                dlgShown = !dlgShown;
    }note: more elegant solutions most welcome!

Maybe you are looking for

  • How to use power query with sitecatalyst

    Hello, I need to use power query to import a table from sitecatalyst. Doing some tests I found that If remove the session from the url that has the report parameters, the app will redirect me to the login page, after entering the company, username an

  • Is it better to leave my Macbook plugged in most of the time or not?

    I've read different answers on the internet. Some people say that keeping your macbook plugged in is like not using the battery at all. Others say that keeping it plugged in most of the time is bad for the battery, for various reasons, either it make

  • EBS 11.5.10.2 Dev6i upgrade

    OS: Linux x86 RH REL4 DB: 10.2.0.4 EBS: 11.5.10.2 Dev6i: Upgrading from Patch 18 to Patch 19 I am following MOS note "Upgrading Developer 6i with Oracle Applications 11i [ID 125767.1]" and trying to figure out the order of the patches. When exactly t

  • Execute without refresh

    can i execute a query without refresh? I try create database sample1 and execute it but sample1 does not appear without refreshing the databases?

  • CS4 Typography?

    One of (several) complaints I've had with Flash over the years has been the lack of any decent typography. Adobe pioneered this area, I'd have thought that was one of the first things they'd have done when acquiring Flash from MM. In all the marketin