Cant get subpanels to show

Hi i have an application that uses subpanels within a panel. For some reason only one (the northern region panel) is showing up and i cannot figure out why. I have banged my head for hours and cant get it to work . If any one has any suggestions it would be greatly appreciated...thanks in advance!
import  java.awt.*;
import  java.awt.event.*;
import  javax.swing.*;
   A GUI application with a button for which the number
   of clicks is kept track of and displayed
   @author Jared Letendre
   @version 09-18-07
public class NicerDiceRoller extends GameDie
       creates a NicerDiceRoller frame
       @param args not used here
    public static void main(String args[])
        RollerFrame mainFrame = new RollerFrame();
        mainFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );   
        mainFrame.setVisible(true);
   A frame with a panel containing six labels and three buttons
class RollerFrame extends JFrame
       constructs a RollerFrame frame instance
    public RollerFrame()
        this.setTitle("Dice Roller");
        this.setSize(this.DEFAULT_WIDTH, this.DEFAULT_HEIGHT);
        // add RollerPanel panel to frame
        RollerPanel panel = new RollerPanel();
        this.add(panel);
    // data fields
    private final static int DEFAULT_WIDTH = 400;
    private final static int DEFAULT_HEIGHT = 400;
   A panel with six labels and three buttons, that displays the value of one of three dice
   that are rolled when each button has been clicked. Keeps track of sum of all rolls
class RollerPanel extends JPanel
       constructs a RollerPanel panel instance
    public RollerPanel()
        this.setLayout(new BorderLayout());
        // create the labels for the northern panel
        JPanel nPanel = new JPanel();
        this.add(nPanel, BorderLayout.NORTH);
        JLabel welcome = new JLabel("Nicer Dice Roller");
        JLabel myName = new JLabel("By: Jared Letendre");
        welcome.setForeground(Color.BLUE);
        nPanel.add(welcome);
        nPanel.add(myName);
        // create the label for the southern panel
        JPanel sPanel = new JPanel();
        rollValue = new JLabel();
        rollValue.setForeground(Color.BLUE);
        this.add(sPanel, BorderLayout.SOUTH);
        sPanel.add(rollValue);
        // create the spacer panels for east and west regions
        JPanel leftPanel = new JPanel();
        JLabel leftSpace = new JLabel("     ");
        this.add(leftPanel, BorderLayout.WEST);
        JPanel rightPanel = new JPanel();
        JLabel rightSpace = new JLabel("     ");
        this.add(rightPanel, BorderLayout.EAST);
        leftPanel.add(leftSpace);
        rightPanel.add(rightSpace);
        // create the labels and buttons for the center panel
        JPanel cPanel = new JPanel();
        cPanel.setLayout(new GridLayout(3, 2, 10, 5));
        this.add(cPanel, BorderLayout.CENTER);
        JButton die1 = new JButton("Roll Dice #1");
        die1.setActionCommand("firstDie");
        die1.setForeground(Color.BLUE);
        die1.setBackground(Color.RED);
        cPanel.add(die1);
        JButton die2 = new JButton("Roll Dice #2");
        die2.setActionCommand("secondDie");
        die2.setForeground(Color.BLUE);
        die2.setBackground(Color.RED);
        cPanel.add(die2);
        JButton die3 = new JButton("Roll Dice #3");
        die3.setActionCommand("thirdDie");
        die3.setForeground(Color.BLUE);
        die3.setBackground(Color.RED);
        cPanel.add(die3);
        rollSum = new JLabel();
        dice1Count = new JLabel();
        dice2Count = new JLabel();
        dice3Count = new JLabel();
        cPanel.add(dice1Count);
        cPanel.add(dice2Count);
        cPanel.add(dice3Count);
        // add labels and button to this panel
        this.add(rollSum);
        // create button action (so dice will be rolled),
        //    and associate that action with corresponding button
        RollerAction action = new RollerAction();
        die1.addActionListener(action);
        die2.addActionListener(action);
        die3.addActionListener(action);
    } // end RollerPanel constructor
       An action listener that rolls a dice based on what button is clicked
    private class RollerAction implements ActionListener
           decides which button was clicked and rolls the corresponding dice
           displays value of that roll
           accumulated the total of the three dice and displays it.
        public void actionPerformed(ActionEvent event)
            if((event.getActionCommand()).equals("firstDie"))
                 dice1.roll();
                 RollerPanel.this.rollValue.setText("Dice 1 rolled a: " + dice1.getTop());
                 temp1 = dice1.getTop();
                 RollerPanel.this.dice1Count.setText("Dice 1 rolled " + dice1.getNumRolls() + " times");
            if((event.getActionCommand()).equals("secondDie"))
                 dice2.roll();
                 RollerPanel.this.rollValue.setText("Dice 2 rolled a: " + dice2.getTop());
                 temp2 = dice2.getTop();
                 RollerPanel.this.dice2Count.setText("Dice 2 rolled " + dice2.getNumRolls() + " times");
            if((event.getActionCommand()).equals("thirdDie"))
                 dice3.roll();
                 RollerPanel.this.rollValue.setText("Dice 3 rolled a: " + dice3.getTop());
                 temp3 = dice3.getTop();
                 RollerPanel.this.dice3Count.setText("Dice 3 rolled " + dice3.getNumRolls() + " times");
            total = temp1 + temp2 + temp3;
            RollerPanel.this.rollSum.setText("Your total roll is: " + total);
    // data fields for RollerPanel
    int total = 0;
    int temp1, temp2, temp3;
    JLabel rollValue;
    JLabel rollSum;
    JLabel dice1Count;
    JLabel dice2Count;
    JLabel dice3Count;
    GameDie dice1 = new GameDie();
    GameDie dice2 = new GameDie();
    GameDie dice3 = new GameDie();
} // end of class RollerPanelEdited by: jaredL on Oct 6, 2007 12:14 PM

this line, near end of RollerPanel constructor is the problem
this.add(rollSum);
you've set RollerPanel as a BorderLayout, so by not specifying 'where' in the BorderLayout
rollSum is to go, it defaults to CENTER, effectively knocking out cpanel (the panel with the buttons)

Similar Messages

  • Cant get downloads to show the save & run boxes.. Adobe flash player

    Cant get downloads to show the save & run boxes in Adobe Flash Player

    You need to proved more information or a screenshot; I cannot understand what you mean.

  • I cant get contacts to show, I enter but it still says no contacts

    I cant get contacts to show, I enter but it still says no contacts

    I can see contacts in facetime but not in the facetime app

  • Cant get icloud to show in Outlook 2010 . it is added in.

    I have just moved onto a new computer,PC , installed Office 2010 and managed to get mail accounts sorted but not contacts or calender appointments. Was hoping to grab these from Icloud, but II cant get it to show in Outlook. I have downloaded the addin, and that shows in 'addins' but not available in outlook itsel. Help!

    It's very strange that the other commands work but not the GotoSlide one. Are the paths you use the same?
    _root.yourmoviecliploaderinstancename_mc.rdcmndGotoSlide = 4;
    _root.yourmoviecliploaderinstancename_mc.rdcmndPause = 0;
    _root.yourmoviecliploaderinstancename_mc..rdcmndResume = 1;
    You could also try to add the instance "movie" to your path. I've seen that a couple of times and also in an answer from Adobe.
    _root.yourmoviecliploaderinstancename_mc.movie.rdcmndGotoSlide = 4;
    _root.yourmoviecliploaderinstancename_mc.movie.rdcmndPause = 0;
    _root.yourmoviecliploaderinstancename_mc.movie.rdcmndResume = 1;
    In regards to redoing the project in CP3 you could actually copy/paste the slides from CP4 to CP3. I just had to do that with a big project we created in CP4 but for some weird reason all the embedded animations and sounds played on the first slide of the project when we published it. There was no way we could fix it (we tried all possible solutions) so we had to revert back to CP3. Fortunately it's possible to copy & paste slides directly from CP4 and into CP3. If you have used any CP4 specific solutions they won't work but otherwise you should be fine. The only think we lost in the copy / paste process was the timing of buttons/click boxes so we needed to redo those. Still it was far better than having to create the entire project from scratch in CP3.
    /Michael

  • Cant get iMovie08 to show all photos that are in iphoto.

    Can't get iMovie08 to show all photos that are in iphoto.
    only shows about 30, when there are actually about 60 or so in one album.
    any ideals?

    Can't get iMovie08 to show all photos that are in iphoto... only shows about 30, when there are actually about 60 or so in one album... any ideals?
    Do the photos display correctly in the media browser when the mail library ("iPhoto") heading is selected? If so, you could simply add the photos from the library rather than the specific album. Alternately, if you have to select your photos from an "album," you could try reselecting the photos in the main library in the iPhoto application and create a different album to see if all photos then show up in the secondary album in the iMovie media browser.
    If the "missing" photos do not show up under the main "iPhoto" heading in the iMovie media browser and do not show up in the main library in the iPhoto application, then the files may be corrupted. In this case, simply re-import the original files if possible. You could also try to force a rebuilding of the thumbnail cache, but this is usually done automatically when the application itself detects inefficiencies in thumbnail access or when the application is updated. In any case, there does not appear to be a manual menu option to do this arbitrarily when the user so desires. I suppose you could try to locate and delete the cache manually and hope this forces an automatic rebuild the next time the iPhoto application is opened but I am personally not that familiar with the package structure to advise such action at this time. You might check the iPhoto forum and see if anyone can help you further in this area of endeavor.

  • Cant Get Text To Show In JTextArea

    Hi guys,
    I'm trying to create a very simplistic GUI where the output of an IRC server is shown in a JTextArea. However for the life of me I can not get any text at all to show in the text area. Here's the class that creates the user interface:
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    public class SwingTest extends javax.swing.JFrame implements ActionListener {
         JButton connect = new JButton("Connect");
         JTextArea chat = new JTextArea();
        public SwingTest() {
             //set the title of the frame
             super("Chat Window");
             //set the size of the frame
             setSize(800, 600);
             //set what happens when the close button is clicked
             setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             // create the scroll pane to add the text area to
             chat.setLineWrap(true);
             JScrollPane scroll = new JScrollPane(chat, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
             //create the container panel
             JPanel jp = new JPanel();
             //create the layout manager and assign it to the container panel
             BoxLayout horizontal = new BoxLayout(jp, BoxLayout.Y_AXIS);
             jp.setLayout(horizontal);
             //add the text area and button to the container panel
             jp.add(scroll);
             jp.add(connect);
             //add the container panel to the frame
             add(jp);
             //make the frame and its contents visible
             setVisible(true);
             //add an event listener to the connect button
             connect.addActionListener(this);
        public void actionPerformed(ActionEvent event) {
             int temp = 1;
             SockThread mySock = new SockThread();
                 try {
                      Thread.sleep(20000);
                  while(temp == 1) {
                   while(mySock.pinger != false) {
                        chat.append(mySock.getStatus()+ "\n");
                        mySock.pinger = false;
                        break;
                 } catch  (InterruptedException ie) {
                      chat.setText("Error " + ie.getMessage());
        public static void main(String[] arguments)  {
             //create an instance of the SwingTest class and let it do its thing
             SwingTest st = new SwingTest();
    }

    Thanks hiwa, i did what you suggested and created a worker thread, but still I'm getting nothing in that JTextArea. I'm new to working with worker threads though, so if anyone wouldn't taking a look at my code just to see if I'm doing something wrong i would greatly appreciate it.
    Here is my worker class:
    import javax.swing.*;
    public class ChatWorker extends SwingWorker {
         String messages;
         String output;
         JTextArea chat;
         public ChatWorker() {
              super();
         protected String doInBackground() {
              int temp = 1;
              SockThread st = new SockThread();
              try {
                   Thread.sleep(20000);
                   //Perpetual loop needed to keep checking for server messages
                   while(temp == 1) {
                   while(st.pinger != false) {
                        messages = st.getStatus();
                        st.pinger = false;
                        break;
              } catch (InterruptedException ie) {
              return messages;
    }And here is the update gui class to make use of the worker thread:
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    import java.beans.*;
    public class SwingTest extends javax.swing.JFrame implements ActionListener, PropertyChangeListener {
         JButton connect = new JButton("Connect");
         JTextArea chat = new JTextArea();
         ChatWorker cw;
        public SwingTest() {
             //set the title of the frame
             super("Chat Window");
             //set the size of the frame
             setSize(800, 600);
             //set what happens when the close button is clicked
             setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             // create the scroll pane to add the text area to
             chat.setLineWrap(true);
             JScrollPane scroll = new JScrollPane(chat, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
             //create the container panel
             JPanel jp = new JPanel();
             //create the layout manager and assign it to the container panel
             BoxLayout horizontal = new BoxLayout(jp, BoxLayout.Y_AXIS);
             jp.setLayout(horizontal);
             //add the text area and button to the container panel
             jp.add(scroll);
             jp.add(connect);
             //add the container panel to the frame
             add(jp);
             //make the frame and its contents visible
             setVisible(true);
             //add an event listener to the connect button
             connect.addActionListener(this);
        public void actionPerformed(ActionEvent event) {
             try {
             cw = new ChatWorker();
             cw.addPropertyChangeListener(this);
             cw.execute();
             } catch (Exception exc) {
        public void propertyChange(PropertyChangeEvent event) {
             try {
                  String tempText = (String)cw.get();
                  chat.append(tempText + "\n");
             }catch (Exception exc) {
        public static void main(String[] arguments)  {
             //create an instance of the SwingTest class and let it do its thing
             SwingTest st = new SwingTest();
    }

  • Cant get Motocast to show music on phone?

    I downloaded the Motocast on PC and the phone picked up on my documents which have pics and the picture file plus videos. I then decided to download a music site onto PC called Imesh and it lets me download songs onto PC but now when I get on phone it does not bring the music up on phone just shows Picture, document and video files. I go on PC to Motocast and check settings and the Imesh music I downloaded shows it there in a file which I click on and it shows the songs but nothing on the phone for music is there, shows no music. What did I do wrong and how can I fix it.

    Your photos will not show up on www.iCloud.com
    They are only viewable on an iOS device that has photostream enabled
    On a Mac running Lion or later that has photostream enabled in Apple> Preferences > iCloud
    The My Documents/Pictures folder on a Windows machine running the iCloud control panel

  • I cant get library to show in my adobe applications. help?

    Ive tried installing the applications again from creative cloud. Anyone experienced this before?

    Nobody can tell you anything without proper system info or other technical details. Start by reviewing this:
    Sign in, activation, or connection errors | CS5.5 and later, Acrobat DC
    Also make sure local security tools are not blocking anything from loading the panel.
    Mylenium

  • My iphone contacts wont sync to outlook. i used the cloud once, now i cant get them to show up on outlook.

    i used to have all contacts on my iphone and outlook. one time i backed up to cloud as another form of saving data just in case my desktop crapped out. now i go turn off back up to cloud and my iphone has all the contacts but outlook has 0. i have it syncing to outlook from itunes, but nada.
    please help.

    Hey Janice Lucoff,
    Thanks for the question. It sounds like you are experiencing issues backing up your iPhone 4s in iTunes, which is causing issues finishing the sync of your device. The following resource should help resolve your issue, as it refers to the exact error message you described:
    iOS: If you can't back up or restore from a backup in iTunes
    http://support.apple.com/kb/TS2529
    Thanks,
    Matt M.

  • I have a macbook running on 10.6.8 and my itunes running on 11.1.1 .... i cant get my itunes to show Itunes Radio in my music tabs.... someone help

    I have a macbook running on 10.6.8 and my itunes running on 11.1.1 .... i cant get my itunes to show Itunes Radio in my music tabs.... someone help

    There is also an option to reset all data on the device with the next sync.
    MJ

  • I cant get my iphone to show up in my itunes...i downloaded the update last night and now it will not sync at all

    I cant get my iphone to show up in my itunes.  I downloaded the new update last night and I havent been able to sync it since

    See section 5 of TS1538: iOS: Device not recognized in iTunes for Windows.
    If that doesn't help it may pay to tear down and reinstall iTunes in the following manner...
    Go to Control Panel > Add or Remove Programs (Win XP) or Programs and Features (later)
    Remove all of these items in the following order:
    iTunes
    Apple Software Update
    Apple Mobile Device Support (if this won't uninstall move on to the next item)
    Bonjour
    Apple Application Support
    Reboot, download iTunes, then reinstall, either using an account with administrative rights, or right-clicking the downloaded installer and selecting Run as Administrator.
    The uninstall and reinstall process will preserve your iTunes library and settings, but ideally you would back up the library and your other important personal documents and data on a regular basis. See this user tip for a suggested technique.
    Please note:
    Some users may need to follow all the steps in whichever of the following support documents applies to their system. These include some additional manual file and folder deletions not mentioned above.
    HT1925: Removing and Reinstalling iTunes for Windows XP
    HT1923: Removing and reinstalling iTunes for Windows Vista, Windows 7, or Windows 8
    tt2

  • I have my macbook pro connected to my lg tv and cant get it to play netflix it only shows the galaxy screen???

    My macbook pro is connected to my Lg tv by hdmi chord.  The tv shows the screen that has the galaxy on it but i cant get it to switch to netflix???  Help

    Hi shesmart2,
    So it sounds as if you are not getting video from your MacBook Pro to your external TV display via the HDMI cable. I would suggest looking at this article to start with -
    Mac computers: Frequently asked questions about using HDMI
    http://support.apple.com/kb/HT4214
    You may also wish to troubleshoot using the steps in this article -
    Apple computers: Troubleshooting issues with video on internal or external displays
    http://support.apple.com/kb/HT1573
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • I reset all the settings last night, now I cant get any icons up, plus I'm on a local computer that cant download itunes, anyone know how i can get my screen back to normal? All it shows is the itunes sybol with the usb cord connecting to it.

    I reset all the settings last night, now I cant get any icons up, plus I'm on a local computer that cant download itunes, anyone know how i can get my screen back to normal? All it shows is the itunes sybol with the usb cord connecting to it.

    Your only option at this point is to connect the device to a computer running iTunes so you can restore it.
    B-rock

  • HT2188 my ipad is stuck on itunes  showing the usb lead and cant get off it touch the screen nothing happens

    my ipad is stuck on itune showing the usb cable but cant get it off

    After a trip to the Apple Store with this problem, I found out that USB connections have different levels of power.  Try changing USB ports, then look for iTunes to recognize the iPad is connected.  Good luck!

  • Mini shows connect to outlet icon, cant get it to do anything

    updated ipod mini software, it asked me to connect it to power outlet, i did so. now it shows an icon (ipod charger connected to outlet) cant get it recognized by pc, the computer doesnt see it. when i turn on the ipod it shows the apple icon and then connect to outlet icon. when i conncet it to pc, shows the same. when connect it to charger, shows the same.

    Hello Pickelilly,
    Thank you for using discussions.apple.com, I am glad to help!
    What do you mean by connect to itunes icon? It's in recovery mode, right?
    Try forcing to turn off:
    Press the home button and power button together. This forces a power off.
    Try DFU mode
    Plug your device into your computer with a USB cable.
    Turn off the device.
    Hold the Power button for 3 seconds.
    Hold the Home and Power buttons for 10 seconds.
    Release the Power button but keep holding the Home button.
    After about 15 seconds you will be alerted by iTunes saying that it has detected a device in Recovery Mode.
    Related links:
    http://theiphonewiki.com/wiki/DFU_Mode
    https://www.google.com.lb/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact= 8&ved=0CCAQtwIwAg&url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbITIiGswjFI&ei= LmvPU6XlN6PC0QWwsIGQDQ&usg=AFQjCNEQvI_QGWOP3d8fMDtMAT_ExonaiQ
    http://osxdaily.com/2010/06/24/iphone-dfu-mode-explained-and-how-to-enter-dfu-mo de-on-your-iphone/
    Make sure you have the latest version of itunes  
    That may be a bug in your version and Apple has probably released a fix for it.
    I hope I helped,
    Ab

Maybe you are looking for