How can i add new jcomponent to a frame?

hi.
how can we add new component to a frame? look at this code. Why when i click on button, nothing added to frame? event handled correctly and frame size changes but no button adds to frame.
private void convertButtonMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
JButton newButton = new JButton("new");
getContentPane().add(newButton , BorderLayout.CENTER);
newButton.setVisible(true);
setSize(500, 500);
}

Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
Well typically you wouldn't add a button to the Center of a BorderLayout. If you really want to do this you should be using a [Card Layout|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html].
In general the code for adding/removing components should be:
panel.add(...)
panel.revalidate();
panel.repaint();

Similar Messages

  • How can I add new content in iDVD to a DVD-RW disc which has ample remaining free space? After preparing the new video for burning and clicking on Burn to iDVD, I get a window saying the disc's already recorded and that I can either Erase or Eject.

    How can I add new content in iDVD to a DVD-RW disc with a video previously successfully recorded on it? (The disc has ample remaining free space.)
    After preparing the new video for burning and clicking in the File menu on Burn to iDVD, I get a window saying the disc's already recorded and that I can either Erase or Eject. My assumption has been that iDVD would automatically find the free space and continue with the new recording from there. I'd be grateful if anyone can shine light on this.

    There are, but not with a DVD written as a movie disk. It must be closed when completed, or it doesn't work.
    Apple's built in Burn utility also automatically closes any data CD, DVD or Blu-ray disk you burn. Doesn't matter how much space is unused, you can't use it. You'd have to use a more advanced disk creation app, such as Toast Titanium. I then have the option of choosing to write the data as a session:
    I can keep doing this until the disk is full. If I've written five sessions to the disk, when I put it in the drive, five CD/DVD icons will appear on the desktop since the OS will treat each session as if they are separate physical disks. At any point you choose Write Disk when writing a group of data, that means you're closing the disk, and again can't add anything after that. So if I had written two sessions, and the third was Write Disk, it's over. I can't put anything else on that disk.

  • How can i add new tab in Business Partner

    hi every body,
    Present i am working on SAP CRM 3.0 version. i need to add new tab in BP.  Here EEWB not available. How can i add new tab?

    Hi  babu,
    you can add new tab in Buisness partner with the help of screen configaration functionality,in screen configaration u select first bp role (sold to party or retailer etc) and click on process screen sequence  and again click on overview and u will get fields right side of the screen, there u will see the field "new screen" click on that and add description for new tab and click on continue,save the document
    now u will again create a bp with modified bp role u will see changes means u will see new tab page on perticular bp role
    i hope this is helpful
    Rewards points if helpful
    Thanks&regards
    kishore kumar

  • How can I add new songs to the top (not the bottom) of my playlist in iTunes?

    How can I add new songs to the top of my playlist in iTunes?
    I thought thats what it did before but now it automatically adds new songs to the bottom of the list.
    Not a huge issue but an annoyance.

    Go to your Music library
    Then, Click Playlist
    Then, Click the sort arrow until it points down.

  • I have one playlist on iphone4. how can i add new playlist without deleting old one. i do not have old playlist in itunes any more.

    I have one playlist on iphone4. how can i add new playlist without deleting old one. i do not have old playlist in itunes any more.When i try to sync iphone with itunes it says that this action will remove my old playlist and all songs.

    "it says that this action will remove my old playlist and all songs."
    Are you connecting to a different iTunes library than you normally connect to?  That will erase the songs and playlists since the iPhone can't be connected to multiple libraries even if it is in manual sync mode.
    If you no longer have access to the original library that your iPhone calls 'home', then the only way to save the playlist (and the songs on your iPhone) would be to use a 3rd party application to extract your iPhone contents to this new iTunes library you're trying to connect to.

  • How can I add new background on iweb?

    Dear all,
    somebody knows how can I add new backgroungs on iweb? and also how can I add my own themes?
    Cheers

    bobzhuman wrote:
    You can add new backgrounds in the "page"..."layout" section of the "inspector"...no limit to what you can add. Remember to use low resolution pics (72 dpi vs 300 dpi) and think of the size necessary for a "wallpaper" on your desktop. ex. http://www.desertmoon.net/Coryhamilton/Home.html done with a Jumsoft theme (baseball dark) as a core.
    The file used as a background on that site is located at http://www.desertmoon.net/Coryhamilton/Home_files/grunge.jpg
    It's dimensions are 1200px by 797px and 284k in file size. I guess there might be a reason to have the width set for 1200px even though file sizes could benefit from a smaller dimension repeating graphic, but running the file through Photoshop or even Elements would let the owner "Save For Web" as a .jpg - medium quality and get the file size down to about 108k so that the page would load quite a bit faster.

  • How can I add new row/column into existing jTable?

    Hi add!
    Can you help me how can I add new row/column into existing jTable?
    Tnx in adv!

    e.g
    Create two buttons inside the Table ( "Add New Row" ) and ("Add new Column")
    their handlers are:
    add new row:
    //i supose u already have
    DefaultTabelModel tablemodel = new DefaultTableModel(rowdata, columnNames);
    //and   
       JTabel jtable = new JTable(tablemodel);
    // Handler (row)
    jbtAddRow.addActionListener(new ActionListener(){
       public void actionPerformed(ActionEvent e) {
          if(jtable.getSelectedRow() >= 0 )
              tablemodel.insertRow(jtable.getSelectedRow(), new java.util.Vector());  
           else  
                tablemodel.addRow(new java.util.Vector());
        });to add new columns its the same but inside actionPerformed method:
    ask for e.g "Whats the name for the new column"
    then,
       tablemodel.addColumn(nameOfColumn, new java.util.Vector());   Joao
    Message was edited by:
    Java__Estudante

  • How can I add new songs and videos...?

    How can I add new songs and videos to my ipod without syncing as it wants to wipe out the ipod and replace all the existing media?

    On the ipod itself?  If so how?
    I've tried checking on box by the sync music to deselect "Entire music library", but get the  message about "Are sure.... All existing content on the iPod will be removed and replaced...".  However, I don't want to do that as there is music on my ipod I don't want to loose, got it from a previous computer that crashed and could not be recovered.

  • How can i add new files to my ipod from a different computer  without losing the added files on my ipod?

    how can i add new files to my ipod touch from a diferent computer without losing the added files already on my ipod?

    Email them? Use DropBox?  What type of files?

  • How can I Add new LookAndFel to IDE

    How can I Add new LookAndFel to IDE "JDeveloper 10g" ?
    (to the combo box in the Tool->Preferences->LookAndFeel ).

    Here is how you can add new L&Fs to the drop down list. (Instructions are for Linux , as I use Linux, but they will work for Windows too)
    Add the L&F jar to <path to JRE>/lib/ext (or <path to JDK>/jre/lib/ext). Then create swing.properties (if it does not already exist) in <path to JRE>/lib (or in jdk...) with following lines:
    swing.installedlafs = motif,windows,metal,mac,plastic
    swing.installedlaf.motif.name = CDE/Motif
    swing.installedlaf.motif.class = com.sun.java.swing.plaf.motif.MotifLookAndFeel
    swing.installedlaf.windows.name = Windows
    swing.installedlaf.windows.class = com.sun.java.swing.plaf.windows.WindowsLookAndFeel
    swing.installedlaf.metal.name = Metal
    swing.installedlaf.metal.class = javax.swing.plaf.metal.MetalLookAndFeel
    swing.installedlaf.mac.name = Mac
    swing.installedlaf.mac.class = com.sun.java.swing.plaf.mac.MacLookAndFeel
    swing.installedlaf.plastic.name = Plastic
    swing.installedlaf.plastic.class = com.jgoodies.plaf.plastic.PlasticLookAndFeel
    swing.defaultlaf=com.jgoodies.plaf.plastic.PlasticLookAndFeel
    Note that I retained default example L&Fs that normally come with the JDK/JRE (depending on the platfom) and added PlasticLookAndFeel as additional PLAF (Pluggable Look And Feel).
    Now it should be possible to choose Plastic L&F in not only JDeveloper but also other Swing apps that you want to use.
    Please let me know if this works and also if you have any questions.
    - Ganesh

  • How can i add new identity in file option of menu bar

    ''locking as a duplicate - https://support.mozilla.com/en-US/questions/869755''
    how can i add new identity option in file option of menu bar

    There are, but not with a DVD written as a movie disk. It must be closed when completed, or it doesn't work.
    Apple's built in Burn utility also automatically closes any data CD, DVD or Blu-ray disk you burn. Doesn't matter how much space is unused, you can't use it. You'd have to use a more advanced disk creation app, such as Toast Titanium. I then have the option of choosing to write the data as a session:
    I can keep doing this until the disk is full. If I've written five sessions to the disk, when I put it in the drive, five CD/DVD icons will appear on the desktop since the OS will treat each session as if they are separate physical disks. At any point you choose Write Disk when writing a group of data, that means you're closing the disk, and again can't add anything after that. So if I had written two sessions, and the third was Write Disk, it's over. I can't put anything else on that disk.

  • I have problem with my contacts.  I can't send message if the contact didn't send me a message before.  How can I add new address?

    i have problem with my contacts.  I can't send message if the contact didn't send me a message before.  How can I add new address?

    Hi tizac,
    You will want to add them to your Contacts. 
    There's a "+" button at the bottom of the contact list on the left to add a contact.
    If you need to add the email address or phone number to an existing contact, there's an Edit button at the bottom of the contact info (on the right).
    Once you have the contact email address or phone number you want to message to, scroll all the way down to the bottom of their information and there are options to:
    Send Message               FaceTime
    Share Contact             Add to Favorites
    Of course choose "Send Message" to send an iMessage to them and you will start a new chat.  You will be given the options of how to contact them, via phone number (if they are on an iPhone) or email (if they are on an iPod touch or iPad).   They do need to be signed up for iMessage or it won't allow you to send.
    ivan

  • How Do I add new fields to Repeating Frames in existing Report

    Hi,
    How do I add new fields to Repeating Frames in existing Report. The Report has 2 GRPFR, 1 HDR and 2 Repeating Frames. I would like to add a new field(column) to inner most repeating frame. I added the new golumn to QUERY and GROUPs in Data Model. After adding the new column to inner most Repeating Frame in Layout Model, the Layout model is losing all other frame and it is showing only the modified one.
    How do I add new column to repeating frames without disturbeing other frames.
    Any hellp will be appreciated!!!!!!!!!!!.
    I am using Oracle Reports 6i.
    Thanks,
    Ravi.

    you must work in your layour editor
    expand your repeating frames do it more big
    for add your new items or field. after you inserted or add, can you put more little your repeating.
    too can you to do one copy of one field in your repeating frame and assign it in his source your new item in your data model.
    normally i begin with the principal frame and go one by one internally.

  • How can I add new value in a list box in a screen

    Hi All ,
        In transaction CRMD_BUS2000120 (CRM Server), I need to add one value to the list box. Already 4 values are coming. How can I add 1 more value.
      any suggestion is very appreciated.
    Thanks & Regards,
      Shekar.

    Hi,
    Check you have any exits to do that, if there are no exits then you can Copy the program and change the code.
    to add the extra value in list box, you just have to append the new line to the internal table which you are passing to VRM_SET_VALUES FM.
    some thing like this..
    wa_list-key  = sy-tabix.
    wa_list-text = itab1-vbeln.
    Append wa_list to It_list.
    v_name = 'P_VBELN'.
    call function 'VRM_SET_VALUES'
      exporting
        id                    = v_name
        values                = It_list
    EXCEPTIONS
       ID_ILLEGAL_NAME       = 1
       OTHERS                = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Regads
    vijay

  • How can I add new photos to a saved photobook?

    I've started a photobook and saved it. All the pictures that were in the filmstrip but not placed in pages in the book are gone from the project. How can I add them back?

    Graham, switch to Grid view and drag the new photos to the book collection, which you'll find in the Collections panel.  Then flip back to the Book module and you'll find the photos sat there in the Filmstrip waiting to be added to the book design.

Maybe you are looking for

  • Windows Installation error 0x80070570

    hello, i have a big problem. I can´t install windows 7 64 bit on my new iMac 27" 3,4 Ghz. I need windows for school and working. I made the bootable usb stick and tried it to install with bootcamp. At the beginning succesfully, but when windows is ex

  • Final cut pro x/DVD studio pro

    A need an advice, I been using Final cut pro to edit my professional wedding videos and DVD studio pro to burn and make menus, can anyone recommend me another professional software to to create menus and burn DVD, my mac has an dvd drive built in, if

  • Levels of WBS elements

    Hi All, I am new to PS. Please explain me how to define the levels of WBS elements with examples... Thanks Sneha

  • Modify the videoembedplayer.aspx in Sharepoint 2013

    Hi All, As we all know that SharePoint has an OOB feature to play videos/Audios. The player which is used is Videoembedplayer.aspx I have a requirement, where in I would be playing only Audios, so the current VideoEmbedplayer.aspx treats an Audio as

  • Send custom error message using IDoc conversion rule?

    Hello, I am using an Idoc conversion rule in BD79 to load cost centers.  In my conversion rule I use a conversion exit function module to concatenate 2 specific characters and sending cost center value together and then this output value placed in th