JPanel with Image just doesn't want to show

Hello,
i am trying to create a JPanel with a JLabel to which i assign an ImageIcon, but for some reason the JPanel seems not to appear in my JFrame.
Here's the code: private void jbInit() throws Exception
    NumberListener numListener = new NumberListener();
    frame = new JFrame();
    frame.setTitle("Error Manager");
    frame.setLayout(new GridBagLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.gridx = 0;
    gbc.gridy = 0;
    numberList = new JList(numbers);
    numberList.addListSelectionListener(numListener);
    numberList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane listScroller = new JScrollPane(numberList);
    listScroller.setPreferredSize(new Dimension(250, 80));
    frame.getContentPane().add(listScroller, gbc);
    imgPanel = new JPanel();
    imgPanel.setSize(300, 250);
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Image img = toolkit.createImage("Somepic.png");
    imgPanel.add(new JLabel(new ImageIcon(img)));
    gbc.gridx = 1;
    gbc.gridy = 0;
    frame.getContentPane().add(imgPanel, gbc);
    frame.pack();
    frame.setVisible(true);
  }

Sorry forgot to close the code tags...
private void jbInit() throws Exception
    NumberListener numListener = new NumberListener();
    frame = new JFrame();
    frame.setTitle("Error Manager");
    frame.setLayout(new GridBagLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    gbc.gridwidth = 1;
    gbc.gridheight = 1;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.gridx = 0;
    gbc.gridy = 0;
    numberList = new JList(numbers);
    numberList.addListSelectionListener(numListener);
    numberList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane listScroller = new JScrollPane(numberList);
    listScroller.setPreferredSize(new Dimension(250, 80));
    frame.getContentPane().add(listScroller, gbc);
    imgPanel = new JPanel();
    imgPanel.setSize(300, 250);
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Image img = toolkit.createImage("1_Alpinweiss_III.png");
    imgPanel.add(new JLabel(new ImageIcon(img)));
    gbc.gridx = 1;
    gbc.gridy = 0;
    frame.getContentPane().add(imgPanel, gbc);
    frame.pack();
    frame.setVisible(true);
  }

Similar Messages

  • MRP with PD, it doesn't want to show me UNPLREQ based on forecast.

    Hi guru's!
    I work on a new project. I use PD as planification type.
    The target is to take in account in MRP only the PLDORDER proposals (not converted in Production Order), the companie update the stock manually with MIGO to erase PldOrder at each new MRP run. (They don't want to create and manage master data as componants, BOM or routings)
    Material master have forecast view, and historic of consumption are copied from past sales results.
    They want to use a dynamic safety stock, which is calculated thanks to MP38. This lunch calculation of forecast collectively to create UNPLREQ in MRP every month based on the historic.
    I've done the customizing, and my MRP work correctly : UNPLREQ was here and the update of stock with MIGO was good (after a MRP run PLDORDER were erased).
    But after some change in customizing, I don't retreive my first situation, in fact UNPLREQ (neither none requirement) are shown now in my MRP.
    I don't retrieve my mistake in customizing... Please, is somebody know where something can change the fact that you can't see the requirements in MRP??? the problem not comes from my material master data, i'm sure of that!! it's in the customizing.
    I hope you have all need to answer.
    Thanks in advance.
    JC

    Dear R.Brahmankar,
    Your note, even if it's for an old version of SAP, is helpfull for me. I will try to create my own planification type with the same configuration than PD but changing forcast to mandatory. I will test it and we will see after...
    In fact, before my example "crash", I have tested plan. type VV and VM. So, as forcast is mandatory in this case but it's not work too, there is something which is "bizarre"!! Moreover, I've try the two way of enter forcast historic (non planned consumption and total consumption) for my article in forcast view.
    JH,
    My requirement was not replace in independant requirement (MD61).
    Thanks, I will re-post something if I find a my mistake.!!

  • Ipod 20 Gb click wheel just doesn't want to turn on

    I received my ipod one year ago and till last week I have never had any problems with it.Since last week it just doesn't want to turn on.I have done every step that it is said on the site that i should do in this situation and my ipod still doesn't turn on.When i try to restart it,it shows me the apple icon but it does not go any further.I can't get into my menu not even after I placed it on the Disk mode.I can hear it trying to open but never succeds.What am I supposed to do?And even if I should get it to a Service I don't even know where I could do that in Romania.
    I would appreciate any kind of help.
    Windows   Windows XP Pro  

    Have you seen if these articles help?
    iPod won't turn on
    iPod stops responding or won't wake from sleep
    -Kylene

  • Hey How Do I Get Group Message On The IPhone 4s because some reason it doesn't want to show . First i did is setting then messages  it only show imessage and message count )HELP)

    ey How Do I Get Group Message On The IPhone 4s because some reason it doesn't want to show . First i did is setting then messages  it only show imessage and message count )HELP)

    At the bottom of the page Settings > Messages you should have a section headed "SMS/MMS" Turn MMS messaging on then you can turn group message on.

  • My iMac keeps waking up or it just doesn't want to sleep.

    My 2009 iMac wakes up spontaneously or doesn't want to sleep. I have made sure no keys were pressed, no programs running, and the system doesn't wake from network activity. Is there a way to fix it? It all started as soon as I installed Yosemite.
    Thanks!

    I had a problem similar to this and the problem was my mouse (what kind of mouse is on the Mac?) - it was so sensitive that very minor vibrations (like a door closing or a big truck driving by) would cause it to wake up the computer when I had put it to sleep. I simply power down my mouse after putting my Mac to sleep and the problem went away. Turn on the mouse and move it a bit and the system would wake up when I wanted it to, not randomly any longer...
    Another possible issue is waking up from network accesses - this is in the "Energy Saver" System Preferences pane (in the Power Adapter tab) - do you have other computers or devices that might be trying to access the iMac while it was asleep?
    Good luck...

  • Hide/Delete, do something with information I don't want to show - help!

    Hi everyone,
    I hope you can help me out.
    I current have to submit pdfs to our auditors to backup financial information.
    I have a 2 page document that I need to submit however, on the second page there is information that I do not want to show the auditors.
    I am hoping for a way to hide the information with a rectangle and then fill it in with black (or white) or something like this so that they will not be able to see this information.
    How can I do this?
    I am using Adobe 9 Pro (the free trial version)
    I have managed to put a rectangle around the information I want hidden, but can't figure out how to hide it.  The pdf that I am using does weird things if I try to use the text tool and delete the text, so I was hoping for a quick and easy way to cover the information.
    Thanks in advance for any help you can provide!

    Use the redaction tool.

  • I just downloaded 4.0.1 and now half my bookmarks are gone including the toolbar bookmarks, and its screwing with my printers & doesn't want to load stuff. What Is WRONG

    How do I go back to the previous version and settings?

    It is best not to open the places.sqlite database file because it is organized in a way that is not easy to comprehend and uses a complicated set of tables.
    You can opt to create a separate profile to inspect and possibly export the bookmarks that are stored in this file.<br />
    If both profiles are open at the same time by using the -no-remote command line switch then you can also move bookmarks via the clipboard.
    *http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    *http://kb.mozillazine.org/Opening_a_new_instance_of_Firefox_with_another_profile
    *https://developer.mozilla.org/en/Mozilla/Multiple_Firefox_Profiles

  • Bluetooth just doesn't want to work

    I have a new mac pro that I am trying to sync with my mac book pro. For some reason, neither computer seems to find any other bluetooth capable machines. Both have the bluetooth on and are discoverable. Anybody know what's going on? I also have a lot of contacts on my LG V phone which I would love to get on the new computers. My phone seems to recognize my computer but then it doesn't seem to want to sync anything. Anybody have ideas for me? Thanks.

    Ok, i`ve installed blueman and everything works...

  • Gmail doesn't work and I tried everything there is on these forums, it just doesn't want to work for me

    gmail won't work in Firefox for me and I literally went to every forum an threat I could find and followed all of these instructions but I just can't get the damn thing to work, i even installed the Gmail panel app but I just won't work, it gives me the standard message that I need to enable my cookies, privacy, ... etc and I did all of that and all of the the other stuff (clear cache & cookies, change to 'no proxy', made a new profile, changed the file manually in the folder, etc.) and it just won't work and it's driving me insane. This made me change to chrome last year but that takes too much memory and I just love firefox. pls don't tell me I need to keep chrome installed just to read my mails there because this is ridiculous. pls help

    I would advice you not to follow the above advice as that will cause you to delete the Firefox profile folder and you lose all your personal data (bookmarks and other data).
    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

  • FaceTime just doesn't want to work.

    Hi,
    I'm really struggling with my iPhone 4S and FaceTime so hoping someone will have some logical guidance for me!
    So, UK customer, on Three, but know FaceTime needs wifi - fine.
    Trying to call my sis, also iPhone 4 user. On her home wifi, also a Three customer.
    Not working.
    We have both tried reading through help material online and getting know where fast....
    Tried resetting, turning messaging off and on - most normal routes to try to get the darn thing going - but nothing.  It comes up with an error message saying "Not available for FaceTime"..... thoughts anyone?!
    Thanks.

    Hi rizkallah,
    Do we need to turn the cell network off and just leave the wifi on?!
    We've signed out and in and back and fourth..... still can't get it working! GRRRRR

  • JPanel with image in it... truncated

    Hi, for my app i have used multiple nested jpanels. But in one step of nesting, all the sudden my panels are truncated, i have the picture here. i have noticed that this is due to setLayout(null). When i comment this line in my panel, this works fine, but i need layout to be null because i need to put some more images in it..
    http://img527.imageshack.us/img527/2156/picbf1.th.jpg
    Please help

    when your layout is set to null, then you are not using a layout manager, and you are fully responsible for making sure that all pictures and components are laid out correctly.
    Putting multiple images on a panel are not a contraindication for using layout managers. Consider using layout managers here. Either that, or make sure you are setting up all your positions and sizes correctly.

  • Exporting report to Excel, image doesn't want to show

    I have a report that has the client's company logo located in a narrative inside a report. The image is placed in the correct location as per the other posts on the forums. When I run the report and download to Excel, the image shows up as an x in Excel. Tried to use both of these syntax:
    <img src="images/Logo_stacked.jpg" alt="" border="0">
    <image src = "res/s_oracle10/images/Logo_stacked.jpg">
    Neither showed up in Excel. There is probably something that I am forgetting or setting somewhere, but any help would be appreciated. Thanks!
    Michael

    Hi There
    This is known bug from Oracle. The issue is related to Java version, you would encounter this if you are using Java 1.6, please downgrade to Java 1.5 and it would work.
    Hope this helps
    Sunil S Ranka
    Blog:http://sranka.wordpress.com
    Tweet : @sunil_ranka
    “Superior BI is the antidote to Business Failure”
    PS : @Buildscharacter, You being protective about your Tweets couldn't reply you.

  • JPanel with many children doesn't display them all in a narrow window

    I'm writing an application that has a JPanel at the top containing many
    JToolBars. However, the height of the JPanel stays constant when I narrow
    the application window so that many of the JToolBars are not displayed.
    I would like to have the JPanel increase in height as the window narrows
    so that all the JToolBars remain visible. How can you do this? Thanks.
    Try widening/narrowing the window in this example:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Sample extends JFrame {
        public Sample(String name) {
            super(name);
            JPanel tp = new JPanel(new FlowLayout());
            for (int i = 0; i < 10; i++) {
                JToolBar tb = new JToolBar("toolbar" + i);
                for (int j = 0; j < 10; j++) {
                    tb.add(new AbstractAction(("Action" + i) + j) {
                        public void actionPerformed(ActionEvent event) {
                tp.add(tb);
            JPanel cp = new JPanel();
            cp.setSize(400, 400);
            cp.setBackground(Color.red);
            add(tp, BorderLayout.PAGE_START);
            add(cp, BorderLayout.CENTER);
        public static void main(String[] args) {
            Sample s = new Sample("Sample");
            s.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            s.setSize(500, 500);
            s.setVisible(true);
    }

    There are some neat tricks in this thread.
    http://forum.java.sun.com/thread.jspa?threadID=716580&messageID=4190052

  • Centralizing text in JButtons in a JPanel with a boxLayout doesn't work!!!

    Hello, I tried to use the JLabel constructor:
    JLabel saveButtonLabel = new JLabel("Save", JLabel.CENTER);
    and then put it in the JPanel:
    controlPanel.add(saveButton);
    but the text is still aligned to the left. What have I done wrong please!!!
    I am using the folling to seperate the JButtons, if this is at all affecting it:
    controlPanel.add(Box.createHorizontalGlue());
    controlPanel.add(Box.createRigidArea(new Dimension(13, 0)));
    regards

    Is your control panel being added to a border layout, and if so, what section (SOUTH?)

  • Script Just doesn't want to run correctly.

    trying to run this script
    It applies registry values based on ($apps)
    Error = Missing Expression after unary operator '_'  On several lines
    Please assist
    $app = get-childitem c:\dome\$computername
    $computername = (get-wmiobject -class win32_computersystem)._server
    New-Item -path hklm:\Software\Management\Server -name Packages
    Switch (&app)
    "01" { set-itemproperty -path hklm:\Software\Management\DC\Server\Packages -name 01 -value 0173 }
    "03" { set-itemproperty -path hklm:\Software\Management\DNS\Server\Packages -name 03 -value 1797 }
    "04" { set-itemproperty -path hklm:Software\Management\WINS\Server\Packages -name 03 -value 1979 }

    Hi Newbie_5107,
    In addition, try to paste the script below and run in powershell, then check whether there still has any error:
    $computername = (Get-WmiObject -class win32_computersystem).Name
    $app = Get-ChildItem c:\dome\$computername
    New-Item -path hklm:\Software\Management\Server -name Packages
    Switch ($app.BaseName)
    "01" { Set-ItemProperty -path hklm:\Software\Management\DC\Server\Packages -name 01 -value 0173 }
    "03" { Set-ItemProperty -path hklm:\Software\Management\DNS\Server\Packages -name 03 -value 1797 }
    "04" { Set-ItemProperty -path hklm:\Software\Management\WINS\Server\Packages -name 03 -value 1979 }
    I hope this helps.

Maybe you are looking for

  • Kernell security check failure issue

    Hi.  I installed a webcam with mic integrated (external device) to my lenovo T61 computer, running 8.1 windows. When trying to use the webcam, the kernel security check failure appears, crashes my computer and restarts it. What can I do?  Thanks

  • Move default location of Lightroom files

    I would like to move my lightroom files, including the catalogs and my photos, out of the My Pictures photos in Windows 7.  (I use the My Pictures folder for photos which are post-processing.)   I can't figure out how to do this -- any advice?

  • Failed to install Add-On For 2 Different Database Servers

    Hi All, We are using one application server and 2 database servers (development - DEV01 and production - PRD01).  All SAP Business One application (server, client, license, add-on, etc.) installed on application server. Now, we are having problem whe

  • Recursiveness in BOM

    Hi experts, I have a question. Recently we discovered that there are some recursive BOMs to be loaded into SAP during our migration. This was not anticipated, and therefore we're unsure how to proceed. We know we can set the indicator 'recursiveness

  • Kernal Message Pop Up

    MacBook Processor Name: Intel Core Duo Processor Speed: 2 GHz Hardware: ATA Macintosh HD: Capacity: 74.21 GB Available: 43.32 GB Writable: Yes File System: Journaled HFS+ BSD Name: disk0s2 Ram: 512MB The problem happened when I was on Safari and whil