Jtabbedpane with replacing tab content

Hello,
I am developing an applet that should contain a JTabbedPane with 2 tabs.
The second tab is easy to do because ti contains one Jpanel all the way.
the first however is an issue, because i am supposed to change its content when the applet is running.
this means i have 3 JPanels, J1, J2, J3.
At tge beginning the applet contains J1 in the first tab.
and J1 contains a button. when i click that button the applet should replace J1 with J2.
the problem is i haven't managed to find a solution yet :(
I have tried with setvisible(false) and validate(). It won't work. I also tried to add the J2 panel over J1, but encountered no succes.
anybody has any idea ?
Message was edited by:
asrfel

If you want to change back and forth repeatedly then wrap J1/2/3 in a JPanel with a CardLayout.
If you can discard one when it's done with, use the remove() and insertTab() methods of JTabbedPane.

Similar Messages

  • JTabbedPane with non-tabbed text

    OK, I'm stuck (again)
    What I would like to do is have a tabbed pane (2 tabs) and then put some text (maybe in a JLable) on the same line as the tabs. I'll try to draw a picture for clearity. Anyone have any ideas about how to do this?
    / tab1 \ /tab2  \         Here is some text
    ================================
    |    This is what changes                             |
    |            when you switch tabs                     |
    |                                                                        |
    ================================I think you can get the idea from that 'picture.'

    The correct way is probably to override the TabbedPaneUI, but that too complicated for me, so here's a quick hack that might give you some ideas:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.plaf.*;
    public class TabbedPaneWithText extends JFrame
         public TabbedPaneWithText()
              JTabbedPane tabbedPane = new JTabbedPane()
                   public void paintComponent(Graphics g)
                        super.paintComponent(g);
                        Rectangle lastTab = getUI().getTabBounds(this, getTabCount() - 1);
                        int tabEnd = lastTab.x + lastTab.width;
                        String text = "Some Text";
                        FontMetrics fm = getFontMetrics( getFont() );
                        int stringWidth = fm.stringWidth( text ) + 10;
                        int x = getSize().width - stringWidth;
                        if (x < tabEnd)
                             x = tabEnd;
                        g.drawString(text, x + 5, 18);
              tabbedPane.add("1", new JTextField("one"));
              tabbedPane.add("2", new JTextField("two"));
              getContentPane().add(tabbedPane);
         public static void main(String args[])
            TabbedPaneWithText frame = new TabbedPaneWithText();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setLocationRelativeTo( null );
            frame.setVisible(true);
    }

  • JTabbedpane with JRadiobutton?

    I have a JTabbedpane with 2 tabs (tab1, tab2).
    I have 2 radiobutton (JRadioButton).
    So for now, i want to when i click on radiobutton1 it will be show tab1
    when i click on radiobutton2 it will be show tab2.
    Here is my source code, please help me to slove it:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.GridBagLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.BorderFactory;
    import javax.swing.ButtonGroup;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextField;
    public class JTablePaneTest extends JFrame implements ActionListener{
    private JTabbedPane pane;
    private JRadioButton radioButton1 = new JRadioButton("Radiobutton1", true);
    private JRadioButton radioButton2 = new JRadioButton("Radiobutton2", false);
    JPanel radioPanel =null;
    public JTablePaneTest() {
    super("TEST");
    this.setLayout(new BorderLayout());
    this.setSize(new Dimension(300,300));
    this.getContentPane().add(this.getAllRadioButton(), BorderLayout.SOUTH);
    this.getContentPane().add(this.getPane(), BorderLayout.CENTER);
    this.pack();
    this.setVisible(true);
    private JPanel getAllRadioButton(){
    if(radioPanel==null){
    radioPanel = new JPanel();
    radioPanel.setLayout(new FlowLayout());
    radioPanel.setBorder(BorderFactory.createEmptyBorder());
    ButtonGroup bg = new ButtonGroup();
    bg.add(radioButton1);
    bg.add(radioButton2);
    radioPanel.add(radioButton1);
    radioPanel.add(radioButton2);
    return radioPanel;
    private JTabbedPane getPane(){
    if(pane == null){
    pane = new JTabbedPane();
    pane.addTab("Tab1", null, panel1(), "Tab1");
    pane.addTab("Tab2", null, panel2(), "Tab2");
    return pane;
    private JPanel panel1(){
    JPanel panel1 = new JPanel();
    panel1.setLayout(new GridBagLayout());
    panel1.add(new JButton("TEST1"));
    return panel1;
    private JPanel panel2(){
    JPanel panel2 = new JPanel();
    panel2.setLayout(new GridBagLayout());
    panel2.add(new JTextField(12));
    return panel2;
    public static void main(String[] args) {
    new JTablePaneTest();
    @Override
    public void actionPerformed(ActionEvent e) {
    if(e.getSource() == radioButton1){
    //show tab1
    if(e.getSource() == radioButton2){
    //show tab2
    }Thanks you very much.
    Edited by: ecard104 on Sep 1, 2008 10:01 AM

    ecard104 wrote:
    can you tell me the method you want to say?I'd prefer to have you look at the API and the tutorial. It would be better for you in the long run. It's spelled out in the tutorial.
    [http://java.sun.com/docs/books/tutorial/uiswing/components/tabbedpane.html]
    [http://java.sun.com/javase/6/docs/api/javax/swing/JTabbedPane.html]
    Edited by: Encephalopathic on Sep 1, 2008 10:17 AM

  • What is the latest version where you can use replace tabs?

    I will only use a firefox version that has a replacetabs add-on option - which is the most updated version that can utilize this function?

    What do you mean with replace tabs option?
    Do you want to open links in the current tab instead of in a new tab or window?
    You can look at these extensions:
    *Tabberwocky: https://addons.mozilla.org/firefox/addon/14439
    *Tab Utilities Lite: https://addons.mozilla.org/firefox/addon/62581
    *Tab Utilities: https://addons.mozilla.org/firefox/addon/59961

  • I want to sync the songs on my Mac to my iPod, but it says An iPod can be synced with only one iTunes library at a time. Erasing and syncing replaces the contents of this iPod with the contents of this iTunes library.' Will this reset my iPod completely?

    I want to sync the songs on my Mac to my iPod, but it says, 'An iPod can only be synced to one iTunes Library at a time. Erasing and syncing replaces the contents of this iTunes Library.' Will this reset my iPod completely (my iPod is 4th gen)?

    Was your iPod associated with a different mac or pc previously is all. And was it backed up or sync'd on this mac with iTunes previously.
    http://www.apple.com/support/itunes

  • Hi,I have recently replaced by hard drive with a ssd. My old hard drive has all my iTunes stuff.i would like to install only iTunes programme on the ssd with all the content on the old hard drive. How do I do it?

    Hi,I have recently replaced by hard drive with a ssd. My old hard drive has all my iTunes stuff.i would like to install only iTunes programme on the ssd with all the content on the old hard drive. How do I do it?

    Install iTunes.
    Once install, hold SHIFT and launch iTunes.
    When prompted, point iTunes to the correct location for the iTunesLibrary.itl file which should be in the iTunes folder under <user>/Music on the old drive.

  • I synced my iPhone to my husband's computer and it wiped out his iTunes account replacing his content with the content of my iTunes account. Any idea how to fix this?

    I synced my iPhone to my husband's computer not knowing that it would wipe out his iTunes account and replace his content with mine. Obviously, not good. Any ideas on how to fix this??

    Syncing an iphone should have no effect at all on the content of the computer.
    Are you saying the the itunes library on the computer was effected?

  • JTabbedPane with two rows of tabs

    Hi,
    I need to create a JTabbedPane with layout policy as SCROLL_TAB_LAYOUT with two rows of tabs. The first level will have say 10 tabs and the all the remaining tabs (say 20) will be added in the next level. Please help me out on this, to how to proceed with it?
    Edited by: Soundarapandian on Nov 25, 2009 3:10 PM

    Soundarapandian wrote:
    I need to create a JTabbedPane with layout policy as SCROLL_TAB_LAYOUT with two rows of tabs. The first level will have say 10 tabs and the all the remaining tabs (say 20) will be added in the next level. Please help me out on this, to how to proceed with it?Try this (imho better) approach:
    create a new tabbedpane for each level and add each of these tabbedpanes to an upperlevel tabbedpane, thus allowing you to pre-select the desired level.

  • Replace the empty field with below data content field in xml pub report

    Hi Gurus,
    Please give me the solution for the Replacement of empty field with below data content field in XML PUBLISHER REPORT.
    ex:
    Name:Philips.M
    Address 1:XP APPTS,
    Address 2:S:R ROAD
    Address 3:
    COUNTRY:INDIA
    Here i have to get only address 1,address 2 and the COUNTRY data.I dont want to display Address 3 field here.
    Thanks,
    David

    I'm not sure if this answers your question but you could try putting out the address all in one item in the SQL eg somthing like:
    address1 || DECODE(address1, NULL, NULL, 'newline character') ||
    address2 || DECODE(address2, NULL, NULL, 'newline character') ||
    address3 || DECODE(address3, NULL, NULL, 'newline character')
    where 'newline character' is somthing like CHR(12)
    Dave

  • Error while creating a Characteristic Variable with Replacement Path

    Hi all,
        I am trying to create the Characteristic Variable ZVLOWDT (Low Date') with Replacement Path on characteristic ZSTARTDT (Start Date) and it gives the error 'Source to replace 'Low Date' is not defined.
       I have created a User Entry Variable VAR_DATE (Start Date) with interval like '01/01/2009 - 01/15/2009'  and  Customer Exit variable ZVCPDAY (does some calculation based on the input of VAR_DATE) on the same ZSTARTDT characteristic. I want to get the 01/01/2009 (lower range date of the selection) into this Characteristic Variable ZVLOWDT. We are in BI 7.0 and the following are it's properties:
    General Tab:
    Description: Low Date
    Technical Name: ZVLOWDT
    Type of Variable: Characteristic Value
    Processing by: Replacement Path
    Reference Characteristic: ZSTARTDT Start Date
    Details Tab:
    Variable Represents : Single value
    Variable is: Mandatory
    Variable is Ready for Input : unchecked
    Replacement Path Tab: Replacement Rule
    Replace Variable with : Variable
    Variable : VAR_DATE
    Replace with : KEY
    Why I am getting this error, PLEASE ?
    Thanks,
    Venkat.

    Hi Khaja,
       We could derive a Variable value from another Variable with out Customer Exit. There is a white paper.
    First have the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next create the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we could get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
    While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error  'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path, PLEASE ?
    Thanks,
    Venkat.

  • Variable with Replacement Path

    Hi, I have two queries. The results of the first one should be the input for the second one. E.g. the first query shows a list of personnel numbers and additional information. These personnel numbers shall be overtaken by the second query. The personnel numbers belong to "Dimensions" in the Query Designer. I alread tried to create a variable with replacement path to the dimension personnel number. I implementet this variable in both the first and the second query (under: "rows"). It`s no "Formular variable" and no "Calculated Key Figure" but a "Characteristic Value Variable" of a Dimension. The problem is now that I cannot execute any of the two queries. The error "Abort the query cannot be released for OLE DB for OLAP. System error in programm CL_RSR_REQUEST and form PREPARE_VQUERIES:INVALID_
    What is my mistake? Thank you in advance! Eve

    Hi Eve,
    It is possible to connect the 2 queries using a Replacement Path characteristic variable. You would need to create the variable on the char whose values you want to pass from Q1 to Q2. The variable will be of type replacement path and you will need to enter the name of Q1 from which it will get the values. Make sure that you include this char in the query definition of Q1 and Q2. In Q2 you will restrict the characteristic using this variable. DO not use this variable (replacement path) in Q1.
    In your query properties check if you have turned on the checkmark for Release for OLE DB for OLAP (3rd tab). If the check mark is there, then remove it.
    We are using the scenario in a couple of places, and it works very well.
    Hope this helps...

  • Creating Variable with Replacement Path to get value from ANOTHER Variable

    Hi all,
        Is anyone has created the Variable with Replacement Path to get the value from another User Entry Variable, PLEASE ? 
    First created the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next created the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we should get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
    While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error 'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path for my requirement, PLEASE ?
    The following is from help.sap..com:
    Replace with Characteristic Value
    Text and formula variables with the processing type Replacement Path can be replaced with a corresponding characteristic value. In the variable editor, on the General tab page, you specify under Reference Characteristic the characteristic that is to be referenced by the replacement. On the Replacement Path tab page, you can choose whether the variable is replaced with the From or the To Value and with the Key or the Name of the characteristic value. You can also specify the Offset Start and Offset Length for the output.
    Replace with Variable
    Characteristic value variables, hierarchy variables, text variables, and formula variables with the Replacement Path processing type can take their values from a different variable.
    The following prerequisites need to be fulfilled:
    Variable
    ●      The variable must not be input-ready
    ●      The variable must represent a single value
    Source Variable
    ●      The source variable must not be a hierarchy node variable
    ●      The source variable must be input-ready
    ●      The source variable must be available in the query
    ●      The source variable must represent a single value or an interval
    In the variable editor, on the Replacement Path tab page, you specify the source variable from which the value is to be determined. The value is either determined from the key, the external attribute of the key, the description, or the attribute value. You can specify an Offset Start and an Offset Length for the output here. The variable is replaced on the variable screen upon each data release.
    Thanks,
    Venkat.

    Hi Eve,
    It is possible to connect the 2 queries using a Replacement Path characteristic variable. You would need to create the variable on the char whose values you want to pass from Q1 to Q2. The variable will be of type replacement path and you will need to enter the name of Q1 from which it will get the values. Make sure that you include this char in the query definition of Q1 and Q2. In Q2 you will restrict the characteristic using this variable. DO not use this variable (replacement path) in Q1.
    In your query properties check if you have turned on the checkmark for Release for OLE DB for OLAP (3rd tab). If the check mark is there, then remove it.
    We are using the scenario in a couple of places, and it works very well.
    Hope this helps...

  • When one window containing 1 tab is closed, the other window with several tabs closes also

    I have a set of web pages that reproducibly causes Firefox to act incorrectly. When Firefox is first started I click the "Restore previous desktop" button. Then I have 2 Firefox windows. The first to open has 6 tabs; the second has 1 tab. When I close the 2nd window (with 1 tab), it also closes Firefox completely with no error message. When I run Firefox again, "Restore" creates both windows exactly as they were before.
    I don't know yet if the actual URLs make a difference, but here they are anyway:
    '''''Window 1:'''''
    https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F%3Fshva%3D1%26ui%3Dhtml%26zy%3Dl&bsv=llya694le36z&ss=1&scc=1&authuser=0&ltmpl=default&ltmplcache=2&from=login#inbox
    http://branamsmile.com/gum/?gclid=CLepiIaAhqkCFVJ25QodSyk1nw
    http://www.google.com/search?hl=&q=root+viewsonic+g+tablet&sourceid=navclient-ff&rlz=1B3GGLL_enUS412US412&ie=UTF-8&aq=0&oq=root+viewsoni
    ***** NOTE THIS TAB IS PROBLEMATIC *****
    When I press Alt+D, Ctrl+C, and Ctrl+V it into this comment box, I get
    '''woot'''
    When I look at the actual contents of the web page being displayed, it is the verizon wireless rebate page:
    '''www.verizonwireless.com/rebates'''
    The page has definitely finished being rendered (the refresh icon is displayed after the url "woot"), but the URL does not match the page. The URL displayed is not even in its proper form (i.e., www.woot.com).
    Remember that this page was RESTORED by Firefox from a previous session. It is as if I was on that tab at verizon, tried to go to woot.com by typing "woot" (which would of course bring up a search rather than the web page), DIDN'T PRESS ENTER, and Firefox is duplicating that entire sequence.
    ********* END PROBLEMATIC *************
    chrome://foxtab/content/newTabMessage.html
    https://www.bankofamerica.com/Control.do?page_msg=signoff&body=signoff
    '''''Window 2:'''''
    http://www.freewaregenius.com/2011/06/01/the-best-freeware-file-manager-a-comparative-analysis/
    With this exact set of windows and tabs, as restored by Firefox in a brand new instance of it, double-clicking the red Firefox in the top left corner of the 2nd window causes both windows to close.
    I wish I could save this configuration so I could always reproduce the error, but I need my computer :)

    You can check for problems with the sessionstore.js and sessionstore.bak files in the Firefox Profile Folder that store session data.
    Delete the sessionstore.js file and possible sessionstore-##.js files with a number and sessionstore.bak in the Firefox Profile Folder.
    *Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    Deleting sessionstore.js will cause App Tabs and Tab Groups and open and closed (undo) tabs to get lost, so you will have to create them again (make a note or bookmark them).
    *http://kb.mozillazine.org/Multiple_profile_files_created

  • Regarding text variable with replacement path.

    Hi Friends,
    Please can any one tell me good scenario where we can use text variable with replacement path..
    i have already searched in forum,but that scenario's i did not under stand.
    Please send.
    i will assign points.
    Thanks in advance.
    Thanks & Regards,

    Hi,
    There is a scenario:
    One has to show, a Period like May 2008 for a report. i.e the report which u r showing is common for May 2008. So u create a text variable on this Fiscal Year Period. When u do this, the Text appears on the Top of the report. So later, whenever u execute a report for a particular month, u get that Header as Jue, July etc etc.
    Its just a header. Text Variable promts u to display the Header with our own uploaded Desire Data.
    Steps.
    1) Edit your query
    2) Right click 'keyfigures' or other structure, choose 'new selection',
    3) beside description there is 'variable' button, click and then choose 'new', a variable screen will come out, type in your variable name, description, choose 'replacement path' for processing by. click 'next'.
    http://help.sap.com/saphelp_nw04/helpdata/en/ac/789b3c4d4d8d15e10000000a114084/content.htm
    Assign Points if helped
    Thanks
    Edited by: Noor Ahmed khan on Jul 21, 2008 5:43 PM

  • Tab Content disappers : Migration from 6 to 6i

    I have a form with multiple tabs. It works fine with Forms 6.
    Now when we want to migrate to 6i, I am facing problem when I
    navigate from one tab to another tab.
    When the Form starts, it shows first tab correctly. Now if I
    click on another tab, it goes to that tab but doesn't show the
    items on the tab. If I come back to old tab, same problem.
    These are setting I have..
    Main Canvas: ( Type : Content )
    Viewport X position on Canvas : 0
    Viewport Y position on Canvas : 0
    Width : 9.2
    Height : 6.8
    Tab Canvas : ( Type:Tab )
    Viewport X position : 0.1
    Viewport Y position : 0.5
    Viewport Width : 9
    Viewport Height : 6.3
    Tab Page : ( Canvas type:Stacked )
    Viewport X position : 0.2
    Viewport Y position : 0.8
    Viewport Width : 8.8
    Viewport Height : 5.8
    Viewport X position on Canvas : 0
    Viewport Y position on Canvas : 0
    Width : 8.8
    Height : 5.8
    Any clues would be highly appreciated.
    Thanks
    Rahul

    Hello Deepak Kori,
    thanks a lot for your reply!
    I read this SAP note and the note with additional information (129352).
    As i understand we can do a homogeneous system copy as follows:
    - setting up the new server (2008x64) with a MAXDB instance (7.6.03.09)
    - Creating a backup (migration) from the source system (7.6.00.18)
    - recovery with initialization of this backup on the new server
    - upgrade of the DB instance to SAP MAXDB 7.8.02.29
    If this is correct, i think we have a good strategy!
    Thanks
    Martin

Maybe you are looking for

  • Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View

    Todd, Let me try to explain you this time. I have a text field in a TiledViewBean. When I display the page, the text field html tag is created with the name="PageDetail.rDetail[0].tbFieldName" say five times/rows with same name. The html tags look li

  • Problem with wwsbr_api.modify_item and Text 8191 characters

    Hi all. I have a PL/SQL portlet used to insert/update content in Oracle Portal. I noticed that if I try to insert or update a text item with data longer than 8191 characters it gives the following error: ORA-06502: PL/SQL: numeric or value error. Als

  • How do I reformat my hard disk.

    When i go into command R mode there is a lock and requiring a password but i forgot what it was. I cant reformat using the installation disk because when I click on it there is an error ''You cant use this version of the application Install Mac OSX w

  • Verizon reporting negative information on credit report

    Your issue has been escalated to a Verizon agent. Before the agent can begin assisting you, they will need to collect further information from you. Please go to your profile page for the forum, and look in the middle, right at the top where you will

  • OELinux 5.3 and 11g ASM install nees rare lib not found

    after installed correct libraries for 32 bit 5.e OELinux on a quad core core 2 duo I get the following error when trying to manually load ocssd.bin deamon this lib is not available on net and seems very rare. root@localhost /# /app/oracle/product/11.