Probs in JTabbedPane

I have three textarea component in the JTabbedPane.If the user gives the input....i want to retrieve the user input....i want to retrieve all the three components at the same time.
Thanks in advance
PrabhuBalan

Why did you post yet another topic for this?
http://forum.java.sun.com/thread.jspa?threadID=609395

Similar Messages

  • Prob with JTabbedPane

    Hello everybody,
    I am not able to arrange the things in my TabbedPane.
    I have put two tabs onto the pane.
    I will paste the code, see if anybody can help.
    // This is the main program, there are two other classes in two different files.
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    * @author Akila
    public class Main extends JPanel implements ActionListener
         static JTabbedPane tabbedPane;
         public Main()
              super(new GridLayout(5, 5));
              //System.out.println("main prog");
              //System.out.println("creatin tab");
              JTabbedPane tabbedPane = new JTabbedPane();
              //System.out.println("callin tab1");
              JComponent tab1= new Tab1(tabbedPane);
              add(tab1);
              JComponent tab2= new Tab2(tabbedPane);
              add(tab2);
              add(tabbedPane);
         public static void main(String[] args)
              SwingUtilities.invokeLater(new Runnable()
                   public void run() {
                        UIManager.put("swing.boldMetal", Boolean.FALSE);
                        createAndShowGUI();
         public static void createAndShowGUI()
              JFrame frame = new JFrame("Service Software");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              //Add content to the window.
              frame.add(new Main(), BorderLayout.CENTER);
              //Display the window.
              frame.pack();
              frame.setVisible(true);
         @Override
         public void actionPerformed(ActionEvent arg0)
    }// This is Tab1. java
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextArea;
    public class Tab1 extends JPanel implements ActionListener
         JLabel name;
         JComponent tab1;
         JTextArea area;
         public Tab1(JTabbedPane jt)
              JComponent tab1=new JPanel(false);
              jt.add("Services",tab1);
              tab1.setLayout(new GridLayout(5, 5));
              name= new JLabel("Name");
              JButton sub = new JButton("Submit");
              tab1.add(sub);
              JTextArea area = new JTextArea();
              tab1.add(name);
              tab1.add(area);
              add(jt);
              sub.addActionListener(this);
              jt.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
         public void actionPerformed(ActionEvent e)
    }//This is Tab2.java
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JComponent;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextArea;
    public class Tab2 extends JPanel implements ActionListener
              public Tab2(JTabbedPane jt)
                   //System.out.println("tab1 prog");
                   JComponent tab2=new JPanel(false);
                   jt.add("New Contact",tab2);
                   tab2.setLayout(new GridLayout(5, 5));
                   JLabel name= new JLabel("Age");
                   JTextArea area = new JTextArea();
                   tab2.add(name);
                   tab2.add(area);
                   add(jt);
                   jt.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
                   public void actionPerformed(ActionEvent e)
    }So when i run this program, the tabs come in the center, and it is stretched. It doesn't look nice. I want it to look nice, The tabs should be in the beginning, and the JLabel JTextArea , Submit button should be of right size.
    Thanks in Advance.
    Akila
    Edited by: akila17 on Sep 5, 2008 10:33 PM

    Hm,
    Did you read the API of JTabbedPane ...
    If not read this tutorial how to use tabbed panes.
    Your problem is a layout problem ... grid layout is not a good choice for "nice looking" gui's
    read this turial about layouts.
    This should help you.
    Olek

  • Connection to MySQL db prob?

    Hi all
    I'm developing a 'simple demo' Java/MySQL application that uses a JTabbedPane in which different panels are added to the various tabs. (No, I dont think Im in the wrong forum, yet).
    There is no prob with connecting to the db but I'm having a prob when I click on the button that adds Contact Details to the db.
    I get the following exception which I dont understand:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
         at AddContact.actionPerformed(AddContact.java:18)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    It looks like I'm losing the db connection somewhere along the line (I think).
    The offending line of code is
    Statement statement = connection.createStatement();The code for the problem class follows
    Appreciate any help or suggestions
    Pete
    // Class AddRecord definition
    import java.awt.event.*;
    import java.sql.*;
    public class AddContact implements ActionListener {
       private ContactDetailsPane fields;
       private Connection connection;
       public AddContact( Connection c, ContactDetailsPane p)
          connection = c;
          fields = p;
       public void actionPerformed( ActionEvent e )
          try {
             Statement statement = connection.createStatement();
             if ( !fields.txtfldContactFirstName.getText().equals( "" ) &&
                  !fields.txtfldContactSurname.getText().equals( "" ) ) {
                String query = "INSERT INTO contacts (" +
                   "first_name, surname, email, phone, " +
                   "mob" + ") VALUES ('" +
                   fields.txtfldContactFirstName.getText() + "', '" +
                   fields.txtfldContactSurname.getText() + "', '" +
                   fields.txtfldContactEmail.getText() + "', '" +
                   fields.txtfldContactPhone.getText() + "', '" +
                   fields.txtfldContactMobile.getText() + "')";
                System.out.println( "\nSending query: " +
                               connection.nativeSQL( query )
                               + "\n" );
                int result = statement.executeUpdate( query );
                if ( result == 1 )
                   System.out.println( "\nInsertion successful\n" );
                else {
                   System.out.println( "\nInsertion failed\n" );
                   fields.txtfldContactFirstName.setText( "" );
                   fields.txtfldContactSurname.setText( "" );
                   fields.txtfldContactEmail.setText( "" );
                   fields.txtfldContactPhone.setText( "" );
                   fields.txtfldContactMobile.setText( "" );
             else
                System.out.println( "\nEnter at least first and " +
                               "last name then press Add\n" );
             statement.close();
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
    }

    Yeah thanks
    I system.outed the connection and fields objects. connection was null. So I went through the classes where it was used before finally getting back to the main class and found that I was passing the connection to a panel before actually establishing the connection (duh).
    Problem solved (I've been staring at this and swapping things around for hrs)
    Cheers
    Pete

  • JTabbedPane problem! its urgetnt

    this is the tabbedpanel i wanted to create but has some problem..
    the connected panels dont show their content.
    the tabbed panel shows but the linked panels dont.
    wats the prob wid it!!
    public class tabbedpane extends JApplet
    public void init()
    JTabbedPane jtp=new JTabbedPane();
    jtp.addTab("searchbook",new searchbook());
    jtp.addTab("searchmember",new searchmember());
    getContentPane().add(jtp);
    class searchbook extends JPanel
    public searchbook()
    setLayout(null);
    JTextfield txt1=new JTextField();
    setBounds(40,40,120,20);
    add(txt1);
    JRadioButton rb1=new JRadioButton("by name");
    setBounds(40,60,60,20);
    add(rb1);
    JRadioButton rb2=new JRadioButton("by author");
    setBounds(40,80,60,20);
    add(rb2);
    class searchmember extends JPanel
    public searchmember()
    setLayout(null);
    JTextfield txt2=new JTextField();
    setBounds(40,40,120,20);
    add(txt2);
    JRadioButton rb1=new JRadioButton("by id");
    setBounds(40,60,60,20);
    add(rb1);
    JRadioButton rb2=new JRadioButton("by name");
    setBounds(40,80,60,20);
    add(rb2);
    plz help!!!very urgent......

    take a look at the constructors of the classes searchbook and searchmember
    when basicaly you have multipls of following code
    Component comp = someComponent();
    setBounds(blah, blah, blah...);
    add(comp);the problem is in the set bounds call you are setting the bounds of the container not the component so the code should be corrected as
    Component comp = someComponent();
    comp.setBounds(blah, blah, blah...);
    add(comp);And please use code tags when you post codes. It is very deficult to read the code without them fortunetly for you I was in a strange mode so I read your code and that will not happen next time

  • My apps dance open and close on their own in my IPad 2 what can be the prob? I have already restored

    I got the charger flex or pin changed and now the apps dance on the screen, photos open and zoom in, then out, the other apps open and close. I have already restored the device with Itunes and prob is still there. What can be the problem? Any suggestion will be welcome. Thank you

    THANKS for your prompt reply  Bluetooth is off in my laptop and IPhone.. and in fact the reset is the only thing that can make it back to normal. But for a lil while. I wonder if it is the touch, or the home botton... both things are very expensive to replace, so I wouldn't like to spend $$ and continue having the prob.....

  • Prob in decode function

    hi iam having prob with the following decode function
    declare
    c varchar2(20);
    begin
    select decode(deptno,
         10, 'accounting',
         20,'Research',
         30 ,'sales',
         40,'operations','UNKNOWN') into c from dept where loc='DALLAS';
    dbms_output.put_line('DEPARTMENT in DALLAS'||c);
    select decode(deptno,
         10, 'accounting',
         20,'Research',
         30 ,'sales',
         40,'operations','UNKNOWN') into c from dept where loc='INDIA';
    dbms_output.put_line('DEPARTMENT IN INDIA'||c);
    end;
    iam getting no_data_found exception which is reasonable..but what happened to 'unknown' clause in decode function.
    thank u
    rajiv

    DECODE only works on rows returned from the database. If there are no rows, DECODE has nothing to work on.
    Consider:
    SQL> SELECT DECODE(dummy, 'X', 'Found a row', 'No row')
      2  FROM dual;
    DECODE(DUMM
    Found a row
    SQL> SELECT DECODE(dummy, 'X', 'Found a row', 'No row')
      2  FROM dual
      3  WHERE 1=2;
    no rows selectedIf you want to have c contain UNKNOWN when there are no rows returned, you need to do something more like:
    DECLARE
    c VARCHAR2(20);
    BEGIN
       BEGIN
          SELECT DECODE(deptno, 10, 'accounting',
                                20,'Research',
                                30 ,'sales',
                                40,'operations','UNKNOWN')
          INTO c
          FROM dept
          WHERE loc='DALLAS';
       EXCEPTION
          c := 'UNKNOWN';
       END;
       DBMS_OUTPUT.Put_Line('DEPARTMENT in DALLAS'||c);
       BEGIN
          SELECT DECODE(deptno, 10, 'accounting',
                                20,'Research',
                                30 ,'sales',
                                40,'operations','UNKNOWN')
          INTO c
          FROM dept
          WHERE loc='INDIA';
       EXCEPTION
          c := 'UNKNOWN';
       END;
       DBMS_OUTPUT.Put_Line('DEPARTMENT IN INDIA'||c);
    END;HTH
    John

  • ISE 1.2 - Multiple NICs/Load Balancing for DHCP Probe

    Hello guys
    Just prepping an ISE 1.2 patch 8 setup in our organization. I am going for the virtual appliances with multiple NICs. It will be a distributed deployment with 4 x PSNs behind a load balancer and there is no requirement for wireless or guest user at the moment. I've got 2 points I will like to get some guidance on:
    Our DC has a dedicated mgmt network and I plan to IP the gig0 interface of the PANs, MNTs and PSNs from this subnet. All device admin, clustering, config replication, etc will be over this interface. However, RADIUS/probe/other user traffic to the ISE PSNs will be over the gig1 interface which will be addressed from another L3 network. Is this a supported configuration in ISE?
    I intend to use the DHCP probe as part of device profiling and will ideally like to have just an additional ip helper to add to our switch SVI config. Also, it will appear that WLCs can only be configured for 2 DHCP servers for a given network so another consideration for when we bringing our WLAN in scope. We however use ACE load balancers within our DC and from what I have read, they do not support DHCP load balancing. Are there any workarounds to using the DHCP probe with multiple PSNs without having to add each node as an ip helper/DHCP server on the NADs?
    Thanks in advance
    Sayre

    Hello Sayre-
    For Question #1:
    Management is restricted to GigabitEthernet 0 and that cannot be changed so you should be good there
    You can configure Radius and Profiling to be enabled on other interfaces
    Even though you are not using guest services yet, you can dedicate an interface just for that. As a result, you can separate guest traffic completely from your production network
    Take a look at this link for more info:
    http://www.cisco.com/c/en/us/td/docs/security/ise/1-2/installation_guide/ise_ig/ise_app_c-ports.html
    For Question #2
    If you are using a Cisco WLC and running code 7.4 and newer you don't need to mess with the IP helper configurations. 
    The controller can be configured to act as a collector for client profiling and interact with the DHCP thread along with the RADIUS accounting task that is running on the controller. The controller receives a copy of the DHCP request packet sent from the DHCP thread and parses the DHCP packet for two options:
    –Option 12—HostName of the client
    –Option 60—The Vendor Class Identifier
    After this information is gathered from the DHCP_REQUEST packet, a message is formed by the controller with these option fields and is sent to the RADIUS accounting thread, which is in turn transmitted to the ISE in the form of an interim accounting message.
    Both DHCP and HTTP profiling settings are located under the "Advanced" configuration tab in the WLC
    On the other hand, you can also use Anycast for profiling. You can check out some of Cisco Live's sessions for more info on that. Here is one that is from a couple of years (There are more recent ones that are available as well):
    http://www.alcatron.net/Cisco%20Live%202013%20Melbourne/Cisco%20Live%20Content/Security/BRKSEC-3040%20%20Advanced%20ISE%20and%20Secure%20Access%20Deployment.pdf
    I hope this helps!
    Thank you for rating helpful posts!

  • I'm try to buy a movie from iTunes with my I pad 3 and it tells me there is not enough local storage and when I go to my local storage there is a lot on free storage I also restarted my ipad but still the same prob what do I do?

    I'm try to buy a movie from iTunes with my I pad 3 and it tells me there is not enough local storage and when I go to my local storage there is a lot on free storage I also restarted my ipad but still the same prob what do I do?

    5GB is typically not enough space to download a movie.  Often, movies take from 3 - 5 GB to begin with.  The only option you have is to delete more things from your iPad.  You can remove unused Apps, pictures, music, text message (messages with pictures can take up a lot of space), email messages, books, magazines etc.

  • Issue in FF v 3.6.10: I have a page which have more than 20 link, clicking on these link opens up a popup using window.showModalDialog, for the first 20 popup opens up without any prob but for the 21st n more click it block the popup and do not open.

    Issue in FF v 3.6.10: I have a web page which have more than 20 link, clicking on each of these link opens up a pop-up using window.showModalDialog, for the first consecutive 20 popup opens up without any prob but for the 21st n more click it block the popup and do not open. This is m problem, the real user on the web page can click on more than 20 link in such a scenario it may create problem, please help

    Your above posted system details show outdated plugin(s) with known security and stability risks.
    *Shockwave Flash 9.0 r999
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    In Firefox 3.6 and later versions you need the Next-Generation Java™ Plug-In present in Java 6 U10 and later (Linux: libnpjp2.so; Windows: npjp2.dll).
    http://java.com/en/download/faq/firefox_newplugin.xml
    See also http://java.sun.com/javase/6/webnotes/install/jre/manual-plugin-install-linux.html

  • Prob. with iTunes, Phone won't shut off.  Tks.

    3GS with 6.1.3 Prob. with iTunes.  When I want to close out of iTunes after a Podcast the App will not close out when I hit Home. All other Apps shut down, only prob. is with iTunes.  Cant turn phone off goes back ti iTunes when turned on again.  Tks.

    I hope the previous replies are wrong. It was my understanding that even when Match is turned off in iTunes, music previously matched or uploaded to iCloud will stay there, associated with my Apple ID, even through a cold boot etc. If you want to remove songs from iCloud, but keep them locally, do this:
    1. Click "Store" in the iTunes top Menu
    2. Select "Turn on iTunes Match" (if it isn't already turned on)
    3. Close iTunes.
    4. Hold down the Shift key while you open iTunes - this will prompt you to choose or create a (new, locally empty) Library in a different folder from your main Library.
    5. Now you should see ONLY music that is stored in iCloud.
    6. Delete them all. iTunes will show a checkbox or button for you to click to delete the selected items from iCloud.
    7. Turn off iTunes Match (see #1)
    8. Restart iTunes with the Shift key again, so you can get back to your main Library - with Match turned off.

  • Prob with iTunes on Vista! Please Help!

    hi guys,
    i am getting the following error message when i install iTunes 7.5 version
    [IMG]http://img403.imageshack.us/img403/8344/itunesprobbo9.jpg[/IMG]
    i also tried iTunes 7.4 version but i am getting the same error message
    iTunes used to work before, but suddenly the prob
    i tried unistalling and installing the app again but in vain...
    Please Help!
    Thanks in advance!
    -Manish

    “iTunes.exe – Bad Image” ... “C:\Windows\system32\mssip32.dll is either not designed to run on Windows or it contains an error. Try installing the program using the original installation media or contact our system administrator or the software vendor for support.”
    Okay. Literally, it's saying that one of the dlls associated with Cryptographic Services on the PC is damaged. That can cause an iTunes launch failure.
    ... However, most of our experience here at Discussions is with troubleshooting these sorts of messages on Windows XP systems, rather than Vista and I don't have a Vista box handy for reference.
    So, if you don't receive any further replies here, it might be best to try posting instead at the Windows Vista Community Discussions Groups. Fingers crossed someone there might be better placed to help you troubleshoot this:
    http://windowshelp.microsoft.com/communities/newsgroups/en-us/default.mspx
    (Not trying to get rid of you here, just trying to get you on the radar screens of people who might be in a better position to help.)

  • TS1702 Telegraph app does not allow access to newspaper says have not paid subscription. Paid through iTunes and tel says it is iTunes prob. Can't talk to anybody at itunes

    Telegraph app does not allow access to newspaper. Says. Have not paid sub but pay via iTunes Store. Telegraph says it is an iTunes prob but I can't get to talk to anyone there! Any suggestions please?

    Just got this -
    Dear iTunes Customer,
    You recently received an email informing you that your iTunes Match Subscription could not be auto-renewed. We have resolved the problem and your iTunes Match Subscription has been renewed.
    We apologize for the delay with your auto-renewal. If you have any questions, please contact AppleCare at http://www.apple.com/support/itunes/
    I hope everyone else is all set too.

  • Hi, have a iphone/macbook itunes prob. i connected my phone to mac to add songs, and it wiped 99% of music from my phone. on the mac it still lists the songs on my phone but they are greyed out. can anyone help? very frustrated and want my music back.

    hi, have a iphone/macbook itunes prob. i connected my phone to mac to add songs, and it wiped 99% of music from my phone. on the mac it still lists the songs on my phone but they are greyed out. can anyone help? very frustrated and want my music back.

    I am having the same problem. I have just tried this. Unplug iphone > open itunes > delete all music from itunes library > close itunes > re-open itunes > add music from original folder > plug in iphone > select songs > press sync > unplug iphone using eject button onscreen > checked phone .... still nothing in music folder on phone. On itunes the "On this iphone" tab the songs remain there but greyed out.

  • Itunes in my laptop is not showing my iphone5 (7.0.4) but it has no problem wat so ever showing in another laptop...and my laptop has no prob showing other iphones

    itunes in my laptop is not showing my iphone5 (7.0.4) but it has no problem wat so ever showing in another laptop...and my laptop has no prob showing other iphones

    Hi siva samba,
    If you are having issues with your iPhone not being recognized in iTunes, you may find one of the following articles helpful:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    iOS: Device not recognized in iTunes for Mac OS X
    http://support.apple.com/kb/TS1591
    Regards,
    - Brenden

  • ITunes erased my library to force me to subscribe to Cloud, and Cloud wiped out my iPad twice.  Anyone w/same prob?

    iTunes took back my entire library to force me to subscribe to Cloud, but now it will not re-download all of my purchases, and the Cloud also seems to want to wipe my iPad (has done it twice). 2 hours on the phone with Apple no help. Anyone w/same prob?

    I guess I should have been more clear. One morning (5 days ago now) we realized that our complete itunes library was gone--all media (music, shows, movies, podcasts) was gone and could not be located on our hard drive. When I went onto itunes under the "help" section there was a comment that you could upgrade your itunes to Cloud and then access all your purchases and either re-download them or play them from the itunes page. So, I upgraded itunes and went about accessing all my purchases(thousands of dollars worth of media--so you can imagine my stress). Meanwhile, my husband was at work with his ipad and realized that everything was gone--all his apps, music, even apps for work that were downloaded at his work. Completely gone. I told him that I had found everything on Cloud and that he could probably just re-download everything when he got home but we both agreed it was weird. When he got home he noted that only about 1/3rd of our purchases were available on the Cloud website--all of my son's shows were still not there and many albums that we had bought over the last year were still missing. My husband called Apple yesterday and spent two hours on the phone with them. He said it was all very mysterious as they would not admit or deny anything and he said that he spoke with several people that were very ambiguous about what had happened and were careful about what they said. They agreed to re-release to us all of the media that we could not access on Cloud, but that they could not provide us with media that had copyright expired. They basically said it was our fault for not backing everything up on a separate system. While we explained that we do have a back up hard drive, we don't back up every time we make a purchase--so we haven't done so for several months. Then, this morning my husband was on his ipad and a message popped up that froze the ipad and it said that he needed to sync into itunes. He did so and then when he went back to unplug to go to work he realized everything was gone again! All his apps, music, everything. He was so upset because he saw no reason why this keeps happening.....Any thoughts??

Maybe you are looking for