Help with tabbed pane

hello!
i have a tabbed pane with two tabs.
in tab1 i have a button(for example), how can i do that when i press the button in tab1 it will draw something in tab2?
i tried to do this but it draw what i want in tab1(the tab with the button)
if the source code will help i will post it here
sorry for my bad english

here's something to play around with
(I've simplified it by putting it all in paintComponent, but it should be changed
to get the image, if not null then repaint)
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.net.URL;
import javax.imageio.ImageIO;
class Testing extends JFrame
  JTabbedPane tp = new JTabbedPane();
  JPanel p1 = new JPanel();
  MyJPanel p2 = new MyJPanel();
  public Testing()
    setSize(400,400);
    setLocation(300,200);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JButton btn = new JButton("Set image");
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        p2.imageFile = "Test.gif";
        p2.repaint();}});
    p1.add(btn);
    tp.addTab("Tab 1",p1);
    tp.addTab("Tab 2",p2);
    getContentPane().add(tp);
  public static void main(String[] args){new Testing().setVisible(true);}
class MyJPanel extends JPanel
  String imageFile = null;
  public void paintComponent(Graphics g)
    super.paintComponent(g);
    if(imageFile != null)
      try
        URL url = new URL(getClass().getResource(imageFile), imageFile);
        Image img = ImageIO.read(url);
        g.drawImage(img, 50,50,this);
      catch(Exception e){JOptionPane.showMessageDialog(null,"Image error");}
}

Similar Messages

  • Need help with tabbed panes

    I am creating an App that uses tabbed pane.
    The first tab is for loggin in.
    What I want to do is make all the other tabs invisible until the user has successfully logged in.
    How do I make the other tabs invisible?

    Hi,
    One way is to add them after the user has logged in. Another way is to disable them so that the user can't use them.
    Btw. I have to say that what you want to do sounds weird. Normally you use a modal login dialog instead.
    /Kaj

  • Integrate a close button with tabbed pane?

    I like FireFox and I like using parts of its design concepts. How do I put a close button on the right corner of a tab using swing? Maybe I need a "cross" image? Maybe I just put an "X" character there?
    I tried tabProcessToBeClosed.close() or tabProcessToBeClosed.exit(), but it does not close the tab. Is there any other ways?

    I found the following to be extremely useful for constructing a tabbed pane with or without a close button.
    [http://weblogs.java.net/blog/alexfromsun/archive/2005/11/tabcomponents_i_1.html|http://weblogs.java.net/blog/alexfromsun/archive/2005/11/tabcomponents_i_1.html]

  • Btn.setMnemonic() on applet with tabbed panes

    I've abandoned using mnemonics on my applet for now. Whereas the button actions work fine when the buttons are pressed, an alt_U on the update button causes some kind of screwy repaint. The tabbed panes get semi-scrambled.
    Anyone have a similar experience ?

        JLabel l = new JLabel ("<html><font color = 'blue'>Hello world</font>") ;Foxcoming

  • 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

  • Help with tabs on a site created by iWeb '09

    Hi All,
    I created a site through iWeb and the only problem I am having is that on the "home" page, when viewing the site online, it looks great and normal, but on the other pages within the site, the title of the site disappears from the tab above. For example, if you are in safari and click file, new tab, you should see the title/name of the site on the tab. On my site, you can only see the name of the site when on the home page. When clicking on any other part of the site, the name of the tab disappears and is blank. Can anyone help? I can't figure out how to fix this...
    Thanks so much.

    Real info, such as an URL to your page, would help.

  • Help with Tabs

    Hello,
    I've never had to modify tabs after creating the pages, and I am having some issues with it. I had to delete the tabs that were created when I created the pages, and I thought re-creating them would be easy. However the tabs do not show when the page is run and the tabs do not even show in the Tabs region when editing a page. Can someone look at my example on apex.oracle.com and let me know what step I am missing?
    Thanks,
    -- Johnnie
    workspace: paet
    user: dev
    pw: demo
    application: 23282
    page: 1

    In your display attributes for the page, make sure that a Tab Set is selected, and it matches the tab set that the tab actually exists in.
    David

  • Help with Tabbed panels please

    Hello,
    Can someone please tell me how I can change the color of the background of the tabs in tabbed panels.  They are a grey and I can go into each tab and set a new color and when that tab is chose, the new color shows, but when I click on the next panel tab, the prvious one background goes back to grey.  How do I get that whole grey background color changed?
    Did I confuse everyone because I think I confused myself lol
    Thanks if you can help!
    Kathleen

    THank you very much!!

  • Need some help with Tab Strip

    Hello Experts,
    I have a got a scenario where I have 4 option button on the page & Tabstrip having 4 tabs below that.
    Based on the options he chooses I need to make those tabs visible or invisible.
    Can any one of you suggest me how can I do it.
    PS:
    I tried creating a Value attribute with Boolean as a type & assigned it to the Visibility of the Tab.
    This think works but the problem is after selecting the options the tabs are collapsed on each other..so user cant see it unless he goes onto the navigation & choose the appropriate one.
    Thanks in advance.

    Hi,
    Create an string type attribute as selectedTab and bind it to the SelectedTab property of the TabStrip.
    In the action of your option button, set the name / id of tab that you want to display in the selectedTab attribute so that the tab gets displayed
    Lets the tabs are Tab1, Tab2, Tab3 and Tab4. Now on a button click you want Tab3 to be displayed then on the action of button write the code as
    wdContext.currentContextElement().setselectedTab('Tab3');
    Regards,
    Amol

  • Help with Preference pane DNS settings for Mail

    I have a mail (not Apple Mail) issue with my Entourage Mail. I keep getting
    the following error message and I have verified the server settings in my
    mail accounts are correct for ATT that uses pop.att.yahoo.com. I manage to
    get mail most of the time but I still get the following error message:
    Error Description
    Error:
    Entourage cannot find the server. Verify the server information is entered correctly in the Account Settings, and that your DNS settings in the Network pane of System Preferences are correct.
    Explanation:
    Could not retrieve mail
    Error: -1370
    My System Preferences/Network/Advanced/DNS point to my 2wire Gateway combo
    modem/router. The router is set for Automatic DNS. I tried changing it to manual
    and it did not works any better.
    If I change the DNS setting in the preference pane in OS X, will it really use that
    DMS address and bypass the router?
    I played around with the namebench utility
    http://www.macupdate.com/info.php/id/32784/namebench and each time you
    run it, namebench makes a better recommendation - saying something is faster
    than the previous recommendation.
    I am lost on what I need to do correct the Network pane of my System Preferences.
    Should it point to the router or to good DNS?
    I do not think this is a Microsoft Entourage issue.
    Have others seen this issue or is unique to my setup.

    Going to sleep on and see how it works in the morning.
    The problem is solved and I have checked the Yes button that my
    question has been answered. The following is a copy of a posting
    two days ago to the Microsoft Entourage group that should work
    just as well for Mail users.
    If you are tied of getting the following Entourage error
    message -3170 over and over again, read on.
    Error:
    Entourage cannot find the server. Verify the server information
    entered correctly in the Account Settings, and that your DNS
    settings in the Network pane of System Preferences are correct.
    Explanation:
    Could not retrieve mail
    Error –3170
    Thanks to a tip from Diane Ross I have gone two days without
    getting the error message.
    First, I know the Account Settings for my ATT DSL service
    have been correct for some time and have not changed.
    The short version of the fix that worked for was to open
    the OS X 10.6.3 (Snow Leopard) System Preferences/
    Network/Advanced/DNS panel and add some better Domain
    Name Servers from my location.
    The default (or before) OS X setting was:
    DNS Servers: Search Domains:
    192.168.1.254 gateway.2wire.com
    Note both were dimmed. The server listed tells OS X to use
    the ATT provided combo 2wire modem/router for my DSL service.
    The change that seem to have worked for me was to leave the
    Search Domain the same; however, I added some good servers that
    bypass the 2wire gateway with its automatic DNS setting.
    DNS Servers: Search Domains:
    208.67.220.220 gateway.2wire.com
    208.67.220.222
    65.68.49.51
    192.168.1.254
    I found the ‘good’ or better DNS Servers by making several runs
    using the free Google utility called namebench 1.2
    <http://www.macupdate.com/info.php/id/32784/namebench>
    This utility takes some time and will make suggestions from your
    location. If you add the namebench recommendation and run it
    again it will find a better recommendation. I had to make several
    runs to find the better DNS Servers for my location. The first or
    primary is called OpenDNS, the second is a backup for the OpenDNS
    and the third is SBC Global TX now owned by ATT and I live in
    Texas. Note I ended with the default IP address.
    FYI, I tied using the selected servers in the 2wire gateway in the
    manual mode rather than the default automatic mode and it just
    did not work right. Some pages would not open and others were
    slow. For this reason I run the router in the automatic mode for
    DNS and control things using the OS X Network preference pane.
    The addition of preferred DNS Servers in my Preference seems
    to have slowed down and hopefully stopped Entourage 2008
    version 12.2.4 -3170 error messages.
    Message was edited by: aRKay

  • Help with tabs, I reset but doesn't fix problem when started again

    When started the new tab is blank and doesn't show the 9 previous pages like before. I have gone to help the troubleshooting and then reset Firefox. This works until I shut down Firefox although when I start a new session the New Tabs are Blank again.
    please help.

    Is the new tab page completely blank or is there a little 9-square icon on the right side? If that's there, can you check your history and make sure your history wasn't cleared?
    In the future, you shouldn't need to do a full reset to edit this preference. In fact, it would be helpful to take a look at what is there when this problem occurs. This involves using the about:config preferences editor:
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the search box above the list, type or paste '''newtab''' and pause while the list is filtered
    (3) Double-click the '''browser.newtab.url''' preference and enter your preferred page:
    * ''Page thumbnails (default)'' => about:newtab
    * ''Blank tab'' => about:blank
    * ''Built-in Firefox home page'' => about:home
    * ''Any other page'' => full URL to the page
    Press Ctrl+t to open a new tab and verify that it worked. Fixed?
    If it's fixed temporarily, does it stick until you exit Firefox and restart it? Sometimes preferences will be changed at startup by a user.js file. This file isn't created by Firefox, but can be created by a user or third party software to override your regular settings. To check for a user.js file, try the steps in this article: [[How to fix preferences that won't save]].

  • Command Link not working with Tabbed Pane

    I am calling one action on click of CommandLink in a DataTable,
    When I submit the action from an individual page , It is working fine,
    When I include that JSP in the TabbedPane , it is throwing JavaScript error "Error on the page" and action won't submit.
    Please help me in resolving out this issue.
    Thanks
    Gifin

    please put here the problematic code...

  • Help with "Tabbed panels"

    Hi guys,
    i am trying to design a web for my company. The company devided in to three parts. Every part has a slightly different menu.
    I assume i could use "tabbed panels" for that purpose but the contents of tabs are changed only on mouse click. I would like people to hover on main menu button and submenu contents are changing...the same for all three main menu buttons. Each main menu buttons has about 7 or 8 submenus.
    Is it possible for you to point me to a step by step tutorials to do it?
    Thank you very much

    Hi,
    I suggest that you put your question into the Spry forum, 'cause there are acting most of the specialists around this topic. Here the link to it:
    http://forums.adobe.com/community/labs/spry?view=discussions
    Hans-Günter

  • 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                                                                                                                                                                                                                                                                                                                                                           

  • Help with validation on a manually created tabbed form

    version 4.1.1.00.23
    Hello,
    I have a manually created tabbed form that I'm having trouble creating validation on.
    The page is a Resource Staffing page where PM's can forecast the Resources that will be needed for various projects. The forecast can be for 12 - 18 months.
    The requirement is to display a message to the user if they are trying to save a row without forecasting any time. It's possible they may not know how may Resources or the length of time needed when the row is created.  If they respond that they want to save the row without time the MRU will create the record. If they answer that they do not want to save the row they are returned to the page without loss of information.
    The month fields on the page are defaulting to 0 (zero).
    I've updated the Save button to Redirect to URL and in the URL Redirect I have: javascript:confirmNoTimeSaved()
    The javascript:
    [code]
    function confirmNoTimeSaved()
        var arr_jan,arr_feb,arr_mar,arr_apr,arr_may,arr_jun,arr_jul,arr_aug,arr_sep,arr_oct,arr_nov,arr_dec = new Array();
            arr_jan = document.wwv_flow.f07;
            arr_feb = document.wwv_flow.f08;
            arr_mar = document.wwv_flow.f09;
            arr_apr = document.wwv_flow.f10;
            arr_may = document.wwv_flow.f11;
            arr_jun = document.wwv_flow.f12;
            arr_jul = document.wwv_flow.f13;
            arr_aug = document.wwv_flow.f14;
            arr_sep = document.wwv_flow.f15;
            arr_oct = document.wwv_flow.f16;
            arr_nov = document.wwv_flow.f17;
            arr_dec = document.wwv_flow.f18;
        for(i = 0; i < arr_jan.length; i++)
            if(arr_jan[i].value == 0 && arr_feb[i].value == 0 && arr_mar[i].value == 0
                && arr_apr[i].value == 0 && arr_may[i].value == 0 && arr_jun[i].value == 0
                && arr_jul[i].value == 0 && arr_aug[i].value == 0 && arr_sep[i].value == 0
                && arr_oct[i].value == 0 && arr_nov[i].value == 0 && arr_dec[i].value == 0)
                txt = 'You have no time assigned to your Forecast. Do you want to save this Forecast without time entered?' + '\n' + '\n' + '"Yes" to save the Forecast.' + '\n' + '"No" to return with no changes.';
                caption = 'Confirm Saving With No Time';
                vbMsg(txt,caption)
                switch (isChoice)
                    case 6:
                        doSubmit('SUBMIT');
                        break;
                    case 7:
                        doSubmit('CANCEL2');
                        break;
            else
                doSubmit('SUBMIT');   
                break;
    </script>
    <script language="VBScript">
    <!--
    //Yes    = 6
    //No     = 7
        Function vbMsg(isTxt,isCaption)
            testVal = MsgBox(isTxt,vbYesNo,isCaption)
            isChoice = testVal
        End Function
    //-->
    </script>
    [/code]
    The 'CANCEL2' is just a Branch I'm using to branch back to the page without clearing Cache. I do have 'Cancel' button on the page and the Branch created for that clears the Cache.
    While debugging the javascript I get into the VB Script on the testVal = MsgBox(isTxt,vbYesNo,isCaption) line and the browser crashes.
    Can someone help with this requirement?
    What additional information can I provide?
    Thanks,
    Joe

    The code above is my attempt at this requirement, however, the browser crashes when it gets to the VBScript on the MsgBox call. I don't have to use this approach. Does someone have an idea how to solve this?
    Thanks,
    Joe

Maybe you are looking for

  • BUG: Minimize button doesn't work correctly

    Hi, Using WL 8.1 SP4 Portal: When you minimize a portlet, the title will change. It will take the title of the portlet that is above the minimized portlet. regards, hummin

  • Feban error

    Dear All, In my client place i done the configuration  Electronic Bank statement Make Global Settings for Electronic Bank Statement i done all  the setting in this path after for one bank i run ff_5 , FEBP and FF_6 i can see the posted statement. Aft

  • ESS:WebDynpro Based Personal Information iviews.?

    Hi All, I am configuring ESS Personal Information. Using Ecc 5.0 , mySAP ERP 2004 60.2 ESS BP and EP6.0. Has anybody configured WebDynpro based Personal Information for country specific India version( country code:40)..Am able to get ITS based Person

  • 3rd party plugins crash Premiere after restart.

    Yesterday, everything worked fine. I have a Sequence with clips and have been happily rendering from it for a week. It has a mixture of Magic Bullet Looks, Film Convert and native effects across a range of clips. Today, on opening Premiere I find tha

  • Sap Interfaces

    Hi All, What are the interfaces used in SAP FICO. Why and their use and how do they work with SAP. I would appreciate if someone can provide a brief explanation. Thanks Dev