Why won't GUI display correctly ?? --URGENT--

Hi,
I am copying the code from my book. For some reason the color doesn't work when I copy+paste teh code into Eclipse. Am I doing something wrong or do I have to enable something in Eclipse options??? I keep getting 2 windows WITH NO TXT and NO COLOR. Here is the code:
import javax.swing.*;
import java.awt.*; //needed for the Color class
public class SecondWindow extends JFrame
    public static final int WIDTH = 200;
    public static final int HEIGHT = 200;
    public SecondWindow( )
        super( );
        setSize(WIDTH, HEIGHT);
        Container contentPane = getContentPane( );
        JLabel label = new JLabel("Now available in color!");
        contentPane.add(label);
        setTitle("Second Window");
        contentPane.setBackground(Color.BLUE);
        addWindowListener(new WindowDestroyer( ));
    public SecondWindow(Color customColor)
        super( );
        setSize(WIDTH, HEIGHT);
        Container contentPane = getContentPane( );
        JLabel label = new JLabel("Now available in color!");
        contentPane.add(label);
        setTitle("Second Window");
        contentPane.setBackground(customColor);
        addWindowListener(new WindowDestroyer( ));
}and the driver file
import java.awt.*; //for the class Color used in an argument.
public class SecondWindowDemo
     Creates and displays two windows of the class SecondWindow.
    public static void main(String[] args)
        SecondWindow window1 = new SecondWindow( );
        window1.setVisible(true);
        SecondWindow window2 = new SecondWindow(Color.PINK);
        window2.setVisible(true);
}WINDOWS Destroyer Class
import java.awt.*;
import java.awt.event.*;
If you register an object of this class as a listener to any
object of the class JFrame, then if the user clicks the
close-window button in the JFrame, the object of this class
will end the program and close the JFrame.
public class WindowDestroyer extends WindowAdapter
    public void windowClosing(WindowEvent e)
        System.exit(0);
}Message was edited by:
eristic
Message was edited by:
eristic

Well I read the forum rules and it doesn't say
anything about not using URGENT. Sounds like you are
going based on convention.Consider basic good manners. You have just approached a bunch of strangers and asked them for their help, for free. By telling us it's urgent, you're really saying "my problem is more important than these other people asking for help", which is only true as far as you're concerned. Everyone considers their own problem more important.
The forum rules may not say anything about not using "URGENT", but since the people answering the questions have the power to do so or not, you just have to abide by what they say. Like it or lump it, basically. Or cough up some hard currency

Similar Messages

  • Why don't colours display correctly in the viewer

    why don't colours display correctly in the viewer

    What are you seeing? Post a screenshot?
    What computer is this?

  • Why won't tabs display properly when composing e-mails in mail?

    When I compose an e-mail in Mail, often the window won't display the top row of tabs (send, attachment, etc.).  I can see the tip of each graphic, but it's almost like they've been cropped out.  Does anyone know what might be causing this and how to correct it?  Thanks in advance.

    yldawg,
    Try going to the mail menu, view click on hide toolbar, and clicking show toolbar (or visa versa) depending what shows. I haven't used this os in a long time, so I'm not sure how it is set up anymore.
    Best

  • Why won´t my display turn off when i call (iphone 4s ios 5.1)??

    hi
    i have a iphone 4s with ios 5.1
    since i updated to 5.1 i have the problem that the display won´t turn off,
    when i call with someone.
    i have reset the iphone more than one time.
    I don´t know what i can do more.
    ps: sorry for my englisch

    ach nee....
    i have no protection on the iphone and i know the display turns only off when i hold it at my ear.
    my problem IS that the display won´t turn off when i hold it at my ear.
    This problem is since the update to 5.1!

  • Why won't List display ArrayCollection?

    Hi all,
    I cannot for the life of me figure out why the List I created will not display any of the values in my ArrayCollection.  I've read and watched so much databinding material, that I think it must be something extremely small or absolutely huge that I'm missing.  If anyone could give me a pointer or two it would be so greatly appreciated, I've been on this for days now.
    I have two .mxml's (MyCards and NewCard).  The idea is that in the NewCard View the user types in a Title, and text for side 1 and side 2 of a flash card.  The program then saves all 3 of these properties into an Object and puts that Object into an ArrayCollection.  This ArrayCollection is display in a List in the MyCards.mxml file.  The problem is, nothing shows up.
    Here's part of MyCards.mxml showing how I'm implementing and binding the ArrayCollection to the List:
                        [Bindable]
                   public var card:Object = new Object();
                   public var nc:NewCard = new NewCard(); // create new instance of NewCard
                   [Bindable]
                   public var cards:ArrayCollection = new ArrayCollection();
                   public function add():void
                        cards.addItem(nc.myCard); // add new Item to ArrayCollection 'cards'
                        trace(cards.list);
              ]]>
         </fx:Script>
         <s:actionContent>
              <s:Button label="Delete"/>
              <s:Button label="Home" click="button1_clickHandler(event)" skinClass="skins.homeButtonSkin"/>
         </s:actionContent>
         <s:Image x="0" y="-80" height="603" source="mainapp1.jpg"/>
         <s:List id="myCardsList" x="10" y="10" left="0" right="0" top="0" bottom="0" width="1004"
                   height="500"  dataProvider="{cards}"
                   enabled="true" >
              <s:itemRenderer>
                   <fx:Component>
                        <s:MobileItemRenderer label="{data.Title}"/>
                   </fx:Component>
              </s:itemRenderer>
              </s:List>
    And then here's how I'm 'adding' the cards in the NewCard.mxml:
                             [Bindable]
                   public var myCard:CardVO = new CardVO(); // create new instance of CardVO
                   public function button2_clickHandler(event:MouseEvent):void  // save button
                        var myc:MyCards = new MyCards();  
                        myc.add();
                        trace(myc.cards.list);
                        trace(myc.cards.length);
                        //card.fTitle = titleCard.text;
                        //mycArray();
                        titleCard.text = "Card Added!";
         <s:TextInput id="titleCard" x="240" y="10" height="62" chromeColor="#515851" color="#060606"
                         contentBackgroundAlpha="1.0" contentBackgroundColor="#FFFFFF" text="{myCard.Title}" change="{myCard.Title = titleCard.text}"/>
         <s:SkinnableContainer
              id = "groupt" x="161" y="88" width="703" height="357"  >
              <!-- text property of mtext1 and mtext2 is bound and returned to the get/set functions in CardVO in the 'change' event-->
              <!-- change sets setter values to those retrieved from textAreas-->
              <s:TextArea id="mtext2" visible="false" x="0" y="0" width="703" height="357"
                             color="#000000" contentBackgroundAlpha="1.0"
                             contentBackgroundColor="#FFFFFF" editable="true" enabled="true"
                             paddingTop="70" text="{myCard.Side2}" change = "{myCard.Side2 = mtext2.text}"
                             textAlign="center"/>
              <s:TextArea id="mtext1" x="0" y="0" width="703" height="357" color="#030303"
                             contentBackgroundAlpha="1.0" contentBackgroundColor="#FFFFFF" editable="true"
                             enabled="true" fontFamily="Arial" fontStyle="normal" fontWeight="normal"
                             lineThrough="false" paddingTop="70" text="{myCard.Side1}" change="{myCard.Side1 = mtext1.text}"
                             textAlign="center" textDecoration="none" verticalAlign="middle"/>
         </s:SkinnableContainer>

    The cards array collection items appear to be another list of items instead
    of just items?

  • Why won't Safari display altered uploaded files?

    If I make some changes in my web page, some changes in CSS setting, and upload the page, it continues to display in the former format. However, if I check Firefox, the newly edited file appears just fine.
    I tried repeatedly emptying the Safari cache, and even used Onyx to empty all browser caches, and of course repeatedly try reloading the page but it still does not update.
    Does anyone know why this is so? Is there a solution?
    Thanks,
    Richard

    You confused me a little here. Earlier you wrote:
    t I can see the changes in GoLive or BBedit (as previews)
    but then you say:
    That I am also previewing the file in Safari and also loading from my hard disk at that time. So that suggests to me, since Safari does not render it right
    Are you seeing changes made to CSS files when previewing in Safari ... or not? I might have read something wrong, but I had the impression you were saying previews in Safari show CSS changes, while previews online do not.
    Also, I think there are two things happening and one is confusing the matter. Earlier you wrote:
    But when previewed in Safari, it is not the same — the padding is gone.
    My feeling was that this was a separate issue, not a problem with caching. (To my knowledge and in my experience, Safari never uses cached files when viewing files on the hard drive.) My thought was that this is a CSS conflict or syntax problem.
    Test for the caching issue (in previews vs. online) with something obvious, rather than your padding style... something like a red border or a text style, so you'll be sure if it's there or not.
    Message was heavily edited by: Rachel R

  • Why won't emails display in new mailbox I created?

    Hi, I wanted to make another mailbox/folder to put specific emails in, did what I've always done, except the ones I've copied to the new box don't sit in the folder, they are only shown on my computer drive, not in the mail window, like all the others! Why is this happening?

    BDAqua wrote:
    Hmmm, this "folder in my Finder", is it located in...
    /Users/YourUserName/Library/Mail/Mailboxes/
    Yes, along with all the other ones. However, many have a second, with duplicate names, but with .mbox after it, while some don't, including the one I created. As a workaround I just renamed one of the folders that was working, "delivered", that I never use. However, while I can put messages or copies in it, in my Finder, it is still titled "delivered" even though the correct emails are inside it. It's just this kind of stuff that Apple used to explain, right there in their Help window, you used to be able to go through every program, and when deciding how to set preferences, it told you, line by line what everything meant. Now, it's sink or swim, hunt around for some info here, there, and often end up coming here, posting questions or searching for answers, or sometimes just searching the web. It's very frustrating & disappointing, as Apple used to be well-loved for it's ease of use, and customer service... no more. Something as simple as this should be, I have to end up spending a lot of wasted time & energy, hunting an answer to a very minor question.....

  • Why are my Add-on Bar items halfway hidden, and why won't they display properly?

    [http://download343.mediafire.com/29kbvy9b609g/uzw78f3vqf688mb/Add-on+Bar+Glitch.PNG Glitched Add-on Bar photo]
    After using the new Firefox 4 for just a few days, I've noticed that my Add-on Bar items (mail notifier and weather bar) are jutted down below the actual visible display area they should be, so I can see half of the icons. This is not a priority issue, but it is still an issue, and it bothers me. I've already tried uninstalling then reinstalling Firefox 4, I've already tried removing then reinstalling the add-ons themselves, and I've also tried just hiding then showing the Add-on Bar but still nothing is changed. This problem only occurs when I use themes for Firefox 4 other than the default theme. The attached photo is a screenshot of my Add-on Bar so you hopefully won't think I'm crazy.

    I've figured this out. Apparently, there is a graphical bug in FF4 when the "Show: Icons and Text" option under customizing the toolbar is enabled, and the Downloads icon is in the Add-on Bar, the Downloads icon remains centered, but the other items in the Add-on Bar are pushed under the display area of the Add-on Bar. If the setting is reverted back to just icons or just text shown, or if the Downloads icon is removed from the Add-on Bar, this is fixed. A simple line of code could fix this coincidental error, but as I said before, it's not a priority issue. As always, I can just click Ctrl+J to show my current downloads. I just tried to have this icon in the newly named Add-on Bar to replicate my old-fashioned Firefox 3.6 interface, but I guess that's unreasonable for Mozilla...

  • Why won't iCal display multi-day events in month view?

    This is frustrating. If someone sends me a calendar event that lasts multiple days from Calendar software that ACTUALLY WORKS  (hint hint hint Google Calendar, Outlook), and if I accept this event, it only displays the FIRST DAY of the event in iCal's month view. It should put a solid bar through every date included in the duration of the event. How is it that this has not been fixed yet???

    Bug or design flaw?
    Try setting it as a recurring event (yeah, I know, it's not a great solution, but it gets the job done)

  • Why won't iTunes display the content tabs at the top of the screen?

    I recently upgraded to iTunes 5.1 so that I can sync my MacBook Pro with my new iPad.  Now I can't figure out how to select and transfer my photo albums - nothing with my photo albums is displaying on the iTunes screen or in the Library.

    So I setup my ipad as a new iPad and even after putting iTunes back on it. If I deselect what I want to sync and then sync again those items are simply not removed.
    You would think after this long that Apple would have the ability to thoroughly regression test this stuff.

  • Why won't artwork display

    The album artwork shows up in my itunes, but when I sync my iPod it won't show up. I have the tab clicked that says to show artwork. How do I get it to show up on my iPod?

    The album artwork shows up in my itunes, but when I
    sync my iPod it won't show up. I have the tab
    clicked that says to show artwork. How do I get it
    to show up on my iPod?
    ?

  • Why won't PS download correctly?

    I have downloaded and installed Photoshop twice now and it keeps giving me the same prompt when I go to open it.  The prompt says, "Some of the application components are missing from the Application Directory, please reinstall the application."  Could I be installing it incorrectly?  I don't know how this could be....

    Link for Download & Install & Setup & Activation problems may help
    -Chat http://www.adobe.com/support/download-install/supportinfo/
    OR
    -http://helpx.adobe.com/creative-cloud/kb/error-downloading-cc-apps.html
    -http://forums.adobe.com/community/download_install_setup
    -http://helpx.adobe.com/creative-cloud/kb/troubleshoot-cc-installation-download.html
    -http://helpx.adobe.com/x-productkb/global/errors-or-unexpected-behavior-websites.html
    -http://helpx.adobe.com/creative-cloud/kb/unknown-server-error-launching-cc.html
    -Server won't connect https://forums.adobe.com/thread/1233088

  • Why won't ios5 download correctly? (err -3259)

    I have downloaded ios5 several times. I get an error message at the end, it says that software hasn't downloaded, (err -3259) and says I have to try downloading it again. Why is it doing this? I just want to download ios5. Is this happening to me because my laptop is a PC?

    Try temporarily turning off your firewall and antivirus software until the download has completed.

  • Why won't Cinematic Display work with Macbook OSX 10.5.8?

    I have the 27" Cinematic Display - just got it a couple mont. Works fine with my MacBook Pro. So far we have had no luck getting my wife's MacBook 2.4 gig Core Duo running OSX 10.5.8 to detect the display when we plug in the mini port. Is there a way to manually get it to detect the screen or is there something I'm missing?
    Thanks in advance!
    Jeremy

    The store says it requires 10.6.4 or later, and so one has posted a question or answer to the contrary.
    The biggest mistake users make with Mini DisplayPort is not pushing the cable-end into the port all the way. It must be inserted until "essentially ALL of the metal part disappears inside the socket".

  • Why won't my display backlight come on?

    I have a unibody MacBook Pro purchased in late 2009.
    Sometimes when I wake up my laptop I can see that the display has come on but the backlight that makes the display bright is not on.  On other words, the screen is completely dark, but under the right lighting I can see that the LCD itself is on (windows are up, the cursor is moving around the screen) but there is no light making it all bright (i.e., the display backlight is off).  When I put it to sleep and wait for the indicator light to start pulsing and then wake it up again it will off then come on, but of course I shouldn't have to do that.
    Perhaps related or unrelated is my keyboard backlight also doesn't work.  I can turn the brightness up and down using the F5 and F6 keys and the indicator will come up on the screen showing the brightness going up and down, but the keys themselves are not lit at all.
    Was there a recall sent out about this issue?  I do have AppleCare.
    Thanks.

    I have the same thing, not only my current Retina MacBookPro (Mountain Lion) but on my previous 2008 MacBook black (Lion). I find it very odd that I'd have the exact same issue on two different computers; there must have been a setting on the old one that got migrated to the new one somehow?

Maybe you are looking for

  • Reboot during lion installation

    Hi @all, i've downloaded lion from the App-Store. After the download the installer startet automaticly and reboot the System. The problem is, that the installer starts after the first reboot and failed with no error and shutdown the system. After res

  • Unable to change Data label position in the Chart using Position from Properties

    Hi All, I am trying add the Data label to the chart and the users want them to appear on the top of the stacked bars. By default when I enabled the data labels it showed up in the middle. When I tried to change the position by doing  View --> Propert

  • SD questions

    ( SALES AND DISTRIBUTION) Hello friends please provide me the solution to the following problems. 1.     Can we see the status of all sales documents at a time? Ans. 2.     Where do we need to create a bank a/c for posting incoming payment? Is it man

  • Old iphone 4 stolen - i want to know what's in it

    my old iphone 4 was stolen this morning. for some reason, i removed the password lock the other day (bad mistake). i already changed my email / apple passwords and even canceled a credit card. i'm also trying to locate it using find my iphone and set

  • Client_ole not working on oracle forms 11g

    hello,,, I have configured webutil in forms 11g ( Doc ID : 1093985.1) step by step and finally i installed webutil demo from ( Doc ID : 1272222.1) When I test it works fine , everything works fine except OLE --> write to MS Word , when i enter some t