JFrame remains blank until manually resized

I have two jframes here, one works correctly, however the second one refuses to draw until I manually resize it.
JFrame test = new JFrame("test");
     public BilliardGame (String title) {
          super(title);
          setSize(400,700);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          setLocation(100,100);
          table = new ShuffleboardPanel(this);                             
          setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));                             
          add(table); //add the whole table view    
          JViewport view = new JViewport();
          view.setViewSize(new Dimension(199, 199));
          view.setViewPosition(new Point(0, 0));
          view.setView(new ShuffleboardPanel(test));
          test.setSize(200, 200);
          test.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
          test.setVisible(true);
          test.setLayout(new BorderLayout());
          test.add(view, BorderLayout.CENTER);
          update();
     }ShuffleboardPanel is just a JPanel, no static variables between them. I just cant understand why this is happening.

you could also try this
//test.setVisible(true);//<---------move to after the component is added
test.setLayout(new BorderLayout());
test.add(view, BorderLayout.CENTER);
test.setVisible(true);//<------move to here

Similar Messages

  • Activity monitor remains blank

    I installed OS X Mavericks. It's great. Speeds up a lot of things, but, the activity monitor is a bit laggy, may be even buggy. Previously on Mountain Lion, whenever I opened Activity monitor, it showed all the active processes. But now when I open it, the window remains blank. I have to manually do view> all processes to show things up.
    Also the update frequency has been slow, very slow in Activity monitor. Am I the only one or others are facing the same problem?

    I have more information. I read a post here that claimed wake up from S3 stops working if you over clock BCLK past 170.  I reset my bios to safe settings and set up hybrid S3 sleep and it worked !!!
    Next step was to start to apply my over clock one step at a time and find which bit was messing up S3 wake up. It does seem to be the BCLK. With memory clock multiplier set very low so that memory wasn't the problem, I adjusted BCLK upwards until S3 wakeup stopped working. I haven't finished testing yet but it is somewhere between 165 and 170. As long as BCLK is at 165, wake up from S3 works fine. The other post can be red here:-
    https://forum-en.msi.com/index.php?topic=136780.0
    If this is the problem, it's very disappointing because my system runs stable at BCLK 195 with the multiplier at 21.
    Mike H

  • When I click on a link that opens up automatically in a new window (ie internet banking), it will not load at all.Page remains blank.

    Links that open in new windows do not load. The page remains blank. I have downloaded other web browsers and these pages all work with these browsers. I have been using firefox for years and this has only started happening in the last month or so. Is there an update that can fix this? I have also uninstalled and then reinstalled firefox and still the same thing.
    There are no error messages, just a picture of a white sheet of paper in the top left hand corner with the writing "search book marks and history". New tabs are working, it's just the new windows that won't load.

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • Panel doesn't display properly until I resize the frame

    Hiya folks,
    I'm currently trying to write a simple piece of music notation software. This is my first time using swing beyond a relatively simple JApplet and some dialog stuff. Anywho, I ran into a pretty discouraging issue early on. So far I've got a frame with a menu bar and a toolbar on the bottom border. The toolbar contains a button which should draw a new staff panel containing 11 panels (potentially more) within it, alternating between lines and spaces. Sort of like this:
    import javax.swing.*;
    import java.awt.*;
    public class Staff extends JPanel {
       private static JPanel nsp1,nsp3,nsp5,nsp7,nsp9,nsp11;
       private static JPanel nsp2,nsp4,nsp6,nsp8,nsp10;
       private ImageIcon image= new ImageIcon(this.getClass().getResource( "icons/treble clef.gif"));
        public Staff(){
        setLayout(new GridLayout(11,1));
        add(nsp1= new NoteSpace());
        add(nsp2= new LineSpace());
        add(nsp3= new NoteSpace());
        add(nsp4= new LineSpace());
        add(nsp5= new NoteSpace());
        add(nsp6= new LineSpace());
        add(nsp7= new NoteSpace());
        add(nsp8= new LineSpace());
        add(nsp9= new NoteSpace());
        add(nsp10= new LineSpace());
        add(nsp11= new NoteSpace());
    static class NoteSpace extends JPanel{
        public NoteSpace(){
        setPreferredSize(new Dimension(this.getWidth(),2));
    static class LineSpace extends JPanel{
          public LineSpace(){
          setPreferredSize(new Dimension(this.getWidth(),1));
          public void paint(Graphics g) {
              super.paint(g);
              g.drawLine(0, (int) super.getHeight()/2, (int)super.getWidth(), (int)super.getHeight()/2);
    }Anyway, this panel displays as a tiny box wherein nothing is visible until I resize the frame. Really frustrating. And I have have no idea what the problem might be. Here's the actionlistener:
    jbtcleff.addActionListener(new ActionListener (){
            public void actionPerformed (ActionEvent e){
                staff.setBounds(50,panel.getHeight()/2,panel.getWidth()-50,panel.getHeight()/2);
                panel.add(staff);
                staff.repaint();
            });...which is located in a custom jtoolbar class within the Main class, an extension of JFrame:
    public class Main extends JFrame{
       JMenuBar jmb=new CustomMenuBar();
       JToolBar jtb= new CustomToolBars("ToolBar");
       static boolean isStaff=false;
       static boolean isNote=false;
       static JPanel panel = new JPanel();
       private static Staff staff= new Staff();
        private static Toolkit toolkit= Toolkit.getDefaultToolkit();
       private static Image image=toolkit.getImage("C:/Users/tim/Documents/NetBeansProjects/ISP/src/MusicGUI/icons/treble clef.jpg");
        private static Cursor noteCursor = toolkit.createCustomCursor(image,new Point(0,0),"Image"); 
       public Main (String m) {   
            super(m);
            setJMenuBar(jmb);    
            getContentPane().add(jtb,BorderLayout.SOUTH);       
            panel.setLayout(new CardLayout(60,60));
            getContentPane().add(panel);
    public static void main (String[]args){
            JFrame frame= new Main("Music");
            frame.setSize(800,400);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
            frame.setIconImage(image);
           Sorry for all the code. I'm desperate.
    Thanks!

    Oh my... have you been through the Swing tutorial?
    Let's look at some of your code,
    static class NoteSpace extends JPanel{
        public NoteSpace(){
        setPreferredSize(new Dimension(this.getWidth(),2));
    static class LineSpace extends JPanel{
          public LineSpace(){
          setPreferredSize(new Dimension(this.getWidth(),1));
          public void paint(Graphics g) {
              super.paint(g);
              g.drawLine(0, (int) super.getHeight()/2, (int)super.getWidth(), (int)super.getHeight()/2);
    }Here, NoteSpace and LineSpace are being set to a preferred size of 0x2 pixels, and 0x1 pixels respectfully. If you want them at 0 width, how do you expect them to show? In particular, NoteSpace isn't doing anything special. It's just a panel. Why an inner class? Lastly you should not override paint() for SWING. That's AWT stuff. For Swing, you override paintComponent(Graphics g) .
    Then we have this
    jbtcleff.addActionListener(new ActionListener (){
            public void actionPerformed (ActionEvent e){
                staff.setBounds(50,panel.getHeight()/2,panel.getWidth()-50,panel.getHeight()/2);
                panel.add(staff);
                staff.repaint();
            });I'm not sure what the variable jbtcleff is, but it seems you are adding your Staff panel to "panel" every time a button is pressed.... why? Why not just add it once (outside the action listener) and be done with it. Your panel object has a CardLayout, so I assume you meant to create a new+ staff panel everytime a button is pressed, and then add it to the card layout panel. Even so, setBounds(...) does not seem pertinant to this goal. (In fact, in most situtations the use of setBounds(...) is the antithesis of using layout managers).
    The problem you mentioned though seems to be related to the use of a JPanel (your Staff class) that adds zero-width compontents to a grid array.

  • Some pages appear blank until I refresh the page then it displays normally

    When selecting some websites the page is blank until I refresh.

    This also happens to me (on Linux), usually when switching back to a tab which had already been displayed properly before. Suddenly the page is blank and the page must be reloaded manually.

  • I updated my ipad mini to iOS 6.1.2 and have not been able to update my apps in the AppStore since. It say I have updates available but the page remains blank. I have tried switching the unit off and on and to no avail. Can anyone help?

    I updated my ipad mini to iOS 6.1.2 and have not been able to udate my apps in the AppStore since. It say I have updates available but the page remains blank. I have tried switching the unit off and on and to no avail. Can anyone help?

    Try this:
    1. Close all apps in the Task Bar. Double-click the Home button and hold apps down for a second or two. Tap the minus sign to close app.
    2. Hold the Sleep and Home button down until you see the Apple Logo.

  • LR 4 only prints a blank page on Epson 2880. Print preview panes remain blank. Window 7 OS. Need help desperately!

    LR 4 only prints a blank page on Epson 2880. Print preview panes remain blank. Window 7 OS. Need help desperately!

    Bob
    Thank you for your kind consideration of my problem. Up until the software started to print blank pages the preview pane always showed the selected print within the selected layout. Something has changed. Lightroom will print to the JPEG file but only a blank page on the Epson 2880. I've been in contact with Epson support and an IT tech and they tell me the problem is with Lightroom. I'm at my wits end and thinking of upgrading but the glitch may carry over. Uninstalling and reinstalling and deleting the preferences file did nothing to rectify the situation.
    Thanks again!
    David

  • My iPad screen went black suddenly and is not coming back on. However i can still hear sounds when there are notifications but nothing comes on the screen. It remains blank. What is the problem? I NEED ASSISTANCE A.S.A.P!!!

    My iPad screen went black suddenly and is not coming back on. However i can still hear sounds when there are notifications but nothing comes on the screen. It remains blank. What is the problem? I NEED ASSISTANCE A.S.A.P!!!

    Try Reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • Screen remaining blank after reopening lid (after 10.5.2 update)

    Hello
    after (successfully) updating from 10.5.1 to 10.5.2 several relevant problems appeared.
    One is that closing the lid while the computer is on, and then reopening it later, the screen remains blank instead of coming to life. It is possible that the computer itself went to sleep and does not return, but the only way to get back is to press the on button for a few seconds to turn it off the hard way.
    The other problem is described in a separated post. Any help is appreciated.
    Thanks in advance,
    Marinho.

    me too, and I'm about to go nuts. There are tons of people having this issue, I fixed it temporarily by changing my hibernate mode (from 3 to 0) using terminal, everything worked great until the last update, now it's acting up again. Now, if I close my lid, and unplug something, or plug something, it gives me the startup sound (sounds like something moving) and won't come back if I open the lid.
    There has got to be a solution. APPLE, FIX THIS. THIS IS RIDICULOUS.

  • When I download something from the Web, the "Downloads" window opens, but the window remains blank. Before it used to at least show the name of the file and I could open the file from the "Downloads" window. Is there a way to get this functionality back?

    I'm running Windows XP which is updated to latest version (which I think might be Service Pack 3, but not positive.) Mozilla Firefox is version 5.0. I tend to use Google as my search engine so most of the stuff I download comes through sites found through Google, which is also updated.
    At some time in the past (maybe a few versions ago) when I would download a file from the Web, the "Downloads" window would open and in the window would be displayed the name of the file I was downloading or had just completed downloading. I think I used to be able to then click on that file name and the file (or the installation file if needed to start the new program) would open. I am currently using Firefox 5.0 (the "About Firefox" screen says this is up to date) and when I download a file or document, the "Downloads" window appears on the screen as it always has in the past, but it remains blank, i.e., nothing appears in the downloads box. I don't remember making any configuration changes, etc., that may have caused the window to remain blank, but I could be mistaken. I know how to find the items I've downloaded (My Documents / Downloads) and can usually guess what the name of the downloaded file might be, but it used to be much easier when something (anything) showed up in the downloads window.
    I'd love for someone to tell me about a simple fix for this. I'm willing to be quite embarrassed that I did something I shouldn't have.'''

    In Firefox Options / Privacy be sure "Remember download history" is checked. To see all of the options on that panel, "Firefox will" must be set to "Use custom settings for history".
    To find your OS information, on your Windows desktop, right-click the My Computer icon, choose Properties, under System on that small window is info about your OS.
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • When I open firefox the address bar remains blank after a website is loaded from favorites.

    I open Firefox and the open window is blank (as it should be, because I have set my Preferences to open firefox with a blank window.
    Then I select a Bookmarked website from my Bookmarks Toolbar, which opens then opens that website in the window fine.
    BUT, the Address Bar remain blank. It does not display the URL of the web page that has been opened from the Bookmark. Why not? Firefox always did this in the past, but this problem has existed since the last few updates, and still does now on the latest v22.0 for MAC.
    If I open another blank TAB, then switch back to the first tab, the URL of the first tab does appear. But what a pain. I shouldn't have to open another tab, then switch back to the first tab, just for the URL to appear in the address bar.
    I can't believe this problem has existed for so long now over at least 2 or more version upgrades.
    Please fix.

    I was not able to reproduce your problem using Firefox 22.0 for OS X (running OS X 10.8).
    There might be an extension at fault here. You can try and launch Firefox in Safe mode to try and eliminate possible causes.
    You can aslo take a look at this page: http://mzl.la/MnSTZB

  • Firefox opens, but my tabs are blank. And when I put in any web address it does nothing, just remains blank.

    My internet is working fine, I am in fact writing this on Internet Explorer. But Firefox is my preferred browser. I was using it last night just fine, and I left my computer on sleep, when I booted it up this morning it wouldn't allow me to navigate to any sites on Firefox. The tabs just remained blank. I even uninstalled and reinstalled the program, but nothing.

    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

  • Premiere Pro cs6 - Workspace video pane remains blank when trying to view imported files

    Hello,
    I'm currently working in Adobe Premiere Pro CS6. When I import my media into my workspace and drag it onto the timeline, the preview box where you can review your cut video remains black. Double clicking on the imported file gives the same result. I was initially importing .jpg files (about 300kb size for each) so I tried importing various other image formats - .png, .tiff, etc... I have even imported a movie file into my scene to determine whether the issue was with my content format. With the video, the audio plays fine, but the video remains blank in the preview box. I have tried rendering my workspace and changing my initial project settings, but to no avail. I went into my preferences for Premiere and from what I can determine, everything looks fine.
    I'm running the software on an HP Pavilion, Windows 7 intel i7, 8gb ram, with a nvidia 650M 2GB card. Any help would be greatly appreciated. Thanks!

    Hi,
    Have you tried to change your Video Renderer? It would be under Project > Project Settings > General. Switch the option to Mercury Playback Engine software only and see if it helps.
    Thanks,
    Rameez

  • All USB ports seem to stop working "randomly" but some remain functioning until unplugged and plugged back in. [WINDOWS 8.1]

    The devices that die right away are the network adapter and any USB memory stick plugged in, they still have their lights and all running but aren't recognized in "This PC" and the network adapter isn't found in "Control Panel\Network and
    Internet\Network Connections".
    My keyboard, wireless mouse that runs through the keyboard's USB ports and the external HDD remains functional UNTIL I pull the plug on them, after that plugging them back in does nothing.
    I put randomly in quotations because it seems to fail more often when I download something at speeds over 3Mb/s, for an example downloading Hearthstone through the Battle.Net client will more often than not make the issue happen after a little bit. BUT it still
    happens randomly during NO network load what-so-ever.
    Parts: 
    CPU| FX-8350
    GPU| Radeon 5850
    Motherboard | Crosshair IV Formula
    RAM | 2x DDR3
    PSU | 700W Gold 
    SSD| Evo 850
    OS | Windows 8.1
    I HAVE:
    * [Downloaded these chipset drivers](http://support.amd.com/en-us/download/chipset?os=Windows%208.1%20-%2064)
    * Installed all Windows 7 drivers I could find except the BIOS ones due to lack of Windows 8.1 drivers from http://www.asus.com/Motherboards/CROSSHAIR_IV_FORMULA/HelpDesk_Download/
    * Turned off "Allow this computer to turn off this device to save power" in Device Manager for ALL devices in the USB tab that had the option, and the Network tab.
    * Set the Power Options to high performance and disabled "USB Selective Suspended Setting"
    I simply don't know what to do anymore and it's breaking me down, I need this fixed before the weekend or the LAN I'm planning to go to will be a disaster and I'll probably go insane trying to solve this myself. 
    Just tell me whatever more information you could need and I'll supply it, I'm desperate to get this solved.
    **I never had any of these issues on my old PC that had different parts but the same network adapter and external HDD so they are not to blame for this, same for keyboard and mouse.**

    Hey, I hope this helps you out a bit... I have had the same issue on my Asus K55A notebook with Win8.1 Pro x64 from the beginning! Thru my extensive research I found something interesting and the possible cause to all this! What I found was that by design
    the xHCI Host Controller has virtual HS 2.0 Ports linked to the 3.0 Ports... Enabling compatibility with 2.0 devices ok... What happens is that the xHCI stack is unstable just like you say... The ONLY WAY I was able to fix the problem was by unlocking the
    UEFI/BIOS to allow me full access to USB Configurations... I had to disable 2 of the HS ports under the xHCI Controller since I have only 2x 3.0 ports... This allowed 3.0 devices to be enumerated correctly under the xHCI stack and 2.0 devices now were enumerated
    under the EHCI 2.0 stack... That's what worked in my case... I'm still digging around for more info about this issue because I find it so odd that no one discovered this when designing xHCI stacks and drivers at MS for Win8/8.1 x64... I hope I shed some light
    on this issue... Good luck and keep us posted!
    Hi, Sebastian. I have the same problem but i'm getting crazy trying to solve it. Can you help me to unlock the UEFI to access full USB config? and give me some suggestions on how to solve the problem?
    My mail is roquen(at)gamail(dot)com
    Thanks in advance!

  • The "updates" page on my iTunes Store on my iPad doesn't open, the screen remains blank...please help  

    The "updates" page on my iTunes Store on my iPad doesn't open, the screen remains blank...please help  

    Mine is doing the exact same thing.  12 updates and I cannot select any of them for the past week.

Maybe you are looking for

  • Weblogic 12.1.1 Java-level deadlock

    Hi! Recently i accidentally saw that my wl server stop responding. Here is the short thread dump. If somebody need the full one - mail me please. [email protected] java version "1.6.0_34" Java HotSpot(TM) 64-Bit Server VM (build 20.9-b04, mixe

  • MacBook Pro as clone

    I have a PowerMac at home and while in hospital my son bought a Macbook Pro for me so that I could do some work and not getting mad by boredom. He used the Migration Assistant to load the laptop of everything that I had on the PowerMac. Soon I can go

  • Possible fix for "ContentAgent not found"

    Ever since I upgraded to Leopard, my distributed processing setup has rarely worked. I tried most, if not all the suggestions found here in the forums (forii?) to no avail. With one last journey through the zillions of log files, I stumbled on this e

  • Installing airport card: please help me!

    I have put it into my friends clamshell ibook g3,..following the right instructions for physical installation under the keyboard,. but when i turn on the laptop, no new hardware is detected, and there is none in the system properties, or whatever its

  • Is utilities bbp & user manuals

    Hi, since i am new to utiliteis, i am looking for the experts help can anybody help me by sharing the is utilities BBP & user manuals thanks in advance. Regards,