Add a Component visually on a complete simple javabean

Hi all!
I wrote a simple javabean(jPanel, on this panel i have 1 jButton and some JLabels) in Netbeans.
I can use and display this Javabean in Netbeans(5 and 6). But i cant add visually an Component(like jButton) on the javabeans. the Components are positioned side by side. I want the button on the javabean(Panel) and not side by side.
Can somebody help me?
best regards??

Kayaman & CeciNEstPasUnProgrammeur,
Thanks for your input.
I cannot use an array as I do not know the number of components in advance. I could use JTable but I am not doing so now.
I have decided to use Vector as components can be added dynamically and retrieved. I have made sure that I have individual Vector classes for different group of items - one for JComboboxes and another for JTextFields. The challenge was how to change the textfield's values based on the combobox's selection. I overcame that by using setActionCommand() method to the combobox and listening for events. Do you think this is a good way or does it consume a lot of memory? Any input will be appreciated.

Similar Messages

  • No "Add DAQ Component" Dialog box after creating new project

    I'm using VS2012 and have installed Measurement Studio, NIDAQmx, drivers, VISA. When creating a new project in Visual Studio, I do the following:
    1. Select C# > Measurement Studio
    2. Select NI Windows Forms Application
    3. Give the project a name
    4. Click OK
    5. Measurement Studio Class Libraries window pops up and I check the boxes
    The project loads fine but I keep readin about an "Add DAQ Component" dialog box after doing the above steps. Since I don't have the box, I can't create new tasks (without writing th actual code). What am I missing? See attached picture for what dialog box I'm missing.

    Hi Musent,
    To see this dialog box, you'll need to create an NI DAQ Windows Application instead of a Windows Foms Application.
    Kristen

  • How to add HR component in Netweaver 2004

    Hi
    i was installed sap Netweaver 2004 successfully. It has BASIS, ABAP, BI components available by default.
    i want to add HR component. How to do it???? What is the Link in SMP?
    pls. provide solution
    regards
    raghu

    Reyes!
    Yes. i checked "Package level" from SPAM. It shows ONLY following components,
    BASIS        640  
    ABAP         640
    PI_BASIS   2004_.....
    BI               3.50 
    Now how do u add HR component, logistics and others.............
    Psl. provide solution.......... it's urgert..........
    regards
    raghu

  • How to add one component when some action take place

    Hi,
    i created a GUI using Netbeans Ide, In that i want add a component when i click some button
    i showed it here see the diagram
    [click here to see|http://www.mediafire.com/imageview.php?quickkey=jtgzjrfenwm]
    my sample code
    public class ProcessFiles1 extends javax.swing.JFrame implements ActionListener,
                                                        PropertyChangeListener{
        private JProgressBar progressBar;
        / Creates new form ProcessFiles1 */*
    *    public ProcessFiles1() {*
    *        initComponents();*
    *    /** This method is called from within the constructor to
    *initialize the form.*
    WARNING: Do NOT modify this code. The content of this method is
    *always regenerated by the Form Editor.*
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {====================================>here i am not adding Progress bar
                                                                                                                             to GUI
            jToggleButton1 = new javax.swing.JToggleButton();
            jToggleButton2 = new javax.swing.JToggleButton();
            jComboBox1 = new javax.swing.JComboBox();
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jComboBox2 = new javax.swing.JComboBox();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Admin@localhost");
            setIconImage(Toolkit.getDefaultToolkit().getImage("c:\\Logo.PNG"));
            jToggleButton1.setText("Select File");
            jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    FileChooser(evt);
            jToggleButton2.setText("Run Files");
            jToggleButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    addComp(evt);
            jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            jComboBox1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jComboBox1ActionPerformed(evt);
            jLabel1.setText("Success");
            jLabel2.setText("Faild");
            progressBar = new JProgressBar(0, 100);
            progressBar.setValue(0);
            progressBar.setStringPainted(true);
            jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            jTextArea1.setColumns(20);
            jTextArea1.setEditable(false);
            jTextArea1.setRows(5);
            jScrollPane1.setViewportView(jTextArea1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());=================>from here i am adding components
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(26, 26, 26)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 965, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jToggleButton1)
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jToggleButton2)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabel1)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(32, 32, 32)
                                    .addComponent(jLabel2)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addContainerGap(29, Short.MAX_VALUE))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jToggleButton1)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1)
                        .addComponent(jLabel2)
                        .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(26, 26, 26)
                    .addComponent(jToggleButton2)
                    .addGap(18, 18, 18)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 583, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(20, Short.MAX_VALUE))
            pack();
        }// </editor-fold>
    private void addComp(java.awt.event.ActionEvent evt)---------------------------------------->when 'runfile' button clicked i am
                                                                                      trying to add progressbar component it is not adding
           layout.addLayoutComponent("Progress", progressBar);
           pack();
         }how can i add progressbar when runfile button clicked
    please any one focus some light on this
    Thanks in advance,
    Nagaraju.
    Edited by: uppala on Dec 18, 2009 11:33 AM

    Well, normally the code would be:
    panel.add( someComponent );
    panel.revalidate();But since you are using the IDE to generate your code you need to learn and understand how to use the GroupLayout and all its constraints to add the component.
    My advice is to get rid of the IDE generate code and create the GUI yourself.

  • How To add One component to a TabbedPane

    Hi,
    I have a TabbedPane with four tabs in it
    the tabs are created dynamically it may be four or five
    i want to add only one component to it i.e JTable
    if i just add a component to the tabpan like below
    tabpane is an instance of JTabbedPane
    tableofvalues is an instance of JTable
    tabpane.add(tableofvalues); this code creates a
    default tab and add the component
    but i dont want the default tab i just want only the component
    can somebody please give me a solution for this
    give me the overiding function also

    i need to add one component which is common to all the tabs You can't. A component can only be added to a single container.
    However you might be able to share a model. For example:
    JTextField forTab1 = new JTextField("some data");
    JTextField forTab2 = new JTextField( forTab1.getDocument() );

  • JavaScript Function Calls it is called twice only when add the component

    Hi,
    I am developing a SAP Design Studio Extension and I noticed that when I add the component on Application, SAP Design Studio calls the JavaScript SDK Functions twice only when I drag and drop the component.
    I found out about this just put an alert message in which JavaScript Function (init, beforeUpdate and afterUpdate).
    Is it ok to work this way?
    I am really curious if anyone else has come across this issue.
    Thank you,
    Fabio Almeida

    Hi Fabio,
    Yes, there does appear to be an issue with SDK component functions being called twice.  Mike Howles has implemented a workaround in this Toolbar example code. Refer to the code in the this.init function at the end.
    Regards,
    Mustafa.

  • 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());

  • Can I add a component in root pane's layered pane

    Hi,
    I'm two months old to swing.
    My question is: Whether I can add a component at FRAME_CONTENT_LAYER in a layered pane of root pane or not.
    Pls help me out and give some links on this topic.

    But why din't you make a suggestionI did make a suggestion. Read the tutorial. The tutorial also has topics on how the Root Pane works if you look at the Table Of Contents. I don't fully understand the question but figured you should be able to test it out in about 1 line of code. Something like:
    add( someComponent, pickALayerHere);
    I have no idea what you are trying to do or why you are trying to do it. So I can't offer any other advice.
    Learn to ask a detailed question and you might get a more detailed answer.

  • How to dynamicly add a component to a panel

    when I click a button, I want to add a component to a panel, how can I do ?
    I try to do this:
    public void actionPerformed(ActionEvent e)
    contentPane.add(label,"north");
    contentPane.repaint;
    but there is no effect. Could u help me?

    Could you tell me why the repaint method doesn't work?repaint() does some low level validation and its more often suits for refreshing JList,TextFields etc etc...
    JPanel is somehow a more weighted component compared to JLabel,JTextFields etc,etc and hence it needs some heavy refreshing and these heavy refreshing can be obtained by doLayout() and validate() and some times both.
    when I add a component into another component, how can I get the new performace of the updated component?Is there a universal way? Pls put ur question more clearly.

  • Reposition buttons in add/remove component?

    Could anyone tell me if it is possible to reposition the buttons in an add/remove component?
    If you want the add all and remove all buttons they are grouped with either add or remove. I need to know if you can move them so that you have Add and Remove, then Add All, Remove All??
    Thanks,
    Matthew

    Have you looked into just using setStyle() for a button on the page?
    You can generate a string containing the position, visibility and other attributes of a component and then use setStyle() to set the attributes in the prerender phase.
    Just set the style string as a session bean parameter and alter it where ever you need to.
    I don't use add/remove components, but just standard components where I set the render and style properties accordingly to display and position them.
    null

  • Add WebServer component after 10.1.3.3 AS Installation

    We have installed OAS 10.1.3.3.0 on AIX. We only installed the J2EE component.
    Is it possible to add the webserver component??
    Thanks, Bas

    By "webserver component" I assume you mean Oracle HTTP Server (OHS) here. You can't really add OHS component in an existing Oracle Application Server Instance. You will have use the Oracle Installer to install it in a new Oracle Home and create a new Oracle Application Instance (that will contain OHS). But you can tie it up with your existing Oracle Application Server Instance (that has J2EE component) by having it in the same Cluster.
    Thanks
    Shail

  • How to import a simple JavaBean as a modelObject ?? -- Urgent

    Hi All,
         Taking leaves from the tutorial how to use EJB's in WebDynPro applications,   I am trying to use a SimpleJava bean as a modelObject  and instead of Using EJB's to persist data, I want to connect to the backend using the JDBC connection, So I have put on certain methods to getConnection() and one method to addUser( ) with in the JavaBean model class only.
    Now, after extracting out the bean jar and importing it as a model, while trying to  execute the addUser( ) from the JavaBean in the Save Action
      wdContext.currentUserInfoBeanElement().modelObject().addUser( )
    I get the error that the method modelObject is undefined for IPrivateResourceEntry.IUserInfoBeanElement( )
    It would be really helpful If somebody could suggest how do I solve this ? or better still some error free step by step way to use a simple javabean with methods.So that I am able to persist data from the model class only!!
    following is my JavaBean Model class
    public class UserInfoBean
         private String empId;
         private String name;
         private String primarySkill;
         private String designation;
         private String emailId;
         private String deskPhone;
         private String mobile;
         private String workLocation;
         private String photoPath;
         private Connection connection;
         private ResultSet rs;
         public UserInfoBean()
         public void execute()
         public void addUser()
              Connection connection = null;
              try
                   connection = getConnection();
                   String query = null;
                   PreparedStatement ps = connection.prepareStatement("insert into User (Employee_Id,Name,Phone1,Phone2,"+
                                                                     "Location,Designation,Technology,Email_Id,Photo_Path)"+
                                                                     "values(?,?,?,?,?,?,?,?,?)");
                   try
                        ps.setString(1,getEmpId());
                        ps.setString(2,getName());
                        ps.setString(3,getDeskPhone());
                        ps.setString(4,getMobile());
                        ps.setString(5,getWorkLocation());
                        ps.setString(6,getDesignation());
                        ps.setString(7,getPrimarySkill());
                        ps.setString(8,getEmailId());
                        ps.setString(9,getPhotoPath());
                        ps.executeUpdate();
                   catch(SQLException se)
                        se.printStackTrace();
                   catch(Exception e)
                        e.printStackTrace();
                   finally
                        ps.close();
              catch(Exception e)
                   e.printStackTrace();
         public static Connection getConnection() throws SQLException, ClassNotFoundException
              Connection connection = null;
              Class.forName(IConstants.SQL_DRIVER);
              connection = DriverManager.getConnection(IConstants.SQL_URL,IConstants.SQL_UN,IConstants.SQL_PWD);
              return connection;     */     
              java.sql.Connection connection = null ;
              try
                   InitialContext initialContext = new InitialContext();
                   DataSource dataSource = (DataSource)initialContext.lookup("jdbc/aliasforradar");
                   connection = dataSource.getConnection();
              catch (SQLException e)
                   e.getMessage();                              
              catch (NamingException e) {
                   e.getMessage();
              return connection;
    @return
         public String getDesignation() {
              return designation;
    @return
         public String getDeskPhone() {
              return deskPhone;
    @return
         public String getEmailId() {
              return emailId;
    @return
         public String getEmpId() {
              return empId;
    @return
         public String getMobile() {
              return mobile;
    @return
         public String getName() {
              return name;
    @return
         public String getPhotoPath() {
              return photoPath;
    @return
         public String getPrimarySkill() {
              return primarySkill;
    @return
         public String getWorkLocation() {
              return workLocation;
    @param string
         public void setDesignation(String string) {
              designation = string;
    @param string
         public void setDeskPhone(String string) {
              deskPhone = string;
    @param string
         public void setEmailId(String string) {
              emailId = string;
    @param string
         public void setEmpId(String string) {
              empId = string;
    @param string
         public void setMobile(String string) {
              mobile = string;
    @param string
         public void setName(String string) {
              name = string;
    @param string
         public void setPhotoPath(String string) {
              photoPath = string;
    @param string
         public void setPrimarySkill(String string) {
              primarySkill = string;
    @param string
         public void setWorkLocation(String string) {
              workLocation = string;

    Did you type casted modelObject to UserInfoBean.
    Like
    ((UserInfoBean)wdContext.currentUserInfoBeanElement().modelObject()).addUser();
    Regards,
    Ashwani

  • Disabled Add Button on Visual Adminitrator

    Hello there,
    I'm following this steps to add J2EE_admin user into the administartor users
    1. Start the Visual Administrator.
    2. Go to Server -> Services -> Security
    Provider
    3. Choose the ?Security Roles? tab.
    4. Choose component ?SAP-J2EEEngine?.
    5. Choose the ?administrators? role and
    choose the ?Add? under Users.
    6. Specify ?J2EE_ADMIN? and hit
    Search. Choose ?J2EE_ADMIN? and
    hit OK.
    7. Make sure the ?J2EE_ADMIN? user
    exists under Users.
    8. Choose KeyStoreViewCreator and
    make sure the user ?J2EE_ADMIN?
    is added to that role as well.
    The problem is that whem I get to step 5, the add button is disabled
    Any ideas ?
    Thank

    This is the error that I get when I try to deploy.
    PLease help me!
    Settings
    SDM host : vm2003server
    SDM port : 50018
    URL to deploy :
    file:/C:/DOCUME1/JOS1/CONFIG~1/Temp/temp17955JSP_teste_EAR.ear
    Result
    => deployment aborted : file:/C:/DOCUME1/JOS1/CONFIG~1/Temp/temp17955JSP_teste_EAR.ear
    Aborted: development component 'JSP_teste_EAR'/'sap.com'/'localhost'/'2008.01.20.13.59.18':
    Caught exception during application deployment from SAP J2EE Engine's deploy service:
    java.rmi.RemoteException: Only Administrators have the right to perform this operation.
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : The deployment of at least one item aborted
    Edited by: Jose Luis Gonzalez Clua on Jan 31, 2008 4:26 PM

  • Not able to add logical component

    I am creating a template project, where I have copied from existing one. Now I am trying to add a logical component in Solar_admin and getting an error "System landscape can only be changed in private templates Message no. SOLAR_SPROJECT048"
    Also log shows templates have the status Public: TEMPLATE_1 and way suggested in error as "Set all templates on the Templates tab page to Private and make the necessary changes. After you have made your changes, reset the status to Public. You can then copy the templates to projects."
    Please let me know how to do with path as I am new to Solman. Thanks in advance.

    Dear Dee,
    Here is some useful information of Templates that may help you resolve this problem.
    [Using Templates|http://help.sap.com/saphelp_sm70ehp1_sp23/helpdata/en/57/6934946046174a891ab1363c1d391a/frameset.htm]
    Regards,
    Paul

  • Filter AD Security Group and add member through visual webpart

    Hi All,
    I want to know how to Filter AD Security Group and add members to it from SharePoint 2013 Visual webpart, where i have multiple domains as well.
    Regards
    Rathanavel
    Rathanavel

    SP doesn't interrogate AD groups (DL's or SG's)... you'll need to query AD directly (ADSI).
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

Maybe you are looking for