Form inside Tabbed Pane

Hi, I have a JSF Tabbed Pane with 5 tabs and one of the tab's content contains a datascroller with an input text field 'Go To' where the user can enter the page number to jump to. When I hit enter after typing in a page number, it seems like it just refreshes the page (I think it processes as a Tabbed Pane 'tabchangeevent' but in fact it's not). However, after typing in a page number, and manually clicking the 'Go' button, it submits correctly (to the datascroller) and displays the correct content. Any ideas what could be the problem?

I would try using static, compile time includes rather than runtime includes.

Similar Messages

  • Tabbed Panes

    Dear All,
    I have to create a form with tabbed panes. How can i do this using JFC as i m new to JFC. Then i have to submit the form data in the database using JSP. Please help me to solve this.
    Some Code Please
    Thanks & Regards
    Gagan

    gaganarora77,
    This does seem a case of RTFM:
    http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html
    Please repost if you have specific problems
    --A                                                                                                                                                                                                                                                                                                                                                           

  • Adding more rows in a html table(enclosed inside a jsf tabbed pane)

    hi,
    i m facing a problem. i have a html Table inside a jsf Tabbed Pane and a button to add more rows.whenever i click on the button it should add 5 more rows to the table using javscript.
    can anyone hlp me in solving this problem.
    thankx in advance

    Use the elegant JSF h:dataTable instead of plain HTML table with a heap of DOM stuff.

  • Tabbed panes inside panels!!! (not dialogs)

    hello,
    i want to have tabbed panes inside panels. is this possible? if yes, how?

    It seems the best solution to this issue is to ditch the Spry Tabbed Panel and use a javascript tabbed panel. User971824 in Stack Overflow explained the problem as follows:
    "I had this issue and it's because your gallery is hidden on page load so the plugin cannot read the container width and height in order for it to render properly. Instead of initializing the plugin on page load initialize it when the user clicks on the tab. If you have any animation on the tab windows makes sure you initialise flexslider after the animation is complete."
    "You are using spryTabbedPanels for your tabbed pages. I looked at the API and they dont seem to have an animation complete function so until you sort out that end you wont be able to fix it. You need a way to detect once the panel has shown so that you can initialize the carousel."

  • 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.

  • Disposable tabbed pane redrawing

    Hi, i'm using disposable tabbed panes (with close button) in my program and i'm using following method to update their titles according to what user entered:
    //this is class extending JPanel
    public void updatePanelTitle(String newTitle) {
            MainPanel panel = (MainPanel) getParent(); //MainPanel extends JTabbedPane
            panel.setTitleAt(panel.getComponentZOrder(this)-1, newTitle);
            repaint();
        }Point is the title gets changed but the size of panel label does not. However, when i mouse-over the close button there, it gets changed to the size of the text.
    @Override
            public void mouseEntered(MouseEvent e) {
                Component component = e.getComponent();
                if (component instanceof AbstractButton) {
                    AbstractButton button = (AbstractButton) component;
                    button.setBorderPainted(true);
            }setBorderPainted calls inside the repaint method.
    Can anyone give a clue why it is not working or how to fix it?
    Regards,
    Marek

    Well its quite big but if it helps, this is the panel class:
    package presentationTier.view;
    import com.bbgroup.ui.Console;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextField;
    import javax.swing.border.Border;
    import javax.swing.text.BadLocationException;
    import presentationTier.Model.Properties;
    import presentationTier.Model.PropertyInterface;
    import presentationTier.Model.StandardInputOutput;
    import presentationTier.controller.ConfirmListGeneratorAction;
    import presentationTier.controller.ConfirmSearchReplaceAction;
    import presentationTier.controller.OpenBrowseDialogAction;
    * @author marek
    public class ListGeneratorPanel extends JPanel implements StandardInputOutput, PropertyInterface {
        private JLabel labStartPath,  labExtensions;
        private JTextField txtStartPath,  txtExtensions;
        private JButton butBrowse,  butGo;
        private Console console;
        private GridBagConstraints c;
        private Insets labelInsets,  normalInsets;
        public ListGeneratorPanel() {
            super(new GridBagLayout());
            initComponents();
            borderCompononets(BorderFactory.createLoweredBevelBorder());
            resetConstraints();
            c.gridx = 0;
            c.gridy = 0;
            c.insets = labelInsets;
            add(labStartPath, c);
            c.gridx = 1;
            //c.gridwidth = 1;
            c.weightx = 1;
            c.insets = normalInsets;
            add(txtStartPath, c);
            c.gridx = 2;
            //c.gridwidth = 1;
            c.weightx = 0;
            add(butBrowse, c);
            c.gridx = 0;
            c.gridy = 1;
            c.weightx = 0;
            c.insets = labelInsets;
            add(labExtensions, c);
            c.gridx = 1;
            //c.gridwidth = 3;
            c.weightx = 1;
            c.insets = normalInsets;
            add(txtExtensions, c);
            c.gridx = 2;
            c.gridwidth = 1;
            //c.gridheight = 1;
            c.weightx = 0;
            add(butGo, c);
            c.gridx = 0;
            c.gridy = 2;
            c.gridwidth = 5;
            c.weighty = 1;
            add(new JScrollPane(console), c);
            resetConstraints();
        private void initComponents() {
            c = new GridBagConstraints();
            console = new Console(true);
            labelInsets = new Insets(5, 5, 0, 0);
            normalInsets = new Insets(5, 5, 0, 5);
            labStartPath = new JLabel("Search under:");
            labExtensions = new JLabel("File types:");
            txtStartPath = new JTextField();
            txtExtensions = new JTextField();
            butBrowse = new JButton(new OpenBrowseDialogAction(this));
            butGo = new JButton(new ConfirmListGeneratorAction(this));
        private void borderCompononets(Border b) {
            getTxtStartPath().setBorder(b);
            getTxtExtensions().setBorder(b);
        private void resetConstraints() {
            c.ipadx = 0;
            c.ipady = 0;
            c.gridwidth = 1;
            c.gridheight = 1;
            c.weightx = 0;
            c.weighty = 0;
            c.fill = GridBagConstraints.BOTH;
            c.anchor = GridBagConstraints.FIRST_LINE_START;
            c.insets = normalInsets;
        public Properties createProperties() {
            Properties p = new Properties();
            p.setSout(this);
            p.setStartPath(getTxtStartPath().getText());
            p.setExtensions(getTxtExtensions().getText());
            return p;
         * @param line
         * @throws BadLocationException
        public void echo(String line) throws BadLocationException {
            getConsole().echo(line);
         * @param line
         * @param style
         * @throws BadLocationException
        public void echo(String line, String style) throws BadLocationException {
            getConsole().echo(line, style);
        public void drawSeparator() throws BadLocationException {
            getConsole().drawSeparator();
        public void passBrowsedFilePath(String browsedFilePath) {
            getTxtStartPath().setText(browsedFilePath);
        public void updatePanelTitle(String newTitle) {
            MainPanel panel = (MainPanel) getParent();
            panel.setTitleAt(panel.getComponentZOrder(this) - 1, "Generate: " + newTitle);
            updateUI();
            repaint();
        public Console getConsole() {
            return console;
        public JTextField getTxtStartPath() {
            return txtStartPath;
        public JTextField getTxtExtensions() {
            return txtExtensions;
    }When you add instance of this to your JTabbedPane, you will get closeable Tabbed Pane with title you specified in addTab(title, component);
    I implement method updatePanelTitle(String newTitle); to change the title of this tab when suer submits the data. These action controllers that call submitting and updating title are in controller package. Problem is that the title itself is changed when data are submitted but the <b>size of the tab is not adjusted to newTitles length.</b> It is just adjusted when i pull my mouse over the close button that implements action from previous post. It's in this class:
    package com.bbgroup.ui;
    import javax.swing.*;
    import javax.swing.plaf.basic.BasicButtonUI;
    import java.awt.*;
    import java.awt.event.*;
    * Component to be used as tabComponent;
    * Contains a JLabel to show the text and
    * a JButton to close the tab it belongs to
    public class DisposableTabPanel extends JPanel {
        private final JTabbedPane pane;
        public DisposableTabPanel(final JTabbedPane pane) {
            //unset default FlowLayout' gaps
            super(new FlowLayout(FlowLayout.LEFT, 0, 0));
            if (pane == null) {
                throw new NullPointerException("TabbedPane is null");
            this.pane = pane;
            setOpaque(false);
            //make JLabel read titles from JTabbedPane
            JLabel label = new JLabel() {
                @Override
                public String getText() {
                    int i = pane.indexOfTabComponent(DisposableTabPanel.this);
                    if (i != -1) {
                        return pane.getTitleAt(i);
                    return null;
            add(label);
            //add more space between the label and the button
            label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
            //tab button
            JButton button = new TabButton();
            add(button);
            //add more space to the top of the component
            setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
        private class TabButton extends JButton implements ActionListener {
            public TabButton() {
                int size = 17;
                setPreferredSize(new Dimension(size, size));
                setToolTipText("Close this tab");
                //Make the button looks the same for all Laf's
                setUI(new BasicButtonUI());
                //Make it transparent
                setContentAreaFilled(false);
                //No need to be focusable
                setFocusable(false);
                setBorder(BorderFactory.createEtchedBorder());
                setBorderPainted(false);
                //Making nice rollover effect
                //we use the same listener for all buttons
                addMouseListener(buttonMouseListener);
                setRolloverEnabled(true);
                //Close the proper tab by clicking the button
                addActionListener(this);
            public void actionPerformed(ActionEvent e) {
                int i = pane.indexOfTabComponent(DisposableTabPanel.this);
                if (i != -1) {
                    pane.remove(i);
            //we don't want to update UI for this button
            public void updateUI() {
            //paint the cross
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                Graphics2D g2 = (Graphics2D) g.create();
                //shift the image for pressed buttons
                if (getModel().isPressed()) {
                    g2.translate(1, 1);
                g2.setStroke(new BasicStroke(2));
                g2.setColor(Color.BLACK);
                if (getModel().isRollover()) {
                    g2.setColor(Color.MAGENTA);
                int delta = 6;
                g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);
                g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);
                g2.dispose();
        private final static MouseListener buttonMouseListener = new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
                Component component = e.getComponent();
                if (component instanceof AbstractButton) {
                    AbstractButton button = (AbstractButton) component;
                    button.setBorderPainted(true);
            @Override
            public void mouseExited(MouseEvent e) {
                Component component = e.getComponent();
                if (component instanceof AbstractButton) {
                    AbstractButton button = (AbstractButton) component;
                    button.setBorderPainted(false);
    }I cant possibly post a running code as it uses third party libraries and implements bunch of interfaces, it would require whole nearly whole view-controller part of the project.
    Another problem is that method getComponentZOrder(this) - 1, works for retrieving all tabs except the first one (it returns fine indexes for any tab but -1 for the first one) but sadly there is no such method like getIndex(Component) which would be useful for getting <b>this</b> components index.
    Thanks in advance for ideas.
    Regards, Marek

  • 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??

  • Multiple forms inside a tabset

    I have a tabset inside a main form. Is it possible to have another forn inside individual tabs?
    When I put another form inside a tab, tabset gets stuck on single tab and you unable to click through the tabs.
    Thanks in advance for your help.

    Hi,
    I tried adding a form component to the tab set. The form component appears as a new form node for the page. The IDE creates a form for you when it creates a new page, so you are not required to add this component to a page created by the IDE. If you need a form within a form, you must create a virtual form instead. You can right-click a component and choose Configure Virtual Forms to create a new virtual form or to add the component to an existing virtual form.
    If you do add a form component to a page, you see the form appear as a selected box and a new form node for your page appears in the Outline window. You can select the form in the Outline window, and then you can drag components onto the form.
    Perhaps the following on virtual forms might help :
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/virtual_form.html

  • Adobe Form inside a Tabstrip

    Hello,
    I'm using a Tabstrip but when I put inside a tab an adobe form it doesn't shows anything. I'm not sure if this object (TabStrip) support an adobe form inside.
    Please anyone knows?
    Thanks
    Regards
    SU

    sorry, i found out the reason.
    the fm can not test direct in se37, it should be wrapped by a program.
    br.
    zj

  • IBM tabbed pane usage

    In my JSF project, I have a jsp page, where i am using a IBM tabbed pane component. I am using the same form for both creating new data and updating existing data.
    When I click on the tabbed pane, it is on the client side.So, there is no request involved. In such a case, if I have to pass some values from one tab to another, how do i do this?
    Also, when I retrieve data from the database, i need to prepopulate the drop downs in the second tab with values from the database and values from the first tab. Is this possible? How do I do this?

    Your question is not related with odc:tabbedPanel. For passing params in between tabs you should use a faces-managed bean. And for populating drop downs, how is the drop down in first tab getting populated? Let me assume, from a faces-managed bean or a from service-layer method that retrieves data from db. So either way you have no relation with bfPanels in these processes.
    Regards,
    Mert
    http://www.jroller.com/page/mert

  • Tabbed pane vs swf file

    Hi,
    I am writing my tabbed pane as
    <mx:TabNavigator>
    <mx:VBox>...................</mx:VBox>
    <mx:VBox>...................</mx:VBox>
    <mx:VBox>...................</mx:VBox>
    </mx:TabNavigator>
    I want to put wipe effect ot my tabbed pane when we change
    the tabbes. I dont find any examples for that, so i have one plan.
    I want to disply one swf file on the vboxes when we change the tab
    from onto anoterh can we show one .swf file on the vbox, that swf
    will have continious wiping effects. I dont know this posibility
    level!. If so, can we specify any divs on the form? is it correct
    idea?
    Thanks
    Satish KC.

    If you are running Flex 2.0, then you can put showEffect and
    hideEffect
    effect triggers on each VBox. (I don't remember if this works
    in beta3)
    <mx:VBox showEffect="WipeLeft" hideEffect="WipeRight">
    If using Flex 1.5, then set the creationPolicy of the
    TabNavigator to "all"
    and try playing around with the changeEffect on the TabNav.
    Jason Szeto
    Adobe Flex SDK Developer
    "j2eesatish" <[email protected]> wrote in
    message
    news:e7egct$8o5$[email protected]..
    > Hi,
    > I am writing my tabbed pane as
    > <mx:TabNavigator>
    > <mx:VBox>...................</mx:VBox>
    > <mx:VBox>...................</mx:VBox>
    > <mx:VBox>...................</mx:VBox>
    > </mx:TabNavigator>
    > I want to put wipe effect ot my tabbed pane when we
    change the
    > tabbes. I
    > dont find any examples for that, so i have one plan. I
    want to disply one
    > swf
    > file on the vboxes when we change the tab from onto
    anoterh can we show
    > one
    > .swf file on the vbox, that swf will have continious
    wiping effects. I
    > dont
    > know this posibility level!. If so, can we specify any
    divs on the form?
    > is it
    > correct idea?
    >
    >
    > Thanks
    > Satish KC.
    >

  • Problems on tabbed pane

    Hi
    I want to design Top navigation using tabbed pane. I designed tabbed pane using <rich:tabPanel> and <rich:tab>.this page is common for all the pages. so i want to add some body while adding to another pages.if i am giving body it will display outside the body of rich tabpanel. i want to display my body information if no tabs are selected if i selected any tab tab information also display in the same place....how can i do that...
    Thanks in Advance
    mohan.

    use any plain text or html inside <f:verbatim> it will display under the pane.
    Please use ths following forum for the richfaces related questions:
    http://www.jboss.com/index.html?module=bb&op=viewforum&f=261
    Message was edited by:
    KrishnaS

  • Changin tabbed pane using a JButton

    Hi all,
    I'm trying to include a button on a tabbed page that will enable you to switch to
    another page.
    I'm using the following code:
    FlyProGen.addActionListener( new ActionListener()
         public void actionPerformed( ActionEvent e )
              tabbedpane.setSelectedComponent( container );
    However, I get the following error: "Cannot refer to a non-final variable tabbed pane inside
    an inner class defined in a different method".
    Help!
    best wishes
    Paul

    Paul,
    This discussion seems to pertain to your issue:
    http://oldlook.experts-exchange.com:8080/Programming/Programming_Languages/Java/Q_20718075.html
    Chip McCormick

  • Overlapping tabbed pane objects upon startup

    I have a swing app built with Sun ONE Studio 4, I have several jTabbedPane's in the main form and upon start up, components from other tabbed panes are visible until I go through and click each tabbed pane. Any help is appreciated.

    Don't use Sun One Studio. ;) Can't stand the lack of control/knowledge of what is going on with GUI builders! Much prefer using TableLayout and coding it myself! TableLayout is so easy to use, very fast.

  • Hiding tabbed panes-should be enabled only on certain event

    Hi,
    I desperately need help. I'm still new to swings and thus need help.I'm writing an swing application where i have tabbed panes just like a tree i.e
    main1,main2
    under main1 have have another set of tabbed panes. Now i have to enable only the first pane and inside that pane there is a button which should enable the other pane and so forth. I just cannot figure how i should go about doing it. Any help is appreciated.
    ashah

    I tried doing that the new problem that i came across is that -
    here is the sample of the code. This is on the similar lines like i have written the code
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    public class tabbedPaneDemo extends JPanel
    JTabbedPane tabbedPane = new JTabbedPane();
    JPanel panel1 = new JPanel();
    JPanel mainPanel1 = new JPanel();
    public tabbedPaneDemo()
    Component panel1 = makePanel1();
    tabbedPane.addTab("Panel1", panel1);
    tabbedPane.setSelectedIndex(0);
    setLayout(new GridLayout(1, 1));
    add(tabbedPane);
    Component makePanel1()
         JButton next = new JButton("Next");
         buttonListener listener = new buttonListener();
         next.addActionListener(listener);
         mainPanel1.add(next);
         return mainPanel1;
    class buttonListener implements ActionListener
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == "Next")
                   tabbedPane.removeTabAt(0);
                   tabbedPane.addTab("Panel2",null,makePanel2());
                   tabbedPane.setSelectedIndex(0);
                   JButton next1 = new JButton("Next1");
                   buttonListener listener = new buttonListener();
                   next1.addActionListener(listener);
                   panel1.add(next1);
              if(e.getSource() == "Next1")
                   tabbedPane.setEnabledAt(0,false);
                   tabbedPane.addTab("Panel3",null,makePanel3());
                   tabbedPane.setSelectedIndex(1);
    Component makePanel2()
         return panel1;
    Component makePanel3()
         JPanel mainPanel = new JPanel();
         return mainPanel;
    public static void main(String args[])
         tabbedPaneDemo demo = new tabbedPaneDemo();
         JPanel p = new JPanel(new BorderLayout());
         p.add(demo,BorderLayout.NORTH);
         JFrame frame1 = new JFrame("TabbedPaneDemo");
         frame1.addWindowListener(new WindowAdapter()
         public void windowClosing(WindowEvent e)
              System.exit(0);
         frame1.getContentPane().add(p, BorderLayout.CENTER);
         frame1.setSize(400, 125);
    frame1.setVisible(true);
    I know there is a very simple mistake that i'm making but i can't figure where.

Maybe you are looking for