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.

Similar Messages

  • Make a component invisible after all tabs in a tabbed pane are closed

    Hi,
    I am using a tabbed pane and open images in tabs. I want to disable a comonent after i find all the tabs of the tabbed pane closed and when all the tabs are closed the tab pane should also be closed.
    Please help me.

        TabPane tabPane = new TabPane();
        tabPane.getTabs().addListener(new ListChangeListener<Tab>() {
          @Override
          public void onChanged(
              javafx.collections.ListChangeListener.Change<? extends Tab> c) {
            if (tabPane.getTabs().isEmpty()) {
             // whatever you need here:
             // somePane.getChildren().remove(tabPane);
             // someControl.setDisable(true);
        });

  • How can I create a smart folder that only searches one event?

    Is it possible to create a smart album but have it not search my entire library, but only a certain event?
    I have created a smart album to find unnamed faces, but I have many old pictures in my library with strangers in them so the smart album ends up quite large. If I could apply the rules of the smart album to only one event at a time I could find the photos i need with no faces recognized in them easier right after I import them.
    Or conversely, is there a fast way to delete all the unnamed faces boxes for all my pictures with strangers in them- there must be a faster way than going through and clicking the 'X' on each individual face.
    Thanks!

    Make the criteria: Event Contains XXXXXXX and Faces is unnamed.  That will search only that Event.
    OT

  • Tabbed Pane Enabling Color

    How Can I change TAbbed PAne Enabling Color ???
    Default color is gray and it's not very nice ...
    Thanks!

    Here it is with your line added. If this doesn't adequately demonstrate your requirements (the disabled tab color is orange), you're going to have to be a little more descriptive.
    import javax.swing.*;
    import java.awt.*;
    class JTabbedPaneDemo extends JFrame {
        public static void main(String[] args) {
            new JTabbedPaneDemo().go();
        void go() {
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setSize(300, 150);
            UIManager.put("TabbedPane.selected", Color.GREEN);
            JPanel panel1 = new JPanel();
            panel1.setBackground(Color.BLUE);
            panel1.add(new JLabel("Foo"));
            JPanel panel2 = new JPanel();
            panel2.setBackground(Color.MAGENTA);
            panel2.add(new JLabel("Bar"));
            JTabbedPane tabs = new JTabbedPane();
            tabs.addTab("Tab 1", panel1);
            tabs.addTab("Tab 2", panel2);
            tabs.setForegroundAt(0, Color.BLACK);
            tabs.setBackgroundAt(0, Color.GREEN);
            tabs.setForegroundAt(1, Color.RED);
            tabs.setBackgroundAt(1, Color.ORANGE);
            tabs.setEnabledAt(1, false); // Here you go, lazybones.
            getContentPane().add(tabs);
            getContentPane().setBackground(Color.YELLOW);
            setVisible(true);
    }

  • Help w/tabbed pane -- URGENT!

    i'm developing a program that will open up documents and put them in a tabbed pane. One thing that i have learned is that setting the text of a component inside of a tabbed pane is easier than getting the text back from it when the user goes to save.
    public void addDoc(String text, String title, String toolTipTab) {
    textArea = new JTextArea();
    textArea.setTabSize(2);
    textArea.setText(text);
    JScrollPane scrollPane = new JScrollPane(textArea);
    tabbedPane.addTab(title, scrollPane);
    tabbedPane.setSelectedComponent(scrollPane);
    what i would like to do is to get the text from the JTextArea() and save it. I have tried the follwoing
    tabbedPane.getSelectedComponent().textArea.getText();
    but that doesn't work. Also just using textArea.getText(); doesn't work because it will only get the newly opened document. Also if i can solve this, then i can implement Cut Copy Paste and Select All
    thanks

    i'm developing a program that will open up documents
    and put them in a tabbed pane. One thing that i have
    learned is that setting the text of a component inside
    of a tabbed pane is easier than getting the text back
    from it when the user goes to save.
    public void addDoc(String text, String title, String
    toolTipTab) {
    textArea = new JTextArea();
    textArea.setTabSize(2);
    textArea.setText(text);
    JScrollPane scrollPane = new JScrollPane(textArea);
    tabbedPane.addTab(title, scrollPane);
    tabbedPane.setSelectedComponent(scrollPane);
    what i would like to do is to get the text from the
    JTextArea() and save it. I have tried the follwoing
    tabbedPane.getSelectedComponent().textArea.getText();
    but that doesn't work. Also just using
    textArea.getText(); doesn't work because it will only
    get the newly opened document. Also if i can solve
    this, then i can implement Cut Copy Paste and Select
    All
    thanksWhy not keep one copy of the text area in class scope, so for example:
    public class MyClass {
    private JTextArea textArea = null;
      public void addDoc(String text, String title, String
      toolTipTab) {
      textArea = new JTextArea();
      textArea.setTabSize(2);
      textArea.setText(text);
      JScrollPane scrollPane = new JScrollPane(textArea);
      tabbedPane.addTab(title, scrollPane);
      tabbedPane.setSelectedComponent(scrollPane);
      public String getText() throws BadLocationException {
       return textArea.getDocument().getText(0,textArea.getDocument().getLength());
    }Am I understanding your problem correctly?
    I think this should return what you need.
    Dan Hughes

  • How to a particular panel in a tabbed pane to the front?

    Hello
    I have a small application that uses a tabbed pane. At some point I want to press a button in one of the panels of the tabbed pane and then another panel in the same tabbed pane to show up, as if I had clicked on that tab to bring it to the front.
    Only difference is I don't want to click on the tab to do it but on another button, so I can do some more stuff through the button before I bring the other panel to the front
    I thought I could do this by getting focus, but it seems not to be the case. Getting focus does not mean coming to the front as I originally thought.
    I hope this is clear. Here is an example that you can compile and run. I want to get jpanel2 to the front by clicking jbutton1 and vice versa.
    Any help appreciated.
    (Frame1.java)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Frame1 extends JFrame {
        private JTabbedPane jTabbedPane1 = new JTabbedPane();
        private JPanel jPanel1 = new JPanel();
        private JPanel jPanel2 = new JPanel();
        private JButton jButton1 = new JButton();
        private JButton jButton2 = new JButton();
        private JTextField jTextField1 = new JTextField();
        private JTextField jTextField2 = new JTextField();
        public Frame1() {
            try {
                jbInit();
                this.setDefaultCloseOperation(EXIT_ON_CLOSE);
                setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
        private void jbInit() throws Exception {
            this.getContentPane().setLayout( null );
            this.setSize( new Dimension(400, 300) );
            jTabbedPane1.setBounds(new Rectangle(0, 0, 395, 270));
            jPanel1.setLayout(null);
            jPanel2.setLayout(null);
            jButton1.setText("jButton1");
            jButton1.setBounds(new Rectangle(20, 170, 160, 25));
            jButton1.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            jButton1_actionPerformed(e);
            jButton2.setText("jButton2");
            jButton2.setBounds(new Rectangle(20, 135, 160, 25));
            jButton2.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            jButton2_actionPerformed(e);
            jTextField1.setBounds(new Rectangle(55, 45, 210, 20));
            jTextField2.setBounds(new Rectangle(95, 50, 180, 20));
            jPanel1.add(jTextField1, null);
            jPanel1.add(jButton1, null);
            jTabbedPane1.addTab("jPanel1", jPanel1);
            jPanel2.add(jTextField2, null);
            jPanel2.add(jButton2, null);
            jTabbedPane1.addTab("jPanel2", jPanel2);
            this.getContentPane().add(jTabbedPane1, null);
        private void jButton1_actionPerformed(ActionEvent e) {
        private void jButton2_actionPerformed(ActionEvent e) {
        public static void main(String[] args) {
            new Frame1();
    }

    tabbedPane.setSelectedIndex(...);

  • Problem hiding Tabs in Tabstrip of My Trips and Expenses WD ABAP iView

    Hi,
    My requirement is to hide the thet tabs ALL MY Trips,All my Travel REquest,All my travel Plans,Pending expense report from the tabstrip ALl my Expense report in Travel and Expense Application.
    I have gone through the thread and the sap note mentioned in
    Re: Problem hiding Tabs in Tabstrip of My Trips and Expenses WD ABAP iView
    My problem is tabs that has to be deleted /hidden does not present in the Development system, but exist in the QA or the prd system.
    So how to implement the note when data is not present in the dev system and only exist in the QA/PRD system.
    Pleas eprovide me your valuable inputs.
    Thanks in advance.
    Pooja

    Implemneted the note and problem is solved.

  • How To use JFile Chooser in a Tabbed Pane Dialog

    I have created a tabbed pane dialog. In one of the tabs I want to add a JFile Chooser.
    How can I approach this problem. also Do I have to use a JDialog with a frame or can I create a JDialog without using a frame and create a instance from the main function.

    I have created a tabbed pane dialog. In one of the
    tabs I want to add a JFile Chooser. Since JFileChooser is a JComponent you could add it to any Container like any other JComponent.
    Maybe you have to do some init by hand which is done normally by the show*() methods of JFileChooser. Taking a look at the source of showDialog() should help.
    Hope that helps,
    Alex

  • MIRO should be allowed only for the accepted Qty (QC accepted qty)

    Hi Friends
    I have one more requirement ,
    MIRO should be allowed only for the accepted Qty (QC accepted qty) or Subcontract MIRO should be allowed only for the quantity accepted by QC
    with QM control key in material master(QM view) we can block for payment,
    but  my query is  MIRO should not be saved (message should come qty still lying in Quality inspection stock)
    Please let me know the settings,
    Thanks & Regards
    Gajendranath

    Hii,
    Yes it is possible to restrict Invoice passing in MIRO if the Stock is in Quality stock / Blocked stock. The concept is while doing MIRO, u can validate the criteria by clicking simulation tab. U can get the things in BADI (Business ad in function) with the BADI object name as "Invoice_update".
    The working is when the material is in quality stock & If ur doing MIRO for the same material, then system will pop up the message that "material with "X" qty is in quality stock" Invoice cannot be made. System does'nt allow u to pass the Invoice unless the stock is cleared from the quality. Even for the blocked stock we can simulate these error pop message.
    with regards,
    K.Lokesh.

  • Multiple Views of Same Rows from a Tabbed Pane

    I have a Tabbed Pane with several Tabs that access Different Tables. One Table is the child of two different Tables, ie one foreign key on the child that that points to Table A and a second foreign key on the child that points to Table B. I am trying to have a tabbed pane that will show the childs rows one based on the Table A Foreign Key and the second based on the Table B Foreign Key.
    No matter what I have tried, I get only one view from both Tabs. (NOTE: Both of the Tabbed pane that I instantiate from look completly different, ie a different sequence of fields.)
    I have two distinct rowsetinfo's for each tab each with it own distinct Query. I have each MasterLink pointing to the appropriate Master, either Table A or Table B and it doesn't work.
    I have tried to create additional Business components for the second view, but don't know how to link the rowset to the appropriate Business Component, if that's the problem.
    Any help or suggestion would be greatly appreciated, because I'm Lost.

    hi
    i've tried to do that some time ago and i had to give up... unfortunately i think java3D can't use various rendering modes for the same universe
    regards
    GnG

  • Tab pane height minimum / inconsiste​nt behaviour

    Hi,
    I run into a small but annoying issue with tab controls. (LabView2009f2)
    I want to set the height of the tab control as small as possible.
    - Using property nodes (as in attached example) the minimum height is 31 pixels. With 30 pixels and below an error message is shown ("invalid value").
    - Using the property dialog for the tab I can set height to 1 and setting will be accepted. However after re-opening the dialog the height is changed to 5.
    - After manually setting height to 5, the tab height changes back to 31 as soon as any of the tab properties is changed (like number of tabs, their names, and so on...) - annoying!
    - It doesn't matter if I'm using a classic or a modern style tab.
    So my questions:
    Why is the behaviour inconsistent between changing properties manually and programmatically?
    Why does the tab control allow a height of 5 pixels (atleast by manual setting), but doesn't maintain it afterwards?
    The quick&dirty workaround is to draw a decoration above the tab pane, but using just one property node would be much cleaner...
    Message Edited by GerdW on 11-05-2009 01:46 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    TabPaneHeight.vi ‏9 KB

    Hi,
    thank you for descriping your problem so detailed.
    I've told our R&D department about that. If you want to know about the status you can call the NI Support and ask for information on CAR #195219.
    Actually I don't know when this behaviour will be fixed or if there are only a more detailed informations in the documentation with a minimum value for the tab panel height.
    Sorry I can't tell you more about that right now.
    Thanks for reporting this to us.
    Regards,
    Schilli

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

  • Hyperlink on fields to be enabled only after drilling down

    Hello,
    I am facing a issue with drill down on OBIEE 10g. The issue is as below:
    We have a geography hierarchy - Theater -> country -> state -> city.
    Summary report for Orders will have the total $ value for the entire month. The summary report starts from the theater level and user can drill down to the city level Total $.
    User wants a hyperlink on the total$. When user clicks on the $ value it should take the user to a detail report, that will show the individual orders that make up the total $.
    But the User wants the hyperlink to be enabled only when he has drilled down to the city level.
    Is there a way to achieve this? Please let me know.
    Thanks
    Vin

    Hey,
    there is a way to achieve that but it's not pretty instead of drill down create four reports top report only theater and total second theater,country and total third report theater,country,state and total and the final report all the 4 and total and keep navigate option on each reports in the final report hyper link total if the user is ok with this way try it.

  • 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

  • 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

Maybe you are looking for

  • Error while closing the seeded form

    Hello All, When I try to close the forms like Batches, Batches Summary,Transactions,Transactions Summary,Credit Transactions,Copy Transactions in the Transactions submenu of AR,I am getting "no data found" error for all these forms. Please suggest me

  • Issue in Consuming Rest/JSON Service from Netweaver gateway system

    Hello Experts, We are trying to consume the Rest/JSON web service from NetWeaver Gateway System. But we are getting HTTP Communication failure error. URL: 'http://sgpvmc0031.apac.bosch.com/ActivityManager2/rest/v1/query/employees/amh1sgp/workItems/pe

  • My DVD player stopped playing sound. How to  fix it?

    I can't get sound on DVDs in my DVD Player. Any suggestions how to fix it? The picture is fine but no sound on any DVD.

  • FINAL CUT PRO 5.1.4 Sync (Drifting) Issues shot with Canon XL2

    So basically I am still having trouble with audio sync drifting and I captured the footage correctly using the 2:3:3:2 pull down 24p and 48khz. Any suggestions anyone else can give me? The last fella suggested that I should CHANGE the speed of the au

  • Thunar No Suitable Archive Manager Found

    Hi all i just updated my system to xfce 4.4.1-1 thunar exo etc.... The archive pluggin for thunar stopped working with No Suitable Archive Manager Found. I have both xarchiver and squeeze installed. Any ideas? JD