Can't add in Swing components with Background

Alright, so I'm trying to add a background to an application I made. Looking through a bunch of 'tutorials', I found what I was looking for. And after trying to add the components I had on the application back again over and over, failing each time, I decided to finally come here.
Could anybody please tell me how I'd go about, where in the code, I would go about adding the components such as JLabels and JProgressBars again?
Thanks in advance,
Zach
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame
     JScrollPane scrollPane;
     ImageIcon icon;
     JFrame mainFrame;
     JTextArea textArea;
     JProgressBar progressBar;
     public Main()
          mainFrame = new JFrame("WQI - Sending data");
          mainFrame.setUndecorated(true);
          progressBar = new JProgressBar(0,100);
          progressBar.setPreferredSize(new Dimension(384,27));
          progressBar.setStringPainted(true);
          progressBar.setValue(65);
         icon = new ImageIcon("ScapeGaming.jpg");
         textArea = new JTextArea() {
           Image image = icon.getImage();
           {setOpaque(false);}
           public void paintComponent (Graphics g) {
             g.drawImage(image, 0, 0, this);
             super.paintComponent(g);
          textArea.disable();
         scrollPane = new JScrollPane(textArea);
         Container content = mainFrame.getContentPane();
         content.add(scrollPane, BorderLayout.CENTER);
         mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         mainFrame.setSize(404, 109);
          mainFrame.setLocationRelativeTo(null);
         mainFrame.setVisible(true);
     private void addComponent(Container container,Component c,int x,int y,int width,int height)
          c.setBounds(x,y,width,height);
          container.add(c);
     public static void main(String [] args)
          Main frame = new Main();
}

Yes, I did compile my code. It compiles fine.
And could you please explain how using BufferedImage and ImageIO would change anything?
Just to show a bit of what this topic is about, I guess:
Note the progress bar. Without the progress bar-adding lines, the background is there. With it, the progress bar is added but the background disappears (goes back to the regular 'tannish' BG.
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame
     JScrollPane scrollPane;
     ImageIcon icon;
     JFrame mainFrame;
     JTextArea textArea;
     JProgressBar progressBar;
     public Main()
          mainFrame = new JFrame("WQI - Sending data");
          mainFrame.setUndecorated(true);
          progressBar = new JProgressBar(0,100);
          progressBar.setPreferredSize(new Dimension(384,27));
          progressBar.setStringPainted(true);
          progressBar.setValue(65);
         icon = new ImageIcon("ScapeGaming.jpg");
         textArea = new JTextArea() {
           Image image = icon.getImage();
           {setOpaque(false);}
           public void paintComponent (Graphics g) {
             g.drawImage(image, 0, 0, this);
             super.paintComponent(g);
          textArea.disable();
         scrollPane = new JScrollPane(textArea);
         Container content = mainFrame.getContentPane();
         content.add(scrollPane, BorderLayout.CENTER);
          content.setLayout(null);
          addComponent(content, progressBar, 5, 5, 384, 27);
         mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         mainFrame.setSize(404, 109);
          mainFrame.setLocationRelativeTo(null);
         mainFrame.setVisible(true);
     private void addComponent(Container container,Component c,int x,int y,int width,int height)
          c.setBounds(x,y,width,height);
          container.add(c);
     public static void main(String [] args)
          Main frame = new Main();
}

Similar Messages

  • How can I add header on printing with Numbers

    How can I add header on printing with Numbers? The previous version use to have it and I cannot find it in the new one ...

    Hi Tanya,
    Glad to hear that you found how to edit page headers and footers in Numbers 3.2. I agree that Help in Numbers 3 is woeful. No searchable PDF to download and use offline. All is online (one page at a time) and we need to know the terms we are looking for before we look.
    The first HelpDesk:
    http://www.youtube.com/watch?v=pQHX-SjgQvQ
    For printing to paper where layout is important, I use Numbers '09 (Numbers 2.3) with its Print View. But it is orphanware. As the name suggests, there has not been a major overhaul since 2009. With that in mind, it is a useful version to hang onto while we hope and wait (and provide feedback to Apple) for something in future versions of Numbers 3.x to provide better layout capability.
    Indeed, each new update of Numbers 3.x has restored more of the old features while adding new features that are enhancements over Numbers '09. Many of the Numbers 3 enhancements reflect long-awaited wishes through this forum, and were passed on by Numbers Feedback to Apple. So it seems that Apple does take heed of feedback.
    In the meantime, I enjoy the charm of Numbers '09 whilst exploring the new features of Numbers 3.
    What has been GAINED in Numbers 3 is here:
    https://discussions.apple.com/thread/5473882?start=75&tstart=0
    (Very long thread because it started with Numbers 3.0, and enhancements have continued through Numbers 3.2).
    Hints on workarounds in Numbers 3 is here:
    https://discussions.apple.com/message/23622372#23622372
    Some workarounds are no longer needed, but what amazes me is how many Numbers '09 features (the so-called "lost" features) were not lost; the settings have simply been moved. Moreover, many features such as margin settings carry over with a Numbers '09 document or template into Numbers 3.
    Hints for layout on screen before printing to paper:
    Try Alignment Guides and Rulers as suggested here:
    Print View workarounds
    Use a layout guide:
    Layout Guide for Numbers
    Regards,
    Ian.

  • How to add the text box with background color in Acrobat 9 Pro ? (Urgent)

    I have previously used the Callout tool to add the comments in a PDF file, but the comments were difficult to read as some of them were mixed with the pictures just shown below. Therefore , I hope that there's a tool that can create the box with background color, but I cannot find such tool. What should I do ? Hope to get the answer ASAP, as it's very urgent !
    P.S. The picture below is represent the problem: the comment are difficult to read.

    In the properties of the callout comment you can change the fill color.

  • I can't add music to iTunes with latest software and updates.

    I just updated to Mavericks and I have version 11.1.3 (8) of iTunes.  I still had music in a folder that was not in the itunes media folder and now I can't add this music to iTunes or even play the music.  Is there anything I can do to fix this so I can add the music to iTunes?

    Just try to downgrade to older ITunes version, there's serioud problem with lastest ITunes upgrade.
    Time machine can fix this problem is ur latest backup was a few months ago and contains an older ITunes version.
    Version 11.3 doesnt support iPod classic & 3th gen Ipod & Iphone anymore.
    Its a matter of Apple politics.

  • Can you add Programs to Open With Menu

    Is there a way to add programs to the Open With Menu.  For example, when you right click on a file you can choose to open it with the default application by selecting Open, or choose other programs to open it with by selecting Open With.  Only a few of the programs that can open the files are listed.  Is there a way to add programs that I use to list in that list.  Right now, everytime I want to open something in a program that is not listed I have to go to Other... and find it in the Application folder.  Which is not too convenient.  Many programs that I use to open files are not listed for many types of file types, I open them frequently using the Open... window, and I was hoping that Mac would learn to add them, but it did not. 
    For example, I have VMWare with Windows 7 and Microsoft Office 2010 in it, my default application for WORD documents is Word for Mac 2011, but occasionally I need to open it in Word 2010 in Windows (Certain features that are missing in Mac Word), and I have to browse to fin the Word 2010 Application from the Application Folder.  Another example is a program (from the App Store) called ResizeIt (which resizes photos), I have to browse for it everytime even though it is an application just for images.
    So, is there a way to edit the Open With Menu for specific file types to include these programs that I use, or do I have to keep browsing to the Application folder and finding it there?
    Thank you in advance!!
    David

    http://apple.stackexchange.com/questions/15030/how-can-i-add-a-new-application-t o-the-open-with-menu
    No answer yet, but this group may come up with an answer for you guys

  • How can I add roles or features with using WMI?

    Can I add features in Windows server 2008/2012 with using WMI? I found only how to see installed features, but can`t found anything in my question. Can anybody help?

    Hi,
    I agree with Ed’s suggestion. Just in addition, you can install roles, role services, or features via
    Install-WindowsFeature PowerShell cmdlets. Please refer to following TechNet article and check if can help you.
    Install-WindowsFeature
    If any update, please feel free to let us know.
    Hope this helps.
    Best regards,
    Justin Gu

  • Can Free add-ons be downloaded with a single Adobe ID and applied to a classroom of computers?

    Can Adobe's free extensions and add-ons be downloaded with a single Adobe ID and applied to a classroom of computers? Specifically a situation where a computer technician has a request from a teacher for a particular free extension (such as Kuler) which the technician then downloads  with his or her Adobe ID and installs on all computers in a classroom.

    Hi,
    This question is difficult to answer because it depends how the classroom of computers were set up from a licensing perspective but in talking to some fellow Adobe colleagues we do think this is technically feasible. I do not have a classroom of computers to test this with to hand and even if I did it could be different to your environment so I would love for you to try it out and give it a go. Here's how I think this could work:
    Sign in to the Creative Cloud for desktops app with the Adobe ID you want to use. It should automatically sync and install your free extensions, if not you can force a reinstall here:
    http://creative.adobe.com/addons/my_addons
    Then repeat the process for each machine. If this does not work you can just download the extension and install it using Adobe Extension Manager CC on each machine, it's a little more work but that method will definitely work.
    Please let me know how you get on.
    Thanks,
    Jonathan

  • Can't add user after login with KDM

    Hi,
    I start kdm in rc.conf with reboot and login as user I setup Arch linux. It seems this user name is not admin and can't add other users.
    I may miss sth to do before I start KDE. What should I do?
    Thanks very much for help.
    Mike

    The issue is I can't see any users and groups existing by "users and groups" tool under systems of menu.
    Even I can add new user (this means I am admin), I can't change anything under "Login manager"
    What I should do first.

  • Can I add multiple swing elements on a single line.

    Im adding a number of labels to the JPanel -- is there a way to add them all on one line as opposed to:
    c.add(top1);
    c.add(top2); etc. etc.?

    Im adding a number of labels to the JPanel -- is
    there a way to add them all on one line as opposed
    to:
    c.add(top1);
    c.add(top2); etc. etc.?well you can do
    c.add(top1); c.add(top2);
    but basically no, you can't add them all together at the same time

  • Can't add vids to Itunes with windows vista

    Can anyone tell me why I can't add any vids from my computer on to Itunes. I have tried dragging video file on to Itunes but that doesn't work. Any ideas?

    Heres the fix.  I had to manually download iTunes 10.5.1 from Apple's website.  For some reason it wasn't auto updating.  After i finished installing, I opened iTunes, went to Store>Turn On iTunes Match. It prompted me to add my computer, and it went through the process.
    Here's the link for the current version of iTunes (10.5.1)
    http://www.apple.com/itunes/download/

  • Can't add WoW game Time with Firefox, what's wrong?

    I've tried adding WoW time to my account since last night. The Actual site Battle.net loads as it should, but the instant I click on account management or add game time it takes me to white background with barely click-able links. I put the code in the proper spot, clicked confirm, it asks add game time to wow press continue, but the continue button won't work. I'm confused by the website layout to begin with, never had this happen with Firefox before, please help. I'm running Windows 8 64bit.

    You can try these steps in case of issues with web pages:
    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and remove cookies only from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > "Use custom settings for history" > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Make sure that you haven't enabled a High Contrast theme in the Windows/Mac Accessibility settings.
    Make sure that you allow pages to choose their own colors.
    *Tools > Options > Content : Fonts & Colors > Colors : [X] "Allow pages to choose their own colors, instead of my selections above"
    Note that these settings affect background images.
    See also:
    *http://kb.mozillazine.org/Website_colors_are_wrong

  • Can't add a goods-issue with more than one item and one is serial managed.

    Hi,
    We are trying to issue more than one item to a production order using the DI API.  If none of the items is serial managed, they all are accepted and the goods-issue Add is successful.  If one the items is batch-managed, the goods-issue Add is also successful.  I am able to add the goods-receipt if I it contains only one item and it is serial-number managed.  However, if I’m issuing more than one item and one or more of the items is serial number managed, then the DI API will not add the goods-issue.  The error message that appears refers to an item that is not among the items being issued.  The message is:
    -10: (IGE1.WhsCode)(line: 3), ‘Item ‘A00006        ‘ with system serial 1 is not in stock.’
    Again item A00006 is not even in the group of items being issued.
    The code I am using for the serial number part is:
    With oGoodsIssue.Lines.SerialNumbers
              .SystemSerialNumber = rs.Fields.Item("SysSerial").Value
              .ManufacturerSerialNumber = rs.Fields.Item("MfrSN").Value
              .InternalSerialNumber = rs.Fields.Item("IntrSerial").Value
              .SetCurrentLine(n)
              .Add()
              rs.MoveNext()
              n += 1
    End With
    The rs is a recordset that the code is looping through as the serial numbers are being added.
    The error message does not occur during this code.  It occurs when it tries to add the full goods-receipt.  Does anyone have any idea how I can fix this?
    Thanks,
    Mike
    Edited by: Mike Angelastro on Mar 31, 2008 8:43 AM

    Hi Mike,
    Try to do the ".Add" only if you need it. Doing a ".add" without assignation may cause the error you have.
    I guess your n variable start at 1 or 0, so you could put code like this :
    With oGoodsIssue.Lines.SerialNumbers
    if n = 0 then (or 1, also I don't the correct syntax of your programming language)
    .Add()
    end if
    .SystemSerialNumber = rs.Fields.Item("SysSerial").Value
    .ManufacturerSerialNumber = rs.Fields.Item("MfrSN").Value
    .InternalSerialNumber = rs.Fields.Item("IntrSerial").Value
    .SetCurrentLine(n)
    rs.MoveNext()
    n += 1
    End With
    HTH
    Jodérick

  • Itunes 11.1.5.5 can not add files or folders with accents?

    Hello,
    I'm using Itunes 11.1.5.5 and when I use the add folder to my library all the files with no accents are added propperly but all those folders or files with an accent (á é í ó ú) that are commonly used in spanish are not well recognized and will add only the song without all the related information (artis, album, etc) so it is impossible to add an keep ordered. This didn´t happened to me in previous versions. Can someone help with a solution? Is this a bug and how can I solve?
    Thanks

    More details for this scenario. With only one file (song) with an accent, all the songs on that folder would be added with no tags under "unknown album" no artist. The same will happen for all the songs within a folder with an accent.

  • Can't add to portal favorites with "&" in the name field

    Hi there
    Interesting problem which has been identified this morning ... it appears that certain iviews cannot be added to the portal favorites, and upon closer inspection, it appears that those iviews all have the "&" character in the name field.
    For example, we have an iview with the name of "SAA013 Summary of Sales & Gross Margin vs Approved Plan". As you can see, its quite long, so anything to save some space.
    If I remove the & and replace with "and", then I can add to portal favorites.
    Has anyone else come across this and found an alternate solution? I could probably get away with convincing the client to allow "and" to be inserted, but then there's quite a few iviews that will have to be renamed, which is a rather tedious task.
    Cheers,
    Andrew

    Hi,
    For some reason the note wasn't released.
    Now it is released.
    Its content:
    Symptoms:
    Portal Favorite doesn't work for object that contain the symbol "&" in the name.
    Keywords:
    Portal Favorite, navigation
    Reasons:
    The problem was a missing in the encoding of the name
    Solution:
    Fix in SP12 patch #4
    SP13 patch #1
    SP14 Patch #1.
    Regards,
    Tal.

  • Can't add 2 IMAP accounts with same incoming server

    I'm trying to move all my email accounts from POP to IMAP. Where I have 2 (or more) accounts on the same mail server I can't create the second account - it says the IMAP server will not connect.
    I have tried adding one account then the other. Whichever I add first works and the second always fails.
    Any ideas please?

    Some mail servers are set to only allow a limited number of simultaneous connections from the same IP address. You need to check with admin of the mail server to increase the threshold if that is the case.
    Also the server administrator would able the check system logs to see if there are any login errors.
    I use apple mail and have 3 imap accounts on the same mail server functioning without issue. But I had to change a setting on the mail server to increase the max connections from the same IP. Luckily I administrate my own mail servers.

Maybe you are looking for

  • Migrating a table with BLOB field from SQL-Server to Oracle.

    Hi All, I'm trying to create a Class to migrate data from SQL-Server to Oracle, this table has a BLOB field. The Code: package br.com.infox; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql

  • Tiff bug in CS6 suite

    Hi, There is a big bug in the CS6 , tiff file format have change, and when i generate a tiff file ( flaterned image with alpha layer) in photoshop CS6 or after effect CS6, the alpha layer can not be used in indesign CS5, i need to open my tiff in pho

  • Unlimited Render of HDV footage painfully slow

    i am currently working with a 10 min HDV 1080i50 sequence, on a 2 x 2.8 Quad Core Mac Pro running 10 GB of RAM. Within Final Cut Pro i need to render "Unlimited" and "Full" segments. The "Full" segments rendered at normal speed, but the"Unlimited" se

  • Clips from Panasonic ag-ac160 has unsupported compression type with new Premiere update

    Updated Premiere Pro and now my Multicam project is not supporting the files from my Ag-ac160 camera. The files from the Canon 5d work fine but won't load the others. I am going to do a system restore until this is fixed.

  • After Backup In iTunes - All Media Content Is Deleted - iPhone 3G 16GB/8GB

    I have the latest iPhone Update 3.1 on my wife's 8GB 3G & my iPhone 16GB 3G - We are running the latest iTunes on a 2008 intel iMac. Using separate Logins on iMac. Strange things have happened since backing iPhone up in iTunes 9 today. (Previous Back