Why are the buttons invisible on WM_CREATE?

Can anybody tell me why the buttons are invisible at Program start? They are only then visible, if the client are is invalidated, in other words, if i resize/minimize the window etc.
public class Calculator extends Frame
     private Button[] button;
     private Panel p_button;
     public Calculator()
          super();
          SetWindowProperties();
          button = new Button[10];
          p_button = new Panel();
          CreateButtons();
          AddPanels();          
          AddButtons();
          SetButtonProperties();          
          addWindowListener(new WindowHandler());
     private void SetWindowProperties()
          setTitle("Calculator");
          setBackground(Color.white);
          setLayout(new BorderLayout());
          setSize(400,400);
          setLocation(250,200);
          setVisible(true);
     private void CreateButtons()
          for (int i=0; i<=9; i++)
               button[i] = new Button(String.valueOf(i));
     private void SetButtonProperties()
          for (int i=0; i<=9; i++)
               button.setSize(50, 50);
               button[i].setBackground(Color.gray);
     private void AddButtons()
          p_button.setLayout(new GridLayout(5, 3, 5, 5));
          for (int i=1; i<=9; i++)
               p_button.add(button[i]);
          for (int i=1; i<=9; i++)
               button[i].addActionListener(new ButtonHandler());
     private void AddPanels()
          add(p_button, BorderLayout.CENTER);

move
SetWindowProperties();
after
SetButtonProperties();
if i do that, i never can see the buttons, and this is obvoius.(your suggestion is not logical)
I am a C++-Programmer and i simply dont like the Java coding convention.
By the way, does anyone have still an idea, why the buttons are not visible at programstart?
What about:
button = new Button(String.valueOf(i));
What do you think of that statement?What should i think of ? It creates buttons with captions 1,2,3 ...
PS: At the end of line i forgot to copy the last end-block statement from the code during posting.
So if anyone tries the code, please add a " } "

Similar Messages

  • Why are the buttons not visible at program start?

    Can anybody tell me why the buttons are invisible at Program start? They are only then visible, if the client are is invalidated, in other words, if i resize/minimize the window etc.
    public class Calculator extends Frame
    private Button[] button;
    private Panel p_button;
    public Calculator()
    super();
    SetWindowProperties();
    button = new Button[10];
    p_button = new Panel();
    CreateButtons();
    AddPanels();
    AddButtons();
    SetButtonProperties();
    addWindowListener(new WindowHandler());
    private void SetWindowProperties()
    setTitle("Calculator");
    setBackground(Color.white);
    setLayout(new BorderLayout());
    setSize(400,400);
    setLocation(250,200);
    setVisible(true);
    private void CreateButtons()
    for (int i=0; i<=9; i++)
    button = new Button(String.valueOf(i));
    private void SetButtonProperties()
    for (int i=0; i<=9; i++)
    button.setSize(50, 50);
    button.setBackground(Color.gray);
    private void AddButtons()
    p_button.setLayout(new GridLayout(5, 3, 5, 5));
    for (int i=1; i<=9; i++)
    p_button.add(button);
    for (int i=1; i<=9; i++)
    button.addActionListener(new ButtonHandler());
    private void AddPanels()
    add(p_button, BorderLayout.CENTER);
    }

    First, use code tags.
    Second, your code doesn't even compile. Please create a Short,Self Contained, Compilable and Executable, Example Program

  • Why are the buttons faded out (cant use them) on mobile device details?

    Good Afternoon
    I am having a little trouble figuring out why the buttons are faded (cant use them) on the: User Mailbox -> Mailbox features -> Mobile Device Details. Any help would be appreciated. Thanks.

    Hi Andy
    This option is greyed out only for one user or its for all users ?
    Do you have any MDM in place for managing the active sync devices ?
    Have you tried disabling this feature through Powershell ?
    Remember to mark as helpful if you find my contribution useful or as an answer if it does answer your question.That will encourage me - and others - to take time out to help you Check out my latest blog posts on http://exchangequery.com Thanks Sathish
    (MVP)

  • HT1665 Why are the buttons on my earbuds not working?  I just bought new ones because the old ones weren't working.

    I'm unable to use the buttons on my earbuds, both for music and for phone calls.

    Hi Kristen0424,
    If you are having button issues with the remote on your Apple earbuds, you may find the following article helpful:
    Apple EarPods with Remote and Mic: Remote buttons do not function
    http://support.apple.com/kb/TS4396
    Regards,
    - Brenden

  • Why are the buttons not reading my fingers now? Terrible upgrade

    This upgrade is frustrating, wish I could undo it. The buttons don't respond to touch and I'm doing things more than one time now.

    You turned into a zombie? 

  • Just updated to ios7. when i add events to my calendar i don't see a dot or the event on my phone, but it shows up on my computer. why are new events invisible on my phone?

    just updated to ios7. when i add events to my calendar i don't see a dot or the event on my phone, but it shows up on my computer. why are new events invisible on my phone?

    Are you sure .mov files worked on the iPhone without a third part player? I'm just not sure...
    Try these instructions from Apple:
    Convert a video to work with iPhone:  Select the video in your iTunes library and choose Advanced > “Create iPod or iPhone Version.” Then add the converted video to iPhone.

  • Why are the CAPTIONS displayed smack across everyone's face?

    Why are the CAPTIONS displayed smack across everyone's face on the screen???  I need the captions to HEAR better but I still want to SEE the show.  When the text is displayed across everyone's eyeballs it's very disruptive.  And I want ONE BUTTON on my remote to turn captions on/off; from a user perspective it is unnecessary to go through the menu settings everytime.  Take a stand and do something about improving CAPTIONS!!!

    mibrnsurg wrote:
    skeeterintexas wrote:
    JoannaG wrote:
    Why are the CAPTIONS displayed smack across everyone's face on the screen???  I need the captions to HEAR better but I still want to SEE the show.  When the text is displayed across everyone's eyeballs it's very disruptive.  And I want ONE BUTTON on my remote to turn captions on/off; from a user perspective it is unnecessary to go through the menu settings everytime.  Take a stand and do something about improving CAPTIONS!!!
    The CC text is on the bottom third of the screen.  I don't understand the problem.  *shrugs*
    Actually when I first replied, I checked the CC on the channel I was on and it was in the 'face' position the OP complained about.  Now checked here on recording of Sprint Cup qualifying and it's at the bottom.  Looks like some are not in the bottom 1/3 of the screen.
    Chris
    Please NO SD stretch-o-vision or 480 SD HD Channels
    Need Help? PM ATT Uverse Care (all service problems)
    ATT Customer Care(all other problems)
    Your Results May Vary, In My Humble Opinion
    I Call It Like I See It, Simply a U-verse user, nothing more
    You're right...some closer to the bottom, some closer to the top.  I wonder if it's a network decision or just random.

  • TS4337 Why are the colors for my calendar reseting to a color I never chose?

    Why are the colors for my calendar in iCal reseting to a color I never chose?  It won't stay blue when I choose that color and keeps changing to a custom lavendar color on its own....  Incredibly annoying...

    There doesn't seem to be a one-size-fits-all answer, because what works for one printer doesn't necessarily work for another, and I don't have your printer so I can't advise on specifics...
    However, perhaps we can discover a set of settings that will work...
    If you File - Print, choose Photoshop Manages Colors, in the Printer Profile section do you see profiles specific to your printer (e.g., with the name Kodak in them)?
    If so, choose one of them that seems appropriate given the paper you're using.
    If not, try choosing sRGB IEC61966-2.1.
    Now, before you continue, press the [Print Settings...] button.  This brings up the printer driver dialog.  You may have to go through [Advanced] buttons or whatever, but what you're looking to do here is to disable the printer driver's color management logic.  In other words, if you can find a color-management / ICC profile handling section, set it to "no color management" or equivalent.  OK back out to Photoshop's print dialog, then press [Print].
    The key here is that if Photoshop manages the color transforms, the printer driver should not be set to do so - or vice versa.
    If you're presented with the printer driver's dialog again, double check that the settings you chose above are still set, for good measure, and try a test print.
    -Noel

  • Why are the duscussion administrators archiving all cd-text conversations?

    Why are the duscussion administrators archiving all cd-text conversations?
    Looks like they are all archived... Is this to shut us up?
    Seeing how long it takes for my posts to be archived!
      Windows XP  

    I would try a reset. Hold the sleep/wake and home buttons together until you see the Apple logo and then release. Once the phone restarts, see if it is working correctly. It sounds to me like you may have too many text messages in the Messages app. Have you deleted anything from there lately?

  • Why are the photos i print much darker than the monitor image?

    why are the photos i print much darker than the monitor image?

    Please read this post then provide some details.  What printer model? What operating system? What program are you printing from?
    Some programs such as Photoshop give the option to print to CMYK or sRGB color spaces.  Even though the printer uses CMYK inks the driver is expecting sRGB data.  If CMYK is selected the prints will be much too dark.
    Another thing to check is the media type.  If you are printing on plain paper and have seelcted Photo paper the prints have too much ink.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Why are the photos I copied onto a DVD from I-Photo not viewable by a Windows PC?

    Why are the photos I copied onto a DVD from iPhoto not viewable on a Windows PC?

    Because you did it wrong? It's hard to know unless you tell us what you did.
    What should work:
    Select the photos you want to share
    File -> Export and export them to a folder on the desktop. Burn that to the disk with the Finder.
    This User Tip
    https://discussions.apple.com/docs/DOC-4921
    has details of the options in the Export dialogue.

  • Why are the apps on my IPad scattered across the whole thing and when I open them they turn to little rectangles in the corner of the screen and I can't even use them or tap on anything. Also when I turn my iPad it doesn't flip the screen over

    Why are the apps on my IPad scattered across the whole thing and when I open them they turn to little rectangles in the corner of the screen and I can't even use them or tap on anything. Also when I turn my iPad it doesn't flip the screen over.

    Hi The next thing to do is to Restore back to Factory Settings this will get rid of any bugs . After Restore use same Apple ID /Password then you should get all your Apps & data back If you still have this problem make an Appointment at Apple Store . Cheers Brian

  • Why are the iPhotos not listed in the finder?

    why are the iPhotos not listed in the finder?

    There are many, many ways to access your files in iPhoto:   You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    (Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)
    You can access the Library from the New Message Window in Mail:
    There's a similar option in Outlook and many, many other apps.  If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    If you want to access the files with iPhoto not running:
    For users of 10.6 and later:  You can download a free Services component from MacOSXAutomation  which will give you access to the iPhoto Library from your Services Menu.
    Using the Services Preference Pane you can even create a keyboard shortcut for it.
    For Users of 10.4 and 10.5 Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    Drag and Drop: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    File -> Export: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    Show File:  a. On iPhoto 09 and earlier:  Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.    3.b.
    b: On iPhoto 11 and later: Select one of the affected photos in the iPhoto Window and go File -> Reveal in Finder -> Original. A Finder window will pop open with the file already selected.

  • Where are the buttons gone File upload and Download in New ABAP Editor

    Where are the buttons gone of File upload and Download in New ABAP Editor in ECC 6.0.
    Or some new utility added for this feature.
    Kindly guide.
    Thanks,
    pradeep

    Go to Utilities>more Utilities>upload/download is there.
    Amresh.

  • Why are the threads start and terminate randomly?

    Hi there,
    I got the program below. I am wondering why are the threads start and terminate randomly? Everytime, I run the program, it produces different results.
    I know that these four threads have got same normal priority (should be 5), and under windows there is something called timeslice. Then these four threads rotate using this timeslice. How do we know what exactly the timeslice is in seconds? If the timeslice is fix, then why the results are ramdom?
    Thanks in advance!
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package mythreadone;
    * @author Administrator
    public class MyThreadOne implements Runnable {
    String tName;
    Thread t;
    MyThreadOne(String threadName) {
    tName = threadName;
    t = new Thread(this, tName);
    t.start();
    public void run() {
    try {
    System.out.println("Thread: " + tName);
    Thread.sleep(2000);
    } catch (InterruptedException e) {
    System.out.println("Exception: Thread "
    + tName + " interrupted");
    System.out.println("Terminating thread: " + tName);
    public static void main(String args[]) {
    // Why are the threads start and terminate randomly?
    new MyThreadOne("1");
    new MyThreadOne("2");
    new MyThreadOne("3");
    new MyThreadOne("4");
    try {
    Thread.sleep(10000);
    // Thread.sleep(2000);
    } catch (InterruptedException e) {
    System.out.println(
    "Exception: Thread main interrupted.");
    System.out.println(
    "Terminating thread: main thread.");
    1. Firstly, I set in the main function:
    Thread.sleep(10000);
    and I run the program it gives:
    Thread: 1
    Thread: 4
    Thread: 2
    Thread: 3
    Terminating thread: 1
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: 2
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 10 seconds)
    Run it again, it gives:
    Thread: 2
    Thread: 4
    Thread: 3
    Thread: 1
    Terminating thread: 2
    Terminating thread: 1
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 10 seconds)
    And my question was why it outputs like this? It suppose to be:
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 1
    Terminating thread: 2
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 10 seconds)
    Why these four threads start and finish randomly each time I run the program? I use Windows, suppose there is a timeslice (i.e. 1 second), these threads have the same priority. Then the threads should start and finish in turn one by one. Am I right?
    2. My second question is:
    When I change the codes in the 'main' function into:
    Thread.sleep(10000); -> Thread.sleep(2000);
    it gives me the results like:
    Thread: 1
    Thread: 4
    Thread: 3
    Thread: 2
    Terminating thread: main thread.
    Terminating thread: 1
    Terminating thread: 4
    Terminating thread: 3
    Terminating thread: 2
    BUILD SUCCESSFUL (total time: 2 seconds)
    Run it again:
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 3
    Terminating thread: main thread.
    Terminating thread: 4
    Terminating thread: 2
    Terminating thread: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    I tried several times. The main thread always terminates before or after the first child thread finished.
    My question is why it doesn't output something like:
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: 2
    Terminating thread: main thread.
    Terminating thread: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    or
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: 2
    Terminating thread: 1
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 2 seconds)

    user13476736 wrote:
    Yes, my machine has multi-core. Then you mean that if I got a one core machine the result should always be:
    Thread: 1
    Thread: 2
    Thread: 3
    Thread: 4
    Terminating thread: 1
    Terminating thread: 2
    Terminating thread: 3
    Terminating thread: 4
    Terminating thread: main thread.
    BUILD SUCCESSFUL (total time: 10 seconds)
    ???No.
    >
    How to explain my second quesiton then? Why the main thread always terminates before some of the child threads end? Thanks a lot.

Maybe you are looking for

  • Issue with Logic 9 on SL 10.6.8 and Unitor8

    Hello, im switching from Logic 8 on OS 10.4.11 to Logic 9.1.8 on SL 10.6.8. Right now I can switch back and forth.on the same computer. Unitor8 works perfectly on my old system, but not on my new one. Logic says that Unitor 8 is unavailable and asks

  • Updating Zfields in the BUT000 table

    Hi , I have created new zfields for but000 table . Is there any FM present to Update the newly created Z fields  . ( here  business partner number  is already created using the FM CRM_ISA_REGISTER_CONSUMER .Now i want to update the Zfileds for this b

  • RAC Installation Problem in End

    Hi All I am instaling RAC on Red Hat Linux 4. After installation of Clusterware I got the following on the rac01 node......... [root@rac01 ~]# /u01/app/oracle/product/10.2/crs/bin/crs_stat -t Name Type Target State Host ora.rac01.gsd application ONLI

  • Serveradmin takes wrong values and crashes service

    Hi Serveradmin on console is taking wrong values and therefore crashing services. without checking syntax or possibility that the value I just set may be wrong. Backstory: My calendarservice produced strange errors on the client side after upgrading

  • How can i set some values to adf table(non bound to database)?

    hi i want to display some datas to an empty adf table on click of a button? My jdev version is 11.1.2.2 Thanxxx