Components getting displayed only when frame size is changed

import java.awt.*;
import javax.swing.*;
public class BorderLayout_another  extends JFrame{
     public BorderLayout_another()
          setLayout(new FlowLayout());
          setSize(500,400);
          setVisible(true);
          add(new JButton("one"));
          add(new JButton("one"));
          add(new JButton("one"));
          add(new JButton("one"));
          add(new JButton("one"));
     public static void main(String[] args)
          new BorderLayout_another();
}If I run the above code then the component in the frame is not visible unless I click restore button of the frame or I resize the frame itself.
Even iconifying and then deiconifying does not solve the problem.
I know I am getting this problem since I have used setVisible(true) before adding the components.
Is there something more to it.

import java.awt.*;
import javax.swing.*;
public class BorderLayout_another  extends JFrame{
     public BorderLayout_another()
          getContentPane().setLayout(new FlowLayout());
          getContentPane().setPreferredSize(500,400);
          getContentPane().add(new JButton("one"));
          getContentPane().add(new JButton("one"));
          getContentPane().add(new JButton("one"));
          getContentPane().add(new JButton("one"));
          getContentPane().add(new JButton("one"));
                pack();
          setVisible(true);
     public static void main(String[] args)
          new BorderLayout_another();
}Later versions of Java will allow you to do without the getContentPane() prefixes but I always use it.

Similar Messages

  • Page number to get displayed only when the page count is more than 1

    Hi Gurus,
    My requirement is to print page numbers ONLY if the page count is more than 1 ,i.e. if the data getting displayed in 1 page only then don't print "Page n of m" but if it is getting displayed in more than 1 page then display "Page n of m" on TOP right corner.
    I selected "Page n of m" and it creates 3 fields in object hierarchy i.e TextField CurrentPage, TextField PageCount and Static Text field Pages.
    I go to the ready:layout of PageCount object, and use below script:
    this.rawValue = xfa.layout.pageCount(); 
    if (this.rawValue == 1) {
    this.parent.Pages.presence     = "invisible";
    I looked at the message Page number not to display but it doesnot resolve my problem.
    Please help me out.
    Regards
    Ajay

    Hello Ajay,
    Script do not work for TextFields.  to get the page numbers displayed.  Select Text field from library and Go to Object Pallete, Value tab and select "Calculated - Read Only" in Type and choose Runtime property.  There you can find the Number of Pages.
    Once this is the text field, you can write script on it. 
    If(this.rawValue == 1)
      this.presence = "invisible"
    similarly write script for total number of pages, but make sure that variable is accessed properly.
    Please let me know, if you still see some issues with it.
    Thanks,
    Rakesh

  • Battery , time , signal strength bar is not getting displayed in home screen , these will be displayed only when i click on any app. Can u let me know the setting change ?

    Battery , time , signal strength bar is not getting displayed in home screen , these will be displayed only when i click on any app. Can u let me know the setting change ?

    Did you check the Zoom setting?
    Have you tried a reset (reboot)? Hold HOME and SLEEP until an Apple logo appears.
    If it isn't Zoom and a reboot doesn't help try Settings/General/Reset - Reset all settings

  • Component is  visible only  when frame is resize why?

    hai,
    In My application the components are visible only when the JFrame is resize...... why is it so?
    The problem is in login screen..
    that is the frame is displayed in middle the default layer for this borderlayout.... the panel here consists of gridbaglayout
    whats the problem? the size are all i have checked no problem
    Please help me out
    Shanthy

    Probably because you've added the components to the GUI after the GUI is visible.
    If this is the case then you need to revalidate the parent container.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • I am having major problems with Firefox. About 3 weeks ago I started experiencing the display only when on Firefox for all web site, that the display would be shifted right about half a screen. It only happens on Firefox and happens for all web sites.

    I am having major problems with Firefox. About 3 weeks ago I started experiencing the display only when on Firefox for all web site, that the display would be shifted right about half a screen. It only happens on Firefox and happens for all web sites.

    This issue can be caused by the Babylon Toolbar 1.1.8 extension
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Can anyone tell me what file gets written to when you add or change GO Connect to Server?

    Can anyone tell me what file gets written to, when you add or change "GO < Connect to Server" in the finder? Also the location of that file. Thanks!

    ~/Library/Preferences/com.apple.sidebarlists.plist
    in favoriteservers.

  • Need to get display only mode in ess

    Hello experts,
    What settings should I use so that on the ESS Personal Profile the users get a display only profile with a details button on the right as shown in the image. Currently the details only show up when somebody is maintaining the PERNR from the ECC system. Speedy help would be greatly appreciated.

    I have maintained the table V_T588MFPROPC as you told, earlier this table was empty.
    GBDAT is filed name for Date of Birth.
    So I found out GBDAT in standard table V_T588MFPROPS and maintained our earlier table exactly like that. In my case country grouping is 99.
    But after maintaining, there is no options to check as read only.
    There are some checkbox which is not in english.
    Please check the attachments and tell me what to do.

  • Setting up footer to display only when printing

    Hello,
    I am trying to figure out if you can display a footer only
    when printing and not to be displayed when viewing the help
    information.
    Let me know if this is possible and if so how to do it.
    Thanks!

    Sorry we didn't get to you as quickly as you'd like, but we
    all have regular jobs...
    The content in footers can be conditionalized the same as
    regular context. RH provides the default Online and Print condition
    tags, but you can add others as you like.
    In addition, you can use templates to apply headers and
    footers to multiple topics more easily.
    See the "Conditional text" section of the RH Help.
    Good luck,
    Leon

  • Getting audio only when exporting to camera

    Hello. I have exported many times before but when I recently tried to export to camera, I get audio only. I tried deleting the iMovie Preference file (which I had to do at times in the past) and then I got some video with audio at the beginning but then the video stalled while the audio continued.
    The iMovie material (which I have already exported to DVD) that I am trying to export to tape is from a DVD which I had converted to DV through Toast and edited in iMovie if that makes any difference.
    I'm using iMovie 6.04. Any comments will be appreciated.

    Hi, Rich,
    I just select QuickTime from the Share option in the menu bar, not Export from the File.
    It gives the options of Full Quality, CD-ROM, Web streaming and Email and Expert Settings. I always leave it as Full Quality. I just tried it now and when I select 'Expert Settings,' nothing happens until I click on 'Share,' and then I see the options of how to export and what format to use. Selecting Movie to DV Stream, I then have to change from the 'Most Recent Settings' to get the options of either PAL or NTSC settings for 32, 44.1 or 48 kHz...those are sound settings for audio.
    Frankly, I find it much harder to do all these setting changes when Share to QT as Full Quality has always produced a great movie that is equal in quality to the original iMovie.
    I have been doing it this way since the first iMove came out. It has always been known as a loss-less method. Frequently, my iMovies are complicated with many video and audio clips. With earlier versions, whenever iMovies became complicated, the playback would skip, stutter or the audio would freeze or become distorted. I learned from experience that the burned disks and disk image files would be fine, but it was hard to finish the edits. I learned to edit the video clips, add the still photos, transitions and titles, add just some audios if I needed a few seconds of sound under the still photos, and then export the movie as the Full quality quick time movie. Then, take that qt movie into a new iMovie and then add the audio. Worked every time. The new qt movie always played fine......unless I got too many more clips, and then I just made a new qt movie at that point. I also always use the qt version for exporting back to miniDV tape because the stuttering version usually would not export, or if it did, the stuttering would persist and ruin it.
    Good luck with your projects!

  • Does client get response only when doGet return?

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloServlet extends HttpServlet {
        public void doGet(HttpServletRequest req, HttpServletResponse res)
                throws ServletException, IOException {
            PrintWriter out = res.getWriter();
            out.println("<html><body>Hello World!</body></html>");
            out.close();
            try {
                Thread.sleep(5 * 1000); //some time-consuming job
            } catch (InterruptedException ie) {}
    }hi,
    I was wondering if the client will get response from a servlet only when doGet method returns or when the writer is closed. In the code above, the client will get response after five seconds. If I have some time-consuming job and don't want users to wait until the job is finished, what should I do. Thanks in advance.
    Joey

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloServlet extends HttpServlet {
    public void doGet(HttpServletRequest req,
    req, HttpServletResponse res)
    throws ServletException, IOException {
    PrintWriter out = res.getWriter();
    out.println("<html><body>Hello
    dy>Hello World!</body></html>");
    out.close();
    try {
    Thread.sleep(5 * 1000); //some
    000); //some time-consuming job
    } catch (InterruptedException ie) {}
    }hi,
    I was wondering if the client will get response from
    a servlet only when doGet method returns or when the
    writer is closed. In the code above, the client will
    get response after five seconds. If I have some
    time-consuming job and don't want users to wait until
    the job is finished, what should I do. Thanks in
    advance.
    JoeyThe client will get the response when the response writer is flushed, which occurs automatically when the writer is closed, when a certain amount of data is written to the writer (a buffer is filled), or when you do it manually by calling out.flush().
    Note, there are some issues with Internet Explorer, I believe, where it has an internal buffer, so when you flush you writer it may not get written to screen until the request is complete (the output stream is closed). To get around this you need to write a big enough output to fill IE's buffer. Not particularly sure how big it is, but something like 10-12 lines or HTML usually does the job. It may be less...

  • How to get last time when tablespace size increase

    Hi all,
    I need last date and time when tablespace size was extended. Kindly tell me is there any query which can help me.
    Thanks

    possible if you've 10g database and holding license to use AWR.
    table name is dba_hist_tbspc_space_usage
    SELECT TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY') days
    , ts.tsname
    , max(round((tsu.tablespace_size* dt.block_size )/(1024*1024),2) ) cur_size_MB
    , max(round((tsu.tablespace_usedsize* dt.block_size )/(1024*1024),2)) usedsize_MB
    FROM DBA_HIST_TBSPC_SPACE_USAGE tsu
    , DBA_HIST_TABLESPACE_STAT ts
    , DBA_HIST_SNAPSHOT sp
    , DBA_TABLESPACES dt
    WHERE tsu.tablespace_id= ts.ts#
    AND tsu.snap_id = sp.snap_id
    AND ts.tsname = dt.tablespace_name
    AND ts.tsname NOT IN ('SYSAUX','SYSTEM')
    GROUP BY TO_CHAR (sp.begin_interval_time,'DD-MM-YYYY'), ts.tsname
    ORDER BY ts.tsname, days;http://maxwellmiranda.wordpress.com/2011/03/22/segmenttablespace-growth-details-script/

  • Write data to a logbook file only when a boolean indicator changes

    Hello
    I need to write my local variable state to a simple txt file only when it's true or false state changes.
    for example, when my local variable 'temperature too high' is true, I need something like: temperature too high.
    When it changes back to false i need: temperature OK. This with a date stamp.
    It already worked to get a date stamp and to write the true or false state down but it always gets stuck in a while loop so the program keeps writing the same sentence.
    Solved!
    Go to Solution.

    I had to take a picture with my phone because we're not allowed to connect the computers with an usb drive, I hope you can see it clear.
    I know this while loop causes the program to write the same sentence over and over again but I don't know an other way to do it right.
    Thanks 
    Attachments:
    11166065_887284134650745_1225026485_n.jpg ‏46 KB

  • DBACOCKPIT storage information update when filesystem size has changed

    Hello Experts,
    I'm playing around with db2, linux and virtualization...
    I reduce the file system size where the /db2 is mounted on. Problem is that TC dbacokpit shows the same information under space->automatic storage -> summary  as before the file system was reduced. I understand that with automatic storage DB2 will grow as need, but
    what happen when file system is shrunk ??
    do I have to do something in order to have dbacockpit to show accurate informating regarding the real available space in the file system once its size has changed?
    is there any danger on having dbacockpit reporting wrong available space on the file system?
    thank you

    Hello,
    Validate if standard job SAP_COLLECTOR_FOR_PERFMONITOR is scheduled hourly, if not, schedule it in client 000 with DDIC user. Review logs too, maybe there is an error shown in job logs.
    Also, you should take a look to SAP Note 1508792: "Refresh does not work in DBACockpit" or  SAP Note 1002840: "No data or obsolete data in DB Space Statistic monitor" may be helpfull too.
    Best regards,
    Isabel

  • I get 0x8007000d error when i try to change any of my music details,like genre of artist,or any of them.

    I have just installed a copy of Windows 7 ultimate,and i have all the latest updates for it.But when i went to my music folder i understood that explorer sees the half of the details on it and doesn't let me change it.It keeps throwing this error back at me,when i attempt to change it in the bottom bar.ITunes sees the details,so is my Windows Media Player,they don't let me change it though.Please help.

    Hi,
    Thank you for the post.
    It seems that the metadata of the music is not fully compatible with Windows 7. You can upload one of the music file to the http://skydrive.live.com/ using your Live ID. Here are the detailed steps: http://social.technet.microsoft.com/Forums/en-US/w7itproui/thread/4fc10639-02db-4665-993a-08d865088d65
    I will check if I can change the data on our machine.
    In addition, some users resolved the issue by changing the data tagging from ID3 version 2.4 to version 2.3. Please try the following tool:
    http://download.cnet.com/ID3-TagIT/3000-2169_4-10544467.html?tag=mncol
    Please Note: The third-party product discussed here is manufactured by a company that is independent of Microsoft. We make no warranty, implied or otherwise, regarding this product's performance or reliability. 
    You can also try change the tagging to another type or reset it. NOTE: please backup the music file before modifying it.
    As for the iTunes, according to Apple site, iTunes 9 is compatible with Windows 7, you can download it from the following link:
    http://www.apple.com/itunes/download/
    Hope it helps! 
    Vivian Xing - MSFT

  • Portal application not displaying correctly with frame size 125% in IE

    Dear Expert,
    We are facing issue in Portal (7.0) like, when I open the application "Products Coatings" in myWorkspace with Internet Explorer
    display size 100% the frame "xyz" is displayed correctly:But When I open the application "Product Coatings" in myWorkspace with Internet Explorer display size 125% the same frame is NOT displayed correctly.
    Someone can help me in closing this issue..
    Thanks,
    kundan

    Hi,
    How are you opening your portal application? Is it through iViews? Where are you setting the property as 125%?
    Thanks,
    Mahendran B.

Maybe you are looking for