Adding panel into JDialog at run time problem

Hi ,
I am adding one component at a time into the jdialog at run time.
What I do , when I launch jdialog instance first time I added one
component into the jdialog. when OI press next button it removes this
component and adding next one , but the problem is that is is not showing in the jdialog.
Please give me any idea that
How I can add component into jdialog at run time.
Thaks In Advance.
- vikas

Hello,
without source-code its difficult to understand where your problem is. The following sample code works 'fine':
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class AddCompoDialog extends JDialog {
     int compoCounter;
     public AddCompoDialog(){
          setLocationRelativeTo(null);
          setSize(300,300);
          JPanel mainPanel=new JPanel(new BorderLayout());
          JPanel buttonPanel =new JPanel();
          final JPanel compoPanel=new JPanel(new GridLayout(10,10));
          JButton newCompo=new JButton("add new Component");
          newCompo.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e){
                    compoPanel.add(new JLabel("Compo #"+ ++compoCounter));
                    compoPanel.revalidate(); //Dont forget to relayout your container
          buttonPanel.add(newCompo);
          JButton close=new JButton("close Dialog");
          close.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e) {
                    dispose();
          buttonPanel.add(close);
          mainPanel.add(buttonPanel,BorderLayout.NORTH);
          mainPanel.add(compoPanel);
          getContentPane().add(new JScrollPane(mainPanel));
     public static void main(String[] params) {
          new AddCompoDialog().setVisible(true);
}Regards,
Tim

Similar Messages

  • Adding complex computed column at run-time fails in PB 12.6

    I support a large 'vintage' application that was originally written in the late 90's, and has been migrated from version to version over the years.  Currently I'm working to get it working in PB 12.6 Classic, build 3506, migrating it from PB 11.5
    The first issue I've come across is that PFC treeviews are not working properly.  After some debugging, I determined that the cause of the failure is the PFC code's creation of 'key' column in the datawindows being used to populate each level.
    In the pfc_u_tv.of_createkey function, it looks at the linkages between the levels of a treeviews data, and then crafts an expression, and then uses that to create a computed column, which is subsequently used to uniquely identify the data.
    The expression is a series of string concatenations, such as this:
    expression='String(ctg_cd) + "#$%" + String(app_cd) + "#$%" + String(app_cd) + "#$%" + String(win_id) + "#$%" + String(ctg_cd) + "#$%"'
    This expression is then used in a modify statement to create the new compute key column:
    ls_rc = ads_obj.Modify("create compute(band=detail x='0' y='0' " + &
      "height='0' width='0' name=pfc_tvi_key " + ls_Exp + ")")
    In earlier versions, this works, and when you do a getitemstring afterward you get a long concatenated value that PFC uses to uniquely identify treeview items.
    Such as 'a/r#$%plcy#$%plcy#$%w_m_plcy_fncl_tran#$%a/r#$%'
    However, in PB 12.6, only the first portion of the expression is processed.  There is no error returned from the Modify function, and the column is created, but the expression is only evaluating one part of the expression.  In this partiular case, it results in
    'plcy'
    I just noticed that this isn't the *first* item in the set of concatenated columns and string literals, which is interesting.  In any case, when the computed key values are not correct, the whole method PFC is using to populate and run the treeview falls apart, and you get all children under each parent, and selections on the treeview object do not work properly because the key column values are not unique.
    I can copy the expression value from a debugging session, and use that to create a computed column at design time, pasting the expression in, and naming it the same as the created column (pfv_tvi_key), and this then allows the treeview to work properly.  However, this is a very cumbersome and problematic workaround.  The application has a lot of treeviews, with a very large number of datawindows operating as all the different types of items on different levels of different trees.  I don't think it's a practical workaround, and future maintenance would be very difficult.
    bu the workaround still demonstrates it is not an issue with the syntax of the compute expression, just an issue with the way it is handled by PowerBuilder when a column is created at run time,vs. at design time.
    Has anyone else encountered this issue?  I would think there are a fair number of older apps still around that are using PFC treeviews.
    My next step will be to install PB 12.6 build 4011 and cross my fingers.  Other than that, perhaps try 12.5?

    Updating the PFC layers has started to lead down a rabbit hole of hundreds and hundreds of errors.
    Granted, many of these are probably rooted in a few ancestor issues.
    But I'm not sure this will lead to a solution.
    The problem lies in using a modify statement to create a computed column at run time containing an expression with multiple concatenated values.
    If I look at the pfc_u_tv.of_createkey function from the newer PFC version, I see the same code there:
    ls_rc = ads_obj.Modify("create compute(band=detail x='0' y='0' " + &
      "height='0' width='0' name=pfc_tvi_key " + ls_Exp + ")")
    And the same code above it which creates the expression used in the modify.
    So after doing all the patching for the new PFC version, I somehow suspect I'll still be facing the same datastore.modify problem.
    Not to say that isn't a good thing to do, just not sure it addresses the root of the problem.

  • Jar run time problem

    Hi,
    I have an application in SWING where thumbnail images are being created at runtime and displayed in a ListCellRenderer. This is mainly used as a history feature where the user can click on that image and retrieve back the information.
    The problem is: when I run my code without an IDE it works fine as I am giving relative path names at all the places for storing the images. However, when I make a jar file, it is not able to read those images generated at run time.
    Is there a way to read runtime created files outside the jar file?
    Can someone help?
    Thanks in advance........

    sir,
    thanks for your reply.
    Again I give correct class path in Manifest.txt's
    Main-Class.
    ie., I am creating my mainclass as mainEMS.java and
    its .class file is lacated in D:/ram/classes/sdff
    folder. So I am giving the Manifest.txt ,the main
    class as " Main-Class: ram.classes.sdff.mainEMS
    fter that i give enter.
    then create the jar file.
    but, after creating jar file, it will again show,
    "Failed to load Main-Class manifest attribute from
    D:/kbs.jar "
    what's my problem.Does the file META-INF/Manifest.mf containt the Main-Class entry or do you have it only in Manifest.txt... there is a huge difference.

  • Applet run time problem

    i complie this applet but at run time "I/O EXCEPTION(the system can not find the file speciied)
    plz help
    import java.applet.*;
    import java.awt.*;
    import java.lang.String.*;
    class Hello extends Applet
    public void paint(Graphics g)
    g.drawString("Hello java",20,30);
    </applet code="Hello" height=100 width=100>
    </applet>
    */

    http://java.sun.com/docs/books/tutorial/deployment/applet/index.html

  • URGENT run time problems

    I am having the following problem with JDeveloper when i try to run a project. Any help would be appreciated :-
    I have a project that contains a JSP page and several .java files. The first time that i run the project, everything works fine, the project runs and is diplayed in IE without any problems. But any subsequent times that i try to the project i get the following error displaying in the JDeveloper message box :-
    Error starting HTTP-Server: Address in use: JVM_Bind
    Error creating the ORB :
    I have tryed terminating the server between each run but the problem still occurs. The only way to get the project to run again is to reboot my PC. Therefore i am having to reboot my PC everytime before i run a project. Any ideas on how to stop this would be appreciated.

    Hi, we have the same problem since we installed JDEV 9.0.3.1035 (no such problem in 9.0.2)
    Terminating the OC4J Server does not eliminate the problem. We ran our project, shut down the browser, terminated the embedded OC4J server and get the following when we try to run it again:
    C:\JDEV\jdk\bin\javaw.exe -ojvm -classpath C:\JDEV\j2ee\home\oc4j.jar -Dhttp.proxyHost=DELL -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts= -Xverify:none -Doracle.j2ee.dont.use.memory.archive=true com.evermind.server.OC4JServer -config C:\JDEV\jdev\system9.0.3.1035\oc4j-config\server.xml
    [Starting OC4J using the following ports: HTTP=8888, RMI=23891, JMS=9227.]
    [waiting for the server to complete its initialization...]
    Error starting HTTP-Server: Address in use: JVM_Bind
    Error creating the ORB :
    Oracle9iAS (9.0.3.0.0) Containers for J2EE initialized

  • Oracle Forms 10g run time problem

    Hello.
    I installed Oracle Dev 10g and I'm trying to use Oracle Forms.
    I configured all files like this:
    [steps in other post]
    1. Install the Jinitiator
    location: <devsuitehome>/jinit/jinit.exe
    2. edit the following files:
    a. <devsuitehome>/forms90/server/default.env
    where you set forms90_path=add your path to your library files (*.pll)
    b. <devsuitehome>/forms90/server/formsweb.cfg
    where you set workingDirectory=path to your *.fmx files
    3. at Forms Builder go to Edit/Preferences/Runtime
    then at the Application Server URL click "Reset to Default"
    4. before attempting to run your forms, run "Start OC4J Instance" first
    start/programs/oracle developer suite/forms developer/start oc4j instance
    After this, when I try to run the form, I don't get any error, but the browser opens and does nothing! Some times appears a small form to acces the data base, other don't, but it always stops!!
    Any ideas?!?
    Many thanks,
    Nuno

    Might also be worth turningon the Jinit console (you can do this from your windows Control Panel). And set the trace level to 5 (just press 5 when the jinit console appears).
    Then check error messages.
    Regards
    Grant

  • URGENT,,Form Run time problem

    Hi all,
    I just wondering whether you can assist me with the problem I have with running a form.
    When I try to Program Run Form, IE page opens and I have this error msg:
    "Bad Gateway
    The following error occurred:
    The IP address was not found during the DNS lookup. Contact your system administrator. (DNS_NO_DATA)
    -------------------------------------------------------------------Please contact the administrator."
    when I start the OC4J instance,
    It only gives me : "Oracle9iAS (9.0.2.0.0) Containers for J2EE
    initialized"
    I am using Window NT and Oracle 9i Database release 2 and Oracle 9i Developer suite Release 2
    I really appreciate if you can give me some assistance especially in setting up the DNS.
    Thanks
    Regards,
    Silva Hiendra

    The problem seems to be with privileges on the machine running Forms. This is what the online doc said about FRM-30087
    Cause: You lack privileges in the specified directory, or you do not have the disk space required.
    Action: Contact your DBA to make sure you have the access privileges you need.
    Hope this helps
    suvarna

  • Strange run-time problem

    I have a problem in my vi. When the vi loads up, everything seems to work fine, however I have two radio buttons at the top of the vi, and when I use them to select something my vi seems to freeze up. I've tried all kinds of debugging, and I can't find the error. I've also tried to eliminate all race conditions. Could someone please help me find the problem. Thanks!
    Attachments:
    UUT_io_setup_distrib.llb ‏329 KB

    Hi Marshall
    Your Problem Seems to Stem from the Fact that you have two Event Structures in One Loop. If you look up Caveats and Recommendations under event Structure in Labview Help, there is a Paragraph "Avoid Using two Event Structures in One Loop".
    I took your Vi and Did the following Experiments.
    1. Verified that the Vi does Hang as Claimed.
    2. I Put the Tab control at "TTL" and then Deleted the Event Structure form the case "RS232" and than Ran your Vi. It works fine.
    3. Instead of deleting the Event Structure totally, I deleted the event cases which are duplicated in the two event structures. "Yes" Value Change, "No" Value Change event and "Cancel" Event form event Structure under the RS232 Case. Left the timeout Case as is. I ran the Vi Again it Works Fine.
    I believe - The Problem is this. Each Event Structure waits for events it has been programmed for. The event structures are in the same loop. The Event structures themselves have no way of knowing that they are embedded in a case structure and only one of them needs to execute. So after the First event the Program kind of hangs as the second Event structure Waits indefinitely for the Program to Pass execution to it.
    So the Fourth Experiment -
    4. I Used a Local Variable to Change the Tab to RS232 if I was in TTL and to TTL from RS232 if I was in RS232. This Local Vaiables are under the Yes Value Changed Event And Now I checked the Program, If Clicked Yes The TTL Case Executes Changing it and Correspondingly Changing the NO value, then it Changes the Tab Value So on the Next Iteration of While Loop my Program is in RS232 Case and Event Structure Executes and puts the Tab Back to RS232. In effect I have Made My Program Go through Both Event Structures This Works Everytime Only when I click on YES. I click on NO and Program Hangs as I did Not Built the Same Functionality for this case.
    The Event Structures Cache the Events they have been Programmed for andthe First Event Must be Handled Before A second Event can take Place. In your Case One Event is in two Structures and at any given time One of these Structures executes. The Other Structure Waits and Inhibits furthur interaction till the Event generated can be handled by it.
    On a Side Note. It is Advisable to Create an Event Structure and Embed your Cases within them And Also have Only One Event Node to Handle One Event Such as "YEs" Value Change. So you know what is Going on. and easy to Maintain Code. Also It will Help If you could Club Similar Controls in an Array and handle them that way rather than individually
    I Hope I am clear in my explanation. I hope this is the reasoning why Your Program Hangs. I have attached your Vis slightly modified for you to see.
    Good Luck!!
    Good Luck!
    Mache
    Attachments:
    UUT_io_setup_distrib.llb ‏329 KB

  • Java Run-Time problems

    I am new to Java and am trying to write a simple program.
    The test class will instantiate an object of the "house" class which will in turn contain an array of 20 objects of the "player" class.
    Compiles with no errors or warnings, but gives an immediate:
    Exception in thread "main" java.lang.NullPointerException at test.main(test.java:6)
    test.java
    public class test
            private static house h;
            public static void main(String args[])
                    h.players[3].setName("john");
    }house.java
    public class house
            public player[] players = new player[20];
    }player.java
    public class player
            private static String name;
            public static void setName(String n)
                    name = n;
    }What seems to be the problem? To my untrained eyes I can't find any errors.

    alphacoder wrote:
    Thanks for the help. It fixed my problem.Good to know.
    How do I solve the 20 null references problem?That depends soley on what you want your class to do.
    Do I just initialize all 20 references in the house constructor?If you want it to always reference 20 persons, then do so.
    Alternatively you could track how many persons are currently in there and only add a new one when addPerson() is called (or something similar).
    Also, you should avoid this kind of direct access to other classes member variables, it's against encapsulation (that's probably something you'll learn later in the course/book/tutorial, but I'd like to mention it).

  • Dropdownbykey at run time problem

    Hi..
    i am creating the node and attaching attribute which has value set.
    i am binding the attribute to a dropdown key.
    when i select the values in dropdown, and in actions method if i dont perform any operations. It is working fine.
    when i select the values in dropdown, and in actions method if  perform any operations. i am not getting the selected value in dd.
    please help me..
    Thanks

    Hi Vimalraj Madhavan ,
               Usually the selected value will stay there in the drop down even after doing any action. what you can try is in youcode some where you might be clearing the attribute thats binded to the dropdown,
    you can put a debugger on the action you are triggering and check the code.
    or some where you are again calling the code to fill the value set, you can i think better check the code in modify view.
    the same problem will be there if you are doing the selection of a value in ddk and doing any other action (other than ddk action), i think
    Regards
    Sarath

  • Run time problem

    Hi !
    I'm new with Java and it will drive me nuts.
    I've to files in F:\javap\Familias:
    ModFam.java - where I've the main function
    Familias.java - some other classes and methods
    each file have the line:
    package Familias; at line 1.
    Ok.
    I compiled from f:\javap using:
    java Familias\*.java
    No errors and I've 3 class files in f:\javap\Familias:
    - ModFam.class
    - ModFam$1.class
    - Familias.class
    First question: what is the $1.class file ?
    Now I want to run the application from f:\javap\Familias as follows:
    javac -cp . Familias.ModFam
    and I get the message: Exception in thread "main" java.lang.NoClassDefFoundError: Familias/ModFam
    Second question: Why ? How should I run the program ?
    Thanks in advance
    <jl>

    Since you have your classes in a package, you class files has to be in a directory called Familias, and the CLASSPATH should be set to just before your Familias directory.
    Just compile as
    javac -d . *.java
    -d option just says where you want your source files, and it will also create the directory Familias for you.
    Then you run it with java, not javac, as:
    java -classpath . Familias.ModFam
    Btw, you have a package called Familias, and a class called Familias. The naming convention says that package names should start with lower case letter, so to avoid confusion, it would be better to rename your package to familias.
    I'm not even sure you can run your code now, because Familias.ModFam could mean either the class ModFam in the package Familias, or the inner class ModFam in the class Familias. I hope it will check for the package first.

  • Adding selection screen elements at run time

    Hi,
    I have a selection screen with four drop down list which has 20 elements.
    When i select any element from drop down, i must be able to add some other UI in the same line.
    DD1
    DD2
    DD3
    DD4
    If i choose a first item in DD1,
    DD1 Lable1 IP1 lable2 IP2
    DD2
    DD3
    DD4
    these lables and input fields are not known till selecting the item.
    Will i be able to do this in selection screen?
    Thanks
    Vimalraj

    Have a look at this Report. you have to Capture events on User Command and modify the screen accordingly.
    REPORT  ztesttt.
    PARAMETERS: test1(10) TYPE c MODIF ID sc1,
                test2(10) TYPE c MODIF ID sc2,
                test3(10) TYPE c MODIF ID sc1,
                test4(10) TYPE c MODIF ID sc2.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-group1 = 'SC1'.
          screen-active = '1'.
          MODIFY SCREEN.
          CONTINUE.
        ENDIF.
        IF screen-group1 = 'SC2'.
          screen-ACTIVE = '0'.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.

  • Run time Error : UNCAUGHT_EXCEPTION

    Hi Team
    Pls reply to resolve the below error
    When we are uploaded TB through flexible upload  and then Test run for Data Collection for that Cons unit, we got the below Run time error:
    Runtime Errors         UNCAUGHT_EXCEPTION                                                           Except.                CX_UCI_NO_CHECK     
    Short dump has not been completely stored                                                                               
    Short text                                                                               
    An exception occurred that was not caught.                                                   
    What happened?                                                                               
    The exception 'CX_UCI_NO_CHECK' was raised, but it was not caught anywhere                   
         along                                                                               
    the call hierarchy.                                                                               
    Since exceptions represent error situations and this error was not                           
        adequately responded to, the running ABAP program                                            
         'CL_UC_DATASTREAM==============CP' has to be                                                
        terminated.                                                                               
    Error analysis                                                                               
    An exception occurred which is explained in detail below.                                    
        The exception, which is assigned to class 'CX_UCI_NO_CHECK', was not caught and              
        therefore caused a runtime error.                                                            
        The reason for the exception is:                                                             
        An exception occurred                                                                               
    Missing Handling of Application Exception                                                        
        Program                                 UCUWB000                                             
    Trigger Location of Exception                                                                    
        Program                                 CL_UC_DATASTREAM==============CP                     
        Include                                 CL_UC_DATASTREAM==============CM003                  
        Row                                     150                                                  
        Module type                             (METHOD)                                             
        Module Name                             DTS_READ_TRANSACTION_DATA                            
    Source Code Extract                                                                               
    Line
    SourceCde                                                                               
    120
                 it_hry_field            = it_char_node                                         
      121
                 it_hry_field_attr       = it_char_attr_node                                    
      122
                 it_hry_node             = lt_hry_node                                          
      123
                 it_hry_attr_node        = lt_hry_attr_node                                     
      124
                 i_authority_check       = l_authority_check                                    
      125
                 i_keydate               = i_keydate                                            
      126
                 it_hry_nodename         = lt_hry_nodename                                      
      127
                 it_hry_attr_nodename    = lt_hry_attr_nodename                                 
      128
                 i_packagesize           = i_packagesize                                        
      129
                 i_cursor_mode           = i_cursor_mode                                        
      130
               importing                                                                        
      131
                 et_hry_data             = lt_hry_data                                          
      132
                 e_end_of_data           = e_done                                               
      133
                 et_message              = lt_message1                                          
      134
               changing                                                                               
    135
                 ct_data                 = ct_data                                              
      136
               exceptions                                                                       
      137
                 no_authorization        = 1.                                                   
      138
                                                                                    139
             if sy-subrc is not initial.                                                        
      140
               move-corresponding syst to ls_message2.                                          
      141
               raise exception type cx_uci_no_authorization                                     
      142
                  exporting ds_message = ls_message2.                                           
      143
             endif.                                                                               
    144
                                                                                    145
             if lt_message1 is not initial.                                                     
      146
               loop at lt_message1 into ls_message1.                                            
      147
                 move-corresponding ls_message1 to ls_message2.                                 
      148
                 insert ls_message2 into table lt_message2.                                     
      149
               endloop.                                                                         
    >>>>>
               raise exception type cx_uci_no_check                                             
      151
                  exporting dt_message = lt_message2.                                           
      152
             endif.                                                                               
    153
                                                                                    154
             call method dts_process_hry_result                                                 
      155
               exporting                                                                        
      156
                 it_hry_node          = lt_hry_node                                             
      157
                 it_hry_attr_node     = lt_hry_attr_node                                        
      158
                 it_hry_nodename      = lt_hry_nodename                                         
      159
                 it_hry_attr_nodename = lt_hry_attr_nodename                                    
      160
                 it_hry_data          = lt_hry_data                                             
      161
               importing                                                                        
      162
                 et_node_data         = et_node_data.                                           
      163
                                                                                    164
        call method lo_tx_data->read_data_from_infoprov                                      
      165
          exporting                                                                               
    166
            i_comp_s_field         = i_comp_s_char                                           
      167
            i_comp_s_kfig          = i_comp_s_kfig                                           
      168
            it_field               = it_char                                                 
      169
            it_kfig                = it_kfig                                                 
    Pls revert me immediately how to resolve the issue, i already do the following functionality as per OSS Note 1074424
    thanks & regards
    Madhu yl

    Hi Sanjyot,
    The solution is resolved by technical team ,
    I don't have suport documents to fulfill, they said they added data files and this run time occurs due to space problem
    Thanks
    Madhu
    Edited by: Madhu YL on Jun 10, 2009 1:32 PM

  • Add Jcombo in Jtable at run time

    hello,
    i want to add jcombo box in jtable every cell & i also add column in run time.proble is when i add new column that time last column combo is add but prievious column its remove automatic.
    so give me some code & where i can get see good example for add combo in jtable.
    thanks

    hi j-rg,
    It was really appreaciating to c ur reply, regarding the specific problem.Actually wht i was facing the peoblem, Am adding a colomn in the run time and in that column am adding a combo in each cells of that column.AS i was expecting am able to add a new colum in th erum time with the combo in each cells of that column,now when am adding another column in the run time am getting all the required things,but the problem is " in the previous cloumn am not getting that combo"(only the combo is been added in the last column).
    What am expecting is the combo should be there in each cell of the column(all columns)
    Am also sending the code wht am using, plz have a look below,
    df1.addColumn(result);
         TableColumn aa= tb1.getColumnModel().getColumn(tb1.getColumnCount()-1);
         aa.setCellEditor(new DefaultCellEditor(comboBox));
    wating for ur reply
    thanks and regards
    sandeep

  • INI instrument driver and fatal run time errors

    Hey everyone, I'm experimenting with the INI instrument driver and running into a fatal run time error.  Here's what I know so far:
    The runtime error only happens during the very first Ini_Putxxx
    It only happens if the target INI file does not yet exist.  After the file is created with a Ini_WriteToFile, then the program will proceed with all my Put functions without any errors.
    Ideas?
    Solved!
    Go to Solution.

    Are you sure about that? I just tried calling these functions in the Interactive Execution window without errors (the destination file wasn't there before the call and has been created without errors):
    #include "inifile.h"
    static int error = 0;
    static IniText T = 0;
    T = Ini_New (0);
    Ini_PutString (T, "General", "Item 1", "Test string");
    Ini_PutInt (T, "General", "Item 2", 123);
    Ini_PutDouble (T, "General", "Item 3", Pi ());
    error = Ini_WriteToFile (T, "C:\\test.ini");
    Ini_Dispose (T);
    Ini_PutXX functions do not make any disk access, they work entirely in memory; the only functions where the instrument accesses the disk are Ini_WriteToFile and Ini_ReadFromFile. Which error are you receiving? Can you post a sample code that exhibits the error?
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

Maybe you are looking for