Adding and Removing Components to/from a jPanel

Hello,
I am searching for a way to have a jButton create a remove and create some jComboBoxes, jLabels, and jButtons. I don't know how I could do this. I have some screenshots from NetBeans IDE to help illustrate my problem.
I want the Add Shift button in here...
[IMG]http://i271.photobucket.com/albums/jj132/Dunkmaster1992/javahelp1.jpg[/IMG]To do this...
<a href="http://s271.photobucket.com/albums/jj132/Dunkmaster1992/?action=view&current=javahelp2.jpg" target="_blank"><img src="http://i271.photobucket.com/albums/jj132/Dunkmaster1992/javahelp2.jpg" border="0" alt="Photobucket"></a>And obviously I would like the remove buttons to remove a shift when clicked.
Well, thanks for any help. I think this is pretty advanced if it's possible. I'm pretty sure I could manage doing this a slightly different way, but it would not look as pretty and I would have to limit the amount of shifts possible. I would otherwise approach this by doing this:
<a href="http://s271.photobucket.com/albums/jj132/Dunkmaster1992/?action=view&current=javahelp3.jpg" target="_blank"><img src="http://i271.photobucket.com/albums/jj132/Dunkmaster1992/javahelp3.jpg" border="0" alt="Photobucket"></a>It just isn't as professional. I would do it by just making the components visible and not visible with the button clicks. And changing the attributes of the components is easy. But I would also be limited to however many shifts I placed originally on the jPanel.
Duncan Calvert
[email protected]
Please, if it's not too much trouble, give me an e-mail when you respond.
Edited by: dw.calvert on Jul 22, 2010 2:36 AM
Edited by: dw.calvert on Jul 22, 2010 2:37 AM
Edited by: dw.calvert on Jul 22, 2010 2:39 AM

dw.calvert wrote:
I'm not sure why it's a bad thing to post a question on two different forums. It only means more views on the question.Yes, and many people wasting their time answering your question. There is nothing wrong with it as long as you mention that you have done so and provide reference to the other thread.
>
And I included my e-mail so that someone could ensure that I read their response. So, if someone replies a month from now, I will know about it, and won't have to check this forum everyday for the rest of my life.So set a watch on this thread and you will get an email from the forums. The spam search engines are happy for your posted email address, however.
And nowadays it would take less time to send a quick e-mail notification than to respond to this question.Thereby excluding everyone else that may have the same problem. Keeping the conversation here allows them to also get helped (if they bother to search, although most people don't seem to realise what Google and forum search functions are for).
>
I'm sorry if I'm not used to this forum, or it's traditions, but a picture is worth 1000 words and I always try to be efficient.As long as it is only "efficient" from your point of view. As it is more "effecient" for others to both keep the conversation here and to notify others of the cross-post.

Similar Messages

  • Adding and removing current user from one SharePoint group to another with event receiver

    hi friends
    i need to change current user from one SharePoint group to another with list item adding event receiver.
    please help me

    Hi Malli,
    Greetings. Its nt possible
    http://sharepoint.stackexchange.com/questions/42286/event-receivers-on-add-remove-users
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Best practice for adding and removing eventListeners?

    Hi,
    What is the best practice in regards to CPU usage and performance for dealing with eventListeners when adding and removing movieclips to the stage?
    1. Add the eventListeners when the mc is instantiated and leave them be until exiting the app
    or
    2. Add and remove the eventListeners as the mc is added or removed from the stage (via an addedToStage and removedFromStage listener method)
    I would appreciate any thoughts you could share with me. Thanks!
    JP

    Thanks neh and Applauz78.
    As I understand it, the main concern with removing listeners is to conserve memory. However, I've tested memory use and this is not really an issue for my app, so I'm more concerned if there will be any effect on CPU (app response) if I'm constantly adding and removing a list of listeners every time a user loads an mc to the stage, as compared to just leaving them active and "ready to go" when needed.
    Is there any way to measure CPU use for an AIR app on iOS?
    (It may help to know my app is small - I'm talking well under 100 active listeners total for all movieclips combined.)

  • How to remove an ImageIcon from a JPanel.

    I'm kind of new to java, and I'm trying to write a simple program that will change a picture in a window when a button is clicked. Is there a simple way to remove an ImageIcon from a JPanel. I tried the remove() method, but it says there is no constructor to handle remove(ImageIcon). This is the error I'm getting. I can/will post my code if you think it's necessary, but I didn't think it would be needed.
    PicChanger.java:64: cannot find symbol
    symbol : method remove(javax.swing.ImageIcon)
    location: class javax.swing.JFrame
    frame.remove(ii);
    ^

    Oh wow, that changes everything. Thanks for the information! Can't believe I missed that.

  • Dynamically adding and removing managed servers

    Hi,
              I'm experimenting with adding and removing managed servers while applications are running on the cluster. I've written some scripts using weblogic.Admin to do the tasks. It seems that it's working. However, I'd like to confirm that this is supported. I also have the following questions:
              1. Applications running on a cluster are automatically deployed to the newly configured managed server once it is started using startManagedWebLogic.sh. Are there any non-error situations that applications are not started automatically?
              2. To remove a managed server from the cluster, I first shutdown the server gracefully and then delete the server from the domain using weblogic.Admin. Is this the recommended way to do it?
              3. Anything else I need to pay attention to before adding and removing servers?
              Thanks for any information and pointers.
              Ming

    1. only if the staging mode is external.
              2. yes, if the server should be permanently removed. If the server is down for short maintenance, you do not need to remove it from the cluster.
              3. yes, try to avoid doing this during deployment tasks. That can be nasty.
              - Anders M.

  • UDO: Add and Remove rows to/from Matrix.

    Hi all,
    Yes, I know there are lots of topics about adding and removing rows but I was having trouble with these and I need some expert's opinion.
    I'm working with a Document type UDO, with 1 header table (ADAT_ONR) and 1 child table (ADAT_NR1 -  MatrixUID = "mtx_NR").
    I add the first row when the user chooses the business partner.
    If oMatrix.RowCount = 0 Then
         oMatrix.AddRow()
          oMatrix.AutoResizeColumns()
         oMatrix.Columns.Item("V_LineId").Cells.Item(1).Specific.Value = 1
    End If
    Then, the user has to press the AddRow button to add new rows, and the user can only add 1 new blank row. Later I'll change the row adding behavior to mimic B1s.
                If pVal.BeforeAction = False Then
                    Select Case pVal.ItemUID
                        Case "AddRow"
                            'ItemHandler_Click = AddRow(oCompany, oApplication, oForm, oForm.Items.Item("mtx_NR").Specific.RowCount())
                            oMatrix = oForm.Items.Item("mtx_NR").Specific
                            If oMatrix.RowCount > 0 Then
                                If Trim(oMatrix.Columns.Item("V_PltCode").Cells.Item(oMatrix.RowCount).Specific.Value) = "" Then
                                    oApplication.StatusBar.SetText(TranslateStr(oApplication, MustChoosePallet), BoMessageTime.bmt_Short)
                                    Exit Function
                                End If
                            End If
                            ItemHandler_Click = NewLine(oCompany, oApplication, oForm)
                            Exit Function
        Private Function NewLine(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application, _
            ByRef oForm As SAPbouiCOM.Form) As Boolean
            NewLine = False
            Try
                oMatrix = oForm.Items.Item("mtx_NR").Specific
                Dim Index As Integer = oMatrix.RowCount
                With oForm.DataSources.DBDataSources.Item("@ADAT_NR1")
                    .Clear()
                End With
                oMatrix.AddRow()
                oMatrix.Columns.Item("V_LineId").Cells.Item(Index + 1).Specific.Value = (Index + 1).ToString
                oMatrix.FlushToDataSource()
                oMatrix.LoadFromDataSource()
                oForm.Refresh()
                NewLine = True
            Catch ex As Exception
                oApplication.MessageBox("NewLine(): " & oCompany.GetLastErrorCode.ToString & ", " & ex.Message)
            End Try
        End Function
    When I Add or Update the data, I clear the last blank row, if it exists.
               '// In the Click Event
               If pVal.BeforeAction = True Then
                    Select Case pVal.ItemUID
                        Case "1"
                            If oForm.Mode <> BoFormMode.fm_FIND_MODE Then
                                oMatrix = oForm.Items.Item("mtx_NR").Specific
                                oMatrix.FlushToDataSource()
                                oMatrix.LoadFromDataSource()
                                If Trim(oMatrix.Columns.Item("V_PltCode").Cells.Item(oMatrix.RowCount).Specific.Value) = "" Then
                                    oForm.DataSources.DBDataSources.Item("@ADAT_NR1").RemoveRecord(oMatrix.RowCount - 1)
                                    oMatrix.DeleteRow(oMatrix.RowCount)
                                    'oMatrix.FlushToDataSource()
                                End If
                            End If
                    End Select
    My question is, Is there an easier way to Add and Delete Rows??
    BTW, I still have a problem so solve. With this code, when the user deletes a row the row numbering is incorrect. Example: if I have to rows in a matrix and I delete row nº1, row nº2 will hold the same number...
    Any Ideas?
    Thanks in advanced,
    Vítor Vieira

    Hi Victor,
    there is a Form Data event which you ca use in that try to write the code for adding a row after updating and delete a row while inserting and add a row while traversing.
    sample code.
    Sub FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean)
            Try
                Select Case BusinessObjectInfo.EventType
                    Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD, SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE
                        If BusinessObjectInfo.BeforeAction = True Then
                            objForm = objMain.objApplication.Forms.Item(BusinessObjectInfo.FormUID)
                            oDBs_Head = objForm.DataSources.DBDataSources.Item("@Header")
                            oDBs_Detail= objForm.DataSources.DBDataSources.Item("@Line")
                            objMatrix = objForm.Items.Item("83").Specific
                            If objMatrix.VisualRowCount <> 0 Then
                                objMatrix.DeleteRow(objMatrix.VisualRowCount)
                                objMatrix.FlushToDataSource()
                            End If
                            If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then
                                End If
                        ElseIf BusinessObjectInfo.ActionSuccess = True Then
                            objForm = objMain.objApplication.Forms.Item(BusinessObjectInfo.FormUID)
                            If BusinessObjectInfo.EventType =                    SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE Then
                                objMatrix = objForm.Items.Item("83").Specific
                                objMatrix.AddRow()
                                SetNewLineCharge(objForm.UniqueID, objMatrix.VisualRowCount)
                                objMatrix.FlushToDataSource()
                              End If
                        End If
                    Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD
                        If BusinessObjectInfo.ActionSuccess = True Then
                            oDBs_Head = objForm.DataSources.DBDataSources.Item("@Header")
                           oDBs_Detail = objForm.DataSources.DBDataSources.Item("@Line")
                            objMatrix = objForm.Items.Item("83").Specific
                            objMatrix.AddRow()
                            SetNewLineCharge(objForm.UniqueID, objMatrix.VisualRowCount)
                            objMatrix.FlushToDataSource()
                           End If
                End Select
                End Sub
    Hope this helps,
    OM Prakash

  • How can I find and remove duplicate photos from my computer?

    How can I find and remove duplicate photos from my computer?

    Terence,
    Yes, the duplicates appear in the iPhoto window. I have folders with same name occuring two or even three times sometimes with exactly the same set of photos (ie photos with the same ID) and sometimes with a limited set of photos. Other  folders appear only once.
    I normally take my MacBook with me if I'm shooting a lot of photos, such as on holiday, and then want to transfer them to my iMac when i get home. Other times I transfer the camera's memory stick directly to my iMac.
    I have great difficulty transferring the photos from my MacBook to my iMac. I don't want to store my photos on my iDisk due to the length of time it takes to upload them.
    Thanks again.
    Simon

  • Adding and removing plug-in - Gets dirty Catalog?

    Trying many plug-in, adding and removing it, could be a problem with the file Catalog?
    The removed plug-in leaves traces on catalog? E.g.: a bites growed catalog....
    Thanks

    Rob,
    What about your ExifMeta plug-in?
    How it works with the catalog?
    Is there a catalog working difference between ExifMeta and DevMeta plug-in?
    Thanks

  • Kill a thread and remove the element from the vector

    Hi All
    I have attached each Vector element to a thread which I later want to kill and remove that element from the Vector.
    Thread.join(milliseconds) allows this functionality to let the thread die after n milliseconds.
    However, I want to delete this element from the Vector now.
    Can someone please throw some light on this?
    Here the code I have written for this:
    try
         System.out.println(counter);
         int xCoord = generator.irand(25,200);     // X-coord of AP
         int yCoord = generator.irand(25,200);     // Y coord of AP
         listMN.addElement(new MobileNode((int)mnId,new Point2D.Double(xCoord,yCoord)));
         listMNcoords.addElement(new Point2D.Double(xCoord,yCoord));
         for(int i=0;i<vnuBS.returnBSList().size();i++)
              if(vnuBS.returnBSListCoords().get(i).contains(xCoord,yCoord)&&(vnuBS.returnBSList().get(i).getChannelCounter()<=3)&&(vnuBS.returnBSList().get(i).getChannelCounter()>0))
                   double c = exponential() * 10000;
                   long timeToService = (long)c;
                   System.out.println("BS "+vnuBS.returnBSList().get(i).id+" is connected to MN ");
                   vnuBS.returnBSList().get(i).reduceChannelCounter();
                   System.out.println("Channel Counter Value Now: "+vnuBS.returnBSList().get(i).getChannelCounter());
                   mobileNodesThread.addElement(new Thread(listMN.elementAt(mobileNodeCounter)));
                   mobileNodesThread.elementAt(mobileNodeCounter).setName(mobileNodeCounter+"");
                   mobileNodesThread.elementAt(mobileNodeCounter).start();
                   mobileNodesThread.elementAt(mobileNodeCounter).join(100);
    //                              System.out.println("Died");// thread dies after join(t) milliseconds.
                   System.out.println("ListMN getting generated : " + mobileNodesThread.get(mobileNodeCounter));
              else if(vnuBS.returnBSListCoords().get(i).contains(xCoord,yCoord)&&(vnuBS.returnBSList().get(i).getChannelCounter()<=0))
                   listMN.remove(this.listMN.lastElement());                         //dropcall
                   System.out.println("Removed "+mnId);
                   removeCounter++;
                   mnId = mnId--;
                   mobileNodeCounter--;
              mnId = mnId+1;
         Thanks a lot.

    I'm not sure if what you are trying to accomplish is correctly implemented.
    The method join does not kill the thread. It will wait for the specified time for the thread to exit. If you want the thread to run for a specified ammount of time, develop the run method of that thread with that in mind. Do not try to kill it from the outside, but let it terminate itself (gracefull termination).
    Now for your question regarding the vector (you should probably be using ArrayList nowadays): I would implement the observer pattern for this job. Make the threads post an event on the interface when they are done, let the main thread register itself with the threads and synchronize the method that handles the events. In that method you can remove the object from your list.
    I'm not sure if you want to use thread anyhow, could you tell us what it is that you are trying to accomplish?

  • Adding and removing tabs dynamically as in explorer

    adding and removing tabs dynamically as in explorer or firefox

    Think about how many translations are required to move your avatar, then think how many translations are required to move everything else in the entire world. Depending on whether there is more to translate in your avatar or in the rest of the world, you have your solution.
    Not knowing how your system works I can't really suggest anything further but could the collision avoidance be interacting with everything in the world as well? That would increase the workload somewhat.

  • [svn:fx-trunk] 12001: Make List itemEditor work with FTETextInput via textInputClass style and remove unused _itemEditor from Tree .

    Revision: 12001
    Revision: 12001
    Author:   [email protected]
    Date:     2009-11-19 11:47:24 -0800 (Thu, 19 Nov 2009)
    Log Message:
    Make List itemEditor work with FTETextInput via textInputClass style and remove unused _itemEditor from Tree.
    QE notes:
    Doc notes:
    Bugs: SDK24172
    Reviewer: Gordon
    Tests run: checkintests, list tests
    Is noteworthy for integration: no
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/List.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Tree.as
        flex/sdk/trunk/frameworks/projects/spark/MXFTEText.css

    This is a duplicate post.  This should be locked to avoid further confusion.
    My CSS wont change
    Nancy O.

  • [svn:osmf:] 16975: Fix bug FM-964, add media factory item for RTMFP multicast and remove the item from OSMFPlayer

    Revision: 16975
    Revision: 16975
    Author:   [email protected]
    Date:     2010-07-19 15:20:00 -0700 (Mon, 19 Jul 2010)
    Log Message:
    Fix bug FM-964, add media factory item for RTMFP multicast and remove the item from OSMFPlayer
    Ticket Links:
        http://bugs.adobe.com/jira/browse/FM-964
    Modified Paths:
        osmf/trunk/apps/samples/framework/OSMFPlayer/src/OSMFPlayer.as
        osmf/trunk/framework/OSMF/org/osmf/media/DefaultMediaFactory.as

    Welcome guy -
    Unless you are using Spry menus as a learning experience, you should move forward to a menus system that will display properly on the millions of portable devices that won't work with Spry which was deprecated 2 years ago.
    Many are using JQuery menus or pure HTML/CSS menus.
    If you wish to continue your Spry for learning experience, we'll be glad to assist; please let us know.
    By the way, your submenus are not showing because you need to add the red value to this rule in your vertical CSS
    ul.MenuBarVertical ul.MenuBarSubmenuVisible{
        width: 220px;
        left: 180px;

  • PowerShell script to find and remove duplicate items from document library

    Hi Friends,
    Please check this below script, It is finding the duplicate items and removing it. This script is not working to find the duplicate items from document
    library and remove. Can you please let me know where it is wrong.
    Add-PSSnapin microsoft.sharepoint.powershell 
    $web = Get-SPWeb -Identity "http://zapltvsspdev02:4333/bu/EXCO" 
    $list = $web.Lists["AECI Documents"] 
    $AllDuplicates = $list.Items.GetDataTable() | Group-Object INumber | where {$_.count -gt 1} 
    $count = 1 
    $max = $AllDuplicates.Count 
    foreach($duplicate in $AllDuplicates) 
    $duplicate.group | Select-Object -Skip 1 | % {$list.GetItemById($_.ID).Delete()} 
    Write-Progress -PercentComplete ($count / $max * 100) -Activity "$count duplicates removed" -Status "In Progress" 
    $count++ 
    Remove-PsSnapin Microsoft.SharePoint.PowerShell
    Note:
    In the above code, duplicates are found using the "INumber" column. 
    valmiki

    check this
    http://stackoverflow.com/questions/21337158/delete-duplicate-items-in-sharepoint-list

  • Search and remove subscribers manually from BC

    I am wanting to remove several subscribers from multiple email lists.
    Is this possible without having to scroll through countless pages from a variety of lists?
    We often get around a dozen people who mail in and say 'remove me from your list' as opposed to managing their account.
    In order to remove them I have to do the following.
    Choose the first email list of many
    change drop down display to 50 address
    click address column to sort into alphabetical order
    scroll through until I find the place where the email would be
    if there, delete
    if not there, assume its on a different list or they did actually unsubscribe as well as send the email to unsubscribe
    With tens of thousands of email addresses and multiple lists, this takes a long time.
    Is there a way to simply enter a search, then delete?
    The only way I could see at the moment is to export, excel search and delete then re-import. Don't really want to be doing that though.
    Many thanks

    Hi,
    In Admin, go to CRM > Search and lookup the user's e-mail address. Any user subscribing to a mailing list is turned into a CRM Customer. Once you find the contact, open it and go to "Subscriptions" and untick the respective list (all subscriptions will be listed on top, under "Campaign List")
    Kind Regards,
    Alex

  • PS script to disable users / Audit and remove Groups / Hide from GAL have bits but need to put it together

    Hi All
    I am trying to get a script together to run against a specific OU (our disabled Users OU) to make the process of leavers more automated.
    I am trying to achieve the 4 main outcomes below
    1. Disable User account 
    2. Hide from GAL
    3. Export users group membership to a file based on SamAccountName
    4. Remove users from all groups except domain users
    I have some parts of this working from other peoples scripts i have found on the web but need to tie it all together which is proving to be beyond my basic scripting ability
    Below is what i have so far, this does disable users / hide from GAL and remove groups however as stated i would really like it to export the group membership to a file before removing them so i have a record should a mistake be made.
    $users= get-aduser -Filter {(Enabled -eq "True")} -SearchBase "ou=Disabled Accounts,dc=test2k8,dc=local"
    Function RemoveMemberships
    param([string]$SAMAccountName)
    $user = Get-ADUser $SAMAccountName -properties memberof
    $userGroups = $user.memberof
    $userGroups | %{get-adgroup $_ | Remove-ADGroupMember -confirm:$false -member $SAMAccountName}
    $userGroups = $null
    $users | %{RemoveMemberships $_.SAMAccountName}
    ForEach ($user in $users)
    set-aduser -identity $user.sAMAccountName -Enabled $false -replace @{msExchHideFromAddressLists=$true}
    exit
    If there is anyone here that can help i would be very grateful
    Many Thanks
    Nick

    Try this:
    $Users = get-aduser -Filter {(Enabled -eq "True")} -SearchBase "ou=DisabledAccounts,dc=test2k8,dc=local"
    Function Remove-GroupMembership
    [CmdletBinding()]
    param
    [parameter(ValueFromPipeline=$true)]
    $Identity
    process
    if ($Identity -is [string] -or !$Identity.memberof)
    $Identity = Get-ADUser $Identity -properties memberof
    Write-Verbose -message $Identity.samAccountname
    foreach ($Group in $Identity.memberof)
    Write-Verbose $Group
    Remove-ADGroupMember $Group -confirm:$false -member $Identity
    $Users | Remove-GroupMembership -verbose 4> c:\users\mmcnabb\desktop\groups.txt
    forEach ($User in $Users)
    set-aduser -identity $user.sAMAccountName -Enabled $false -replace @{msExchHideFromAddressLists=$true}
    It uses the verbose stream to redirect the groups out to a text file of your choice. Please note this is untested so please use with caution.

Maybe you are looking for