Exception thrown when I remove and add Tab?

Hi,
I use the JTabbedPane, and I made a button, when it's pressed, it will remove all tab from the JTabbedPane, and then it will recreate every tab(update them) and add it back. But sometimes there's exception thrown, why is that? the exception are:
java.lang.ArrayIndexOutOfBoundsException: 4 <------------------- this number always change
at javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabArea(BasicTabbedPaneUI.java:535)
at javax.swing.plaf.basic.BasicTabbedPaneUI.paint(BasicTabbedPaneUI.java:497)
at javax.swing.plaf.metal.MetalTabbedPaneUI.paint(MetalTabbedPaneUI.java:666)
at javax.swing.plaf.metal.MetalTabbedPaneUI.update(MetalTabbedPaneUI.java:561)
at javax.swing.JComponent.paintComponent(JComponent.java:541)
at javax.swing.JComponent.paint(JComponent.java:808)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4795)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4748)
at javax.swing.JComponent._paintImmediately(JComponent.java:4692)
at javax.swing.JComponent.paintImmediately(JComponent.java:4495)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Does anyone know why? Thx
Adrian

Does anyone know why? I still can't solve this problem, it just keep popping up, but the strange thing is after exception thrown, nothing has happeded, everything seems to be fine, the program still running, all those tabs are added.
Does anyone know why?

Similar Messages

  • Java mapping for Remove and Add of  DOCTYPE Tag

    HI All,
    i have one issue while the Java mapping for Remove and Add of  DOCTYPE Tag   in Operation Mapping .
    it says that , while am testing in Configuration Test "  Problem while determining receivers using interface mapping: Error while determining root tag of XML"
    Receiver Determination...
    error in SXMB MOni
    " SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="RCVR_DETERMINATION">CX_RD_PLSRV</SAP:Code>
      <SAP:P1>Problem while determining receivers using interface mapping: Error while determining root tag of XML: '<!--' or '<![CDATA[' expected</SAP:P1>
    plz provide solutions
    Thanks in advance.

    Hi Mahesh,
    I understand, you are using extended Receiver Determination using Operational Mapping (which has Java Mapping). And, there is an error message u201CError while determining root tag of XMLu201D, when you are doing configuration test.
    Can you please test, the Operational Mapping (which has Java Mapping) separately in ESR, with payload which is coming now. It should produce a XML something like this [Link1|http://help.sap.com/saphelp_nwpi711/helpdata/en/48/ce53aea0d7154ee10000000a421937/frameset.htm]
    <Receivers>
    <Receiver>
      <Party agency="016" scheme="DUNS">123456789</Party>
      <Service>MyService</Service>
    </Receiver>
    <Receiver>
      <Party agency="http://sap.com/xi/XI" scheme="XIParty"></Party>
      <Service>ABC_200</Service>
    </Receiver>
    </Receivers>
    If it is not (I Think it will not), then there is some problem in Java Mapping coding. Please correct it. Last option, if your Java code is small in length; you may paste it here, so that we can have a look at the cause of issue.
    Regards,
    Raghu_Vamsee

  • Removal and adding tabs in user interface

    Hi,can anybody provide me solution for customizing the user interface page menu tabs in SUN Identity Manager.
    My requirement is,i need to remove and add main menu and sub menus in the user interface page in SUN Identity Manager.
    Thanks in advance.
    Edited by: SUNIDMDEV on Feb 21, 2008 10:52 PM

    Hello,
    Article Master and Material Master are one and the same in context (materials are referred as Articles in SAP IS Retail). Please refer the below link for creating the custom fields/adding tab pages
    adding custom tab in material master transaction
    Hope this helps
    Regards
    Shiva

  • Remove and add database in AG to enable service broker

    Hi All,
    Right now am testing in AG, I have a scenario where I created AG without enabling service broker, As per experts Service broker should be enabled first before AOAG since I did not, I remove the DB from AG enabled back service broker and the add back the DB
    it worked fine also as a point to make when i remove the DB I did not perform any backups in primary DB.
    I have 2 questions ->
    1) Is this above method correct
    2) Will removing and add a DB will affect the AG setup (though no backup will be performed)
    Thanks
    Best Regards Moug

    1. Yes you need to remove the database from the AG in order to enable service broker, so the process you've followed is fine
    2. That's no problem. If you remove the database from AG you can add it back in on the primary, then do a "Join Only" (no need for another backup and restore) and it should work fine. If it complains about the log chain not being recent enough
    you could take another tlog backup and apply it to the secondary and attempt to join again.

  • How do I find out who is attached to my sharing of my account and remove and add someone? Is 5 devices the limit?

    Devices sharing is 5?
    Where do I go to remove and add a devic

    Hey 1980justme!
    I have an article for you that can help you address this question:
    iTunes Store: Authorize or deauthorize your Mac or PC
    http://support.apple.com/kb/ht1420
    Thanks for coming to the Apple Support Communities!
    Regards,
    Braden

  • I have Adobe Design Standard CS6 purchased 2013 with serial number but cannot find to download it onto a new mac laptop. When I try and add the 24-digit serial number to my account it doesn't seem to work?

    I have Adobe Design Standard CS6 purchased 2013 with serial number but cannot find to download it onto a new mac laptop. When I try and add the 24-digit serial number to my account it doesn't seem to work?

    CS6 - http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html
    You can also download the trial version of the software thru the page linked below and then use your current serial number to activate it.
    Be sure to follow the steps outlined in the Note: Very Important Instructions section on the download pages at this site and have cookies enabled in your browser or else the download will not work properly.
    CS6: http://prodesigntools.com/adobe-cs6-direct-download-links.html

  • I get this message "The operation can't be completed because an unexpected error occurred (error code -50)" when I try and add any files to my Time Capsule

    I get this message "The operation can’t be completed because an unexpected error occurred (error code -50)" when I try and add or delete any files to my Time Capsule.  It just started happening a week ago.

    I would get an external drive today and copy all your stuff off the TC.. forget trying to load more onto it. There is a good chance after 3years (A 2TB should be only about 2years tops), the disk or the TC itself is on the way out. Do it immediately. If TM is also failing to backup you need to recognise symtoms of impending doom.
    Unfortunately the error messages are archane and it is hard to discover their meaning.
    You also cannot verify a network drive.. you can verify the TM sparsebundle though so do that.
    A5. http://pondini.org/TM/Troubleshooting.html
    Reboot the whole network from off.. certainly if you run later OS it can simply lose the drive..
    If you still fail to be able to copy to the TC.. then get that external and copy off it. Tell us if you can do that.

  • Can you explain when using keywords and addding them to various clips pressing ctrl and a number eg. 1 or 2 it simply closes down FCPX.  Just to the dock as would th yellow -sign. As you gather I am new to this program having only used Final Cut Express 4

    Can you explain when using keywords and addding them to various clips pressing ctrl and a number eg. 1 or 2 it simply closes down FCPX.  Just to the dock as would the yellow -sign.  I am new to this program having only used Final Cut Express 4 previously.
    iMac (early 2009) 24in 2.93GHz 4GB 1066MHz DDR3 SDRAM (To be upgraded ot 8GB in the nextfew days) os x 10.7.2 Lion
    Re: Why don't my arrows on the time line operate and allow me to move to the start and end of the timeline. Iam using the trial version 

    Check System Preferences. I think Control-1 is used by something in the OS now. Switch it off. It's a major p[ain the way the OS is taking over more and more of the keyboard, allowing less options for application use.

  • How to remove and add plotted data?

    In my code below I would like to add two buttons and by clicking on a button("Remove") it will remove one by one plotted data,and plot it back by clicking on the button("Add") such as the examples:
    Full data plotted by running the class
    Now by a single click on a Remove button last data point disappear
    another click and again last data point disappear, and so on
    The inverse operation would be performed by clicking on "Add" button: each click will add back a data point
    import javafx.application.Application;
    import javafx.beans.property.SimpleDoubleProperty;
    import javafx.event.EventHandler; 
    import javafx.scene.chart.NumberAxis;
    import javafx.scene.chart.XYChart;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.chart.LineChart;
    import javafx.scene.control.Button;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.BorderPane;
    public class XYMove extends Application {
    BorderPane pane;
    XYChart.Series series1 = new XYChart.Series();
    SimpleDoubleProperty rectinitX = new SimpleDoubleProperty();
    SimpleDoubleProperty rectX = new SimpleDoubleProperty();
    SimpleDoubleProperty rectY = new SimpleDoubleProperty();
    @Override
    public void start(Stage stage) {
    final NumberAxis xAxis = new NumberAxis(12, 20, 1);
    double max = 12;
    double min = 3;
    max *= (1+((double)3/100));
    min *= (1-((double)3/100));
    final NumberAxis yAxis = new NumberAxis(min, max, 1);
    xAxis.setAnimated(false);
    yAxis.setAnimated(false);
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
        @Override
        public String toString(Number object) {
            return String.format("%2.0f", object);
    final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis);
    lineChart.setCreateSymbols(false);
    lineChart.setAlternativeRowFillVisible(false);
    lineChart.setAnimated(false);
    lineChart.setLegendVisible(false);
    series1.getData().add(new XYChart.Data(1, 3));
    series1.getData().add(new XYChart.Data(2, 8));
    series1.getData().add(new XYChart.Data(3, 6));
    series1.getData().add(new XYChart.Data(4, 7));
    series1.getData().add(new XYChart.Data(5, 5));
    series1.getData().add(new XYChart.Data(6, 6));
    series1.getData().add(new XYChart.Data(7, 4));
    series1.getData().add(new XYChart.Data(8, 7));
    series1.getData().add(new XYChart.Data(9, 6));
    series1.getData().add(new XYChart.Data(10, 7));
    series1.getData().add(new XYChart.Data(11, 6));
    series1.getData().add(new XYChart.Data(12, 7));
    series1.getData().add(new XYChart.Data(13, 6));
    series1.getData().add(new XYChart.Data(14, 12));
    series1.getData().add(new XYChart.Data(15, 10));
    series1.getData().add(new XYChart.Data(16, 11));
    series1.getData().add(new XYChart.Data(17, 9));
    series1.getData().add(new XYChart.Data(18, 10));
    pane = new BorderPane();
    pane.setCenter(lineChart);
    Scene scene = new Scene(pane, 800, 600);
    lineChart.getData().addAll(series1);
    stage.setScene(scene);        
    scene.setOnMouseClicked(mouseHandler);
    scene.setOnMouseDragged(mouseHandler);
    scene.setOnMouseEntered(mouseHandler);
    scene.setOnMouseExited(mouseHandler);
    scene.setOnMouseMoved(mouseHandler);
    scene.setOnMousePressed(mouseHandler);
    scene.setOnMouseReleased(mouseHandler);
    stage.show();
    EventHandler<MouseEvent> mouseHandler = new EventHandler<MouseEvent>() {
    @Override
    public void handle(MouseEvent mouseEvent) {
        if (mouseEvent.getEventType() == MouseEvent.MOUSE_PRESSED) {            
            rectinitX.set(mouseEvent.getX());
        else if (mouseEvent.getEventType() == MouseEvent.MOUSE_DRAGGED || mouseEvent.getEventType() == MouseEvent.MOUSE_MOVED) {
            LineChart<Number, Number> lineChart = (LineChart<Number, Number>) pane.getCenter();
            NumberAxis xAxis = (NumberAxis) lineChart.getXAxis();
            double Tgap = xAxis.getWidth()/(xAxis.getUpperBound() - xAxis.getLowerBound());
            double newXlower=xAxis.getLowerBound(), newXupper=xAxis.getUpperBound();            
            double Delta=0.3;
            if(mouseEvent.getEventType() == MouseEvent.MOUSE_DRAGGED){
            if(rectinitX.get() < mouseEvent.getX()&& newXlower >= 0){   
                newXlower=xAxis.getLowerBound()-Delta;
                newXupper=xAxis.getUpperBound()-Delta;
        else if(rectinitX.get() > mouseEvent.getX()&& newXupper <= 22){   
                newXlower=xAxis.getLowerBound()+Delta;
                newXupper=xAxis.getUpperBound()+Delta;
            xAxis.setLowerBound( newXlower );
            xAxis.setUpperBound( newXupper );                       
            rectinitX.set(mouseEvent.getX());                                
        public static void main(String[] args) {
            launch(args);
    }Thanks!

    I would use an ObservableList (probably backed by a LinkedList) of XYChart.Data to store the collection of "deleted" data points. Create the buttons as usual; your "Remove" button's event handler should remove the last element of the series and add it to the first element of the deleted items data points. The "Add" button should remove the first element of the deleted data points and add it to the end of the series. You can bind the "disable" property of the remove and add button to Bindings.isEmpty(series1.getData()) and Bindings.isEmpty(deletedDataPoints), respectively.
    Something like
    ObservableList<XYChart.Data<Number, Number>> deletedDataPoints = FXCollections.observableList(new LinkedList<XYChart.Data<Number, Number>>());
    removeButton.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        deletedDataPoints.add(0, series1.getData().remove(series1.getData().size()-1));
    addButton.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        series1.getData().add(deletedDataPoints.remove(0));
    removeButton.disableProperty().bind(Bindings.isEmpty(series1.getData()));
    addButton.disableProperty().bind(Bindings.isEmpty(deletedDataPoints));The other approach would be to use a separate List for all the data points, and keep an integer variable storing the number of data points displayed. Your "remove" button would decrement the number displayed, and your "add" button would increment the number displayed. Both would also call
    series1.getData().setAll(allDataPoints.sublist(0, numberOfDisplayedPoints));You might even be able to make the numberOfDisplayedPoints an IntegerProperty and bind the data property of the series to it in a nice way. This approach probably doesn't perform as well as the previous approach (using a stack of deleted points), because you are not directly giving the chart as much detailed information about what has changed.
    Both approaches get problematic (in the sense that you need to carefully define your application logic, and then implement it) if the underlying data has the potential to change.

  • HT2409 I'm getting "can't add volume. Unknown error occured" when I try and add my Mac hard drive to the privacy settings

    I'm getting "can't add volume. Unknown error occured" when I try and add my Mac hard drive to the privacy settings

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Click the Clear Display icon in the toolbar. Then try the action that you're having trouble with again. Select any messages that appear in the Console window. Copy them to the Clipboard (command-C). Paste into a reply to this message (command-V).
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.

  • I converted a heap of music using 'switch', when i try and add this music to library iTunes will not load it??

    i converted a heap of music using 'switch', now when i try and add this to library itunes will not load???

    Unless the MUST be AAC, try FreeWMAtoMP3Changer: http://www.wma-mp3.com/free-wma-to-mp3-converter/
    The ONLY caveat with it is: You CAN'T drag & drop files on it to open them. You MUST use the browse function to select them. If you drag and drop, it multiplies the output files. A 10 track album will produce 45 converted files.

  • Exception thrown when trying to create MimeMessage

    Hello,
    I was working on the tutorial for sending SMTP messages using the JavaMail API. I set up the Session using Properties fine, but I begin throwing exceptions when trying to construct a new MimeMessage.
    Properties props = System.getProperties();
    props.put("mail.smtp.host", MAILHOST);
    props.put("mail.transport.protocol", "SMTP" );
    Session session = Session.getInstance(props, null);
    // Exceptions thrown below
    MimeMessage rfc822Msg = new MimeMessage(session);
    The exception error message I receive is:
    Exception occurred during event dispatching:
    java.lang.NoClassDefFoundError: javax/activation/DataSource
    at MailApplet.actionPerformed(MailApplet.java:30)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:10
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ton.java:1101)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    :378)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    er.java:204)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:2
    at java.awt.Component.processMouseEvent(Component.java:3165)
    at java.awt.Component.processEvent(Component.java, Compiled Code)
    at java.awt.Container.processEvent(Container.java, Compiled Code)
    at java.awt.Component.dispatchEventImpl(Component.java, Compiled Code)
    at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code)
    at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2068
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1852)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java, Compiled
    at java.awt.Container.dispatchEventImpl(Container.java, Compiled Code)
    at java.awt.Window.dispatchEventImpl(Window.java, Compiled Code)
    at java.awt.Component.dispatchEvent(Component.java, Compiled Code)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java, Compiled Code)
    at java.awt.EventDispatchThread.pumpOneEventForComponent(EventDispatchTh
    java, Compiled Code)
    at java.awt.EventDispatchThread.pumpEventsForComponent(EventDispatchThre
    va:95)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:90)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
    If you have any idea what is going on your help will be greatly appreciated.
    I am using the jdk1.2.2 build and the JavaMail1.2 distribution.
    Thanks,
    William Mapp

    Thanks for the help. Sorry I goofed. Now I have a question regarding what addresses you can send mail to. It seems that if I attempt send mail to a server other than the SMPT host I get a javax.mail.SendFailedException: Sending failed. The exception continues by stating that the address was Invalid, Relaying Denied.
    What does this actually mean? Should i be supplying more information?
    Thanks,
    Will

  • Exception Thrown When a Scheduled Task Runs for Many Hours

    In the Oracle documentation here (http://download.oracle.com/docs/cd/E10391_01/doc.910/e10367/toc.htm#CACGBDAD) it states that the below exception can get thrown when a scheduled task runs for many hours (on OAS) and can be ignored:
    Primary Server went down going to get a fresh object elsewhere in the cluster.
    com.evermind.server.rmi.RMIConnectionException: LRU connection
    Just want to find out from other users that get this error (If there is any), have you found the scheduled task actually completes, then the error is thrown or what?
    I just don't feel comfortable that one of our tasks is completing properly due to this exception occuring and causing the task to stop midway through processing...

    Hi,
    I've had trouble with scheduling PowerShell scripts in the past as well. You can try running your script in the SYSTEM context by launching a cmd prompt this way, just to verify that the issue isn't related to the account itself:
    http://myitforum.com/cs2/blogs/jmarcum/archive/2010/08/25/150872.aspx
    This method does require PSExec, there's a link to the tool in the post if you don't already have it on hand.
    You can also start PowerShell as SYSTEM and play around if you need to:
    http://blogs.technet.com/b/ben_parker/archive/2010/10/28/how-do-i-run-powershell-exe-command-prompt-as-the-localsystem-account-on-windows-7.aspx?Redirected=true
    Not the best answer, but hopefully it helps shed a little light on the issue.
    Good luck.
    Don't retire TechNet! -
    (Don't give up yet - 12,575+ strong and growing)

  • How to remove and add the component to JFrame at runtime.

    Hi
    How to delete the JTabbedPane component from the Jframe at runtime and how to add the same component with different data at runtime.
    But the remaining components should not distrub.
    When i try to delete and add the component at runtime the remaing components are distrubed.
    when i minimize and maximize the screen, the components are adjusted. but i need a help on this without minimize and maximize the screen.

    Hi
    I am sending my code snippet, please look into this......i am doing the same even though i am not able to..................can u suggest anything seeing this code snippet.
    here one function called createtabpane (It creates the JTabbedpanes with the table information at runtime).
    private void getTimeSheetObj(String weekDate){
    //Object[][] rowObj=null;
    try {
    System.out.println("Inside the gettimesheet method try block");
    if(projTables!=null){
    for(int i=projTables.length-1; i>=0; i--){
    JTable jt = projTables;
    jTabbedPane_Main.remove(jt);
    System.out.println("Removing Table:"+i);
    jPanel_Tabbedpane.remove(jTabbedPane_Main);
    jTabbedPane_Main = new JTabbedPane();
    jTabbedPane_Main.revalidate();
    jPanel_Tabbedpane.revalidate();
    getContentPane().validate();
    getContentPane().repaint();
    jTabbedPane_Main.addChangeListener(new ChangeListener(){
    public void stateChanged(ChangeEvent ce){
    getTabbedPaneListenerValues();
    // this.setState(JFrame.ICONIFIED);
    // this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    res = GetTimesheetResponseDocument.Factory.parse(new File("C:\\Narayana.xml"));
    response = res.getGetTimesheetResponse();
    proDets=response.getProjectDetailsArray();
    numOfPro = proDets.length;
    String taskDayValues[] = new String[8];
    System.out.println(numOfPro);
    proArr=new Object[numOfPro];
    Object[][] taskValues=null;
    for(int p = 0;p<numOfPro;p++){
    System.out.println("Inside1");
    taskDet = proDets[p].getTaskDetailsArray();
    taskValues = new Object[taskDet.length][8];
    for(int t=0;t<taskDet.length;t++){
    System.out.println("Inside2");
    taskValues[t][0] = (taskDet[t].getTaskName());
    taskValues[t][1] = (taskDet[t].getDay1HH()+":"+taskDet[t].getDay1MM()).toString();
    taskValues[t][2] = (taskDet[t].getDay2HH()+":"+taskDet[t].getDay2MM()).toString();
    taskValues[t][3] = (taskDet[t].getDay3HH()+":"+taskDet[t].getDay3MM()).toString();
    taskValues[t][4] = (taskDet[t].getDay4HH()+":"+taskDet[t].getDay4MM()).toString();
    taskValues[t][5] = (taskDet[t].getDay5HH()+":"+taskDet[t].getDay5MM()).toString();
    taskValues[t][6] = (taskDet[t].getDay6HH()+":"+taskDet[t].getDay6MM()).toString();
    taskValues[t][7] = (taskDet[t].getDay7HH()+":"+taskDet[t].getDay7MM()).toString();
    System.out.println("After taskvalues");
    proArr[p]=taskValues;
    createTabPanes(jTabbedPane_Main, proArr);
    System.out.println("outside");
    jPanel_Tabbedpane.add(jTabbedPane_Main);
    jTabbedPane_Main.getAccessibleContext().setAccessibleName("Proj");
    getContentPane().add(jPanel_Tabbedpane);
    pack();
    }catch(XmlException xe) {
    System.out.println("Inside the XmlException block");
    System.out.println(""+xe.getMessage());
    } catch(IOException ioe) {
    System.out.println("Inside the IOException block");
    System.out.println(""+ioe.getMessage());
    /* JOptionPane.showMessageDialog(null,
    "Values Displayed in the below tables",
    "Alert!",JOptionPane.ERROR_MESSAGE); */
    System.out.println("Initial JFrame Bounds:"+this.getBounds());

  • To remove (and add) a panel inside a dialog.

    hello
    I would like to change the layout of one dialog.
    I thought to do it by removing one panel an adding another.
    That is the code I wrote:
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    public class TestForChangePanel extends JFrame {
        PanelOne panelOne;
        PanelTwo panelTwo;
        public TestForChangePanel() { // costruttore
            panelOne = new PanelOne(this);
            panelTwo = new PanelTwo(this);
            changeThePanel(panelTwo);
            setSize(200, 150);
            this.setDefaultCloseOperation(EXIT_ON_CLOSE);
            setVisible(true);
        } // costruttore
        static public void main(String[] args) {
            TestForChangePanel testForChangePanel = new TestForChangePanel();
        public void changeThePanel(Component panel) {
            System.out.println("function to changethe Panel");
            if (panel instanceof PanelTwo) {
                remove(panelTwo);
                add(panelOne);
                System.out.println("put Panel One");
            if (panel instanceof PanelOne) {
                remove(panelOne);
                add(panelTwo);
                System.out.println("put Panel Two");
             validate();
        } // changeThePanel()
    }// class TestForChangePanel
    class PanelOne extends JPanel {
        JLabel labelOne = new JLabel("LABEL ONE");
        JButton jbOne = new JButton("Change");
        TestForChangePanel owner;
        PanelOne xxx = this;
        public PanelOne(TestForChangePanel ownr) {  // costruttore
            owner = ownr;
            this.add(labelOne);
            this.add(jbOne);
            jbOne.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    JOptionPane.showMessageDialog(null, "mouse panel ONE");
                    owner.changeThePanel( xxx);
        } // costruttore
    }  // class PanelOne
    class PanelTwo extends JPanel {
        JLabel labelTwo = new JLabel("LABEL TWO");
        JButton jbTwo = new JButton("Change");
        TestForChangePanel owner;
         PanelTwo xxx = this;
        public PanelTwo(TestForChangePanel ownr) { // costruttore
            owner = ownr;
            add(labelTwo);
            this.add(jbTwo);
            jbTwo.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    JOptionPane.showMessageDialog(null, "mouse panel TWO");
                    owner.changeThePanel(xxx);
        } // costruttore
    }  // class PanelTwoThere is not error in the execution of the code. But the layouth of the dialog does not change.
    Please, someone can tell me why the code doesn't work how I think it should have to do ?
    thank you
    regards
    tonyMrsangelo.

    I never had any problem with revalidate.I still don't understand the difference between validate() and revalidate(). The vast majority of time they are interchangeable and a repaint() is not required. However, I have noticed a few cases where validate() works and revalidate() doesn't (and vice-versa). I have also noticed a few cases where repaint() is required. Of course I can't remember all the situations, but here are a couple of examples showing problems:
    This posting shows a repaint() is required when removing a single component:
    [http://forums.sun.com/thread.jspa?forumID=31&threadID=789317&start=8]
    And this posting shows a repaint() is required when removing and adding a component (but only if the last component in the container is removed and added)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ValidateTest extends JFrame implements ActionListener
         JComponent north;
         int number;
         public ValidateTest()
              north = new JPanel();
              getContentPane().add( north, BorderLayout.NORTH );
              north.add( new JButton("Button1") );
              north.add( new JButton("Button2") );
              north.add( new JButton("Button3") );
              north.add( new JButton("Button4") );
              JPanel south = new JPanel();
              getContentPane().add( south, BorderLayout.SOUTH );
              JButton validate = new JButton("Validate");
              validate.addActionListener( this );
              JButton revalidate = new JButton("Revalidate");
              revalidate.addActionListener( this );
              JButton repaint = new JButton("Repaint");
              repaint.addActionListener( this );
              south.add( validate );
              south.add( revalidate );
              south.add( repaint );
         public void actionPerformed(ActionEvent e)
              //  repaint() is needed in this case
              int position = 3;
              //  repaint is not needed in this case
    //          int position = 0;
              north.add( new JButton( "" + number++), position );
              String command = e.getActionCommand();
              if ("Validate".equals(command))
                   north.validate();
              else if ("Revalidate".equals(command))
                   north.revalidate();
              else
                   north.repaint();
         public static void main(String[] args)
              JFrame frame = new ValidateTest();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.setSize(500, 200);
              frame.setLocationRelativeTo( null );
              frame.setVisible(true);
    You can even see in the JScrollPane tutorial they use revalidate without repaint when resizing the client area. I think, the key here is the "resizing" seems to automatically cause the area to be repainted.

Maybe you are looking for