One JPanel is missing after adding two JPanels to a JFrame

I have two classes, ScoreTableView and CardView, which both extends the JPanel class. ScoreTableView is used to show one table only, and CardView is to show a set of cards for a memory game. My objective is to separate the development of the panels, so that it will easier to modify either of them later. I add instances of these two class to the contentPane of my top level JFrame object. However, I can only see the ScoreTableView(which is supposed to show me a table only) on the top part of the frame, and the CardView panel never show up.
ScoreTableView.java
  public ScoreTableView(int numberOfPlayer){
//      Create a model of the data.
        scoreTable = new JTable();//this scoreTable is a JTable object
        scoreTable.setModel(scoreTableData);  //scoreTableData is my data    
        JScrollPane jsp = new JScrollPane(scoreTable);          
        p = this;
        p.setLayout(new BorderLayout());
        p.add(jsp, BorderLayout.CENTER);
    }CardView.java
public CardView(int w, int h){
        cardWidth = w;
        cardHeight = h;
        JPanel cardPanel = new JPanel();
        cardPanel.setLayout(new GridLayout(cardWidth,cardHeight)); 
        CardImageButton[][] cardsButtons = new CardImageButton[cardWidth][cardHeight];
      // ... more other none GUI coiding 
         }Here's what I have in my main
        Container contentPane = jf.getContentPane();//jf is the JFrame object          
        contentPane.setLayout(new BorderLayout()); 
//      create the score panel                 
        ScoreTableView scoreTableView = new ScoreTableView(4);
      contentPane.add( scoreTableView, BorderLayout.NORTH);
        //create the cards panel
        CardView cardPanel = new CardView(4,4);
        contentPane.add(cardPanel, BorderLayout.CENTER);
        jf.pack();
        jf.setVisible(true);      

Sorry, but I copied the wrong files. Now both panels can show up, but the score table is on the NORTH, and the card panel is on the SOUTH(although I set it to CENTER and wish it can occupy the rest of the window), but the center part of the window has nothing. How can I get rid of the white space, so that the score panel can can 30% of the top part of the window(even after resize), and the card panel can occupy the remaining 70%? I can't attach pictures here, otherwise I can upload some screenshot to show you what's the problem I have. Thank you in advance.
This is my CardView class, I didnt' copy all of them upstair.
public class CardView extends JPanel{
    private int cardWidth;
    private int cardHeight;
    private CardModel cm;
    private JPanel cardPanel;
    public CardView(int w, int h){
        cardWidth = w;
        cardHeight = h;
        cardPanel = this;
        cardPanel.setLayout(new GridLayout(cardWidth,cardHeight)); 
        CardImageButton[][] cardsButtons = new CardImageButton[cardWidth][cardHeight];
        int[][] list  = init(cardWidth, cardHeight);       
        cm = new CardModel(list);
        int count = 0;
        for(int i=0;i<cardWidth;i++){
            for(int j=0;j<cardWidth;j++){
                cardsButtons[i][j] = new CardImageButton("Press me"+count, cm, i, j, 0);
                cardPanel.add(cardsButtons[i][j]);
                count++;               
public int[][] init(int n, int m){
        int[][] list  = {
                {1, 2, 1, 1},
                {2, 1, 2 , 2},
                {1, 2, 1, 1},
                {2, 1, 2 , 2} };
        return list;
    }This is from my main.
       //setup the content panel
        Container contentPane = jf.getContentPane();          
        contentPane.setLayout(new BorderLayout()); 
//      create the score panel                 
        ScoreTableView scoreTableView = new ScoreTableView(4);
      contentPane.add( scoreTableView, BorderLayout.NORTH);
        //create the cards panel
        CardView cardPanel = new CardView(4,4);
        contentPane.add(cardPanel, BorderLayout.CENTER);
        jf.pack();
        jf.setVisible(true);   ScoreTableView.java
  public ScoreTableView(int numberOfPlayer){
//      Create a model of the data.
scoreTable = new JTable();//this scoreTable is a JTable object       
scoreTable.setModel(scoreTableData);  //scoreTableData is my data            
JScrollPane jsp = new JScrollPane(scoreTable);                  
p = this;       
p.setLayout(new BorderLayout());       
p.add(jsp, BorderLayout.CENTER);   
}

Similar Messages

  • TS1424 Bought and Album and one song is missing after itunes froze  cant see how to dowload the missing song as it says Purchased

    Bought and Album and one song is missing after itunes froze  cant see how to dowload the missing song as it says Purchased
    Pls Help  Best and Kind Regards

    Depending upon what country that you are in (music can't be re-downloaded in all countries) then see if it shows under the Purchased link under Quicklinks on the right-hand side of the iTunes store home page on your computer's iTunee. If it shows there but doesn't have the clpud symbol against it for redownloading then is that track listed in the Music part of your library i.e. where you would click on it to play it ? If it is then delete it from there and it should then get the cloud symbol against it in Purchased.
    If you aren't in a country where you can re-download music or if it re-downloads in the same state then try the 'report a problem' page to contact iTunes Support : http://reportaproblem.apple.com . iTunes Support should reply within, I think, about 24 hours.
    If the 'report a problem' link doesn't work then you can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • Field "Location of Linked Object" missing after adding a page to a role

    I am using EP5 (5.06.01.00). After adding a page to a role, the properties of the page in the role no longer include the field "Location of Linked Object". The properties now only consist of two fields: "Name" and "Location". They used to contain a third field "Location of Linked Object", in fact, in older roles the page properties still contain this field. However, when I now add pages to a role or workset, this third property field "Location of Linked Object" is not there. - I am adding the page by clicking the "Add" button to move a page from the "View" area to the role in the "Edit" area. - I have been observing this symptom for several months, but I can not identify any configuration changes or upgrades which would have caused this behavior.
    All hints will be greatly appreciated.
    Thank you
    Message was edited by: Carsten Mund

    I am using EP5 (5.06.01.00). After adding a page to a role, the properties of the page in the role no longer include the field "Location of Linked Object". The properties now only consist of two fields: "Name" and "Location". They used to contain a third field "Location of Linked Object", in fact, in older roles the page properties still contain this field. However, when I now add pages to a role or workset, this third property field "Location of Linked Object" is not there. - I am adding the page by clicking the "Add" button to move a page from the "View" area to the role in the "Edit" area. - I have been observing this symptom for several months, but I can not identify any configuration changes or upgrades which would have caused this behavior.
    All hints will be greatly appreciated.
    Thank you
    Message was edited by: Carsten Mund

  • Two jpanels, after disableing button s-times it appears on the top jpanel

    I create two JPanels. The first JPanel contains JButton, the second JPanl contains overrided paintComponent - it's a simple background.
    Firstly I add 1st jpanel to jframe, then I add the second jpanel with a background image. Then I disable a button and sometime this button appears on top of the second jpanel.
    Resources:
    background.png - 1280x1024x24
    b_h & b_n .png - 122x120x24
    I think that when I make a thread where then I will disable a button, it will appear on top of the second jpanel.
    package swing.test.bug;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.io.IOException;
    import javax.swing.JFrame;
    public class MainFrame extends JFrame
      public static int SCREEN_WIDTH = 1280;
      public static int SCREEN_HEIGHT = 1024;
      ScreenWithButton jp1;
      ScreenWithImage jp2;
      public static void main(String[] args) throws IOException
        MainFrame terminal = new MainFrame();
      public MainFrame()
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setUndecorated(true);
        setResizable(false);
        setBounds(0, 0, 1280, 1024);
        getContentPane().setLayout(null);
        (jp2 = new ScreenWithImage()).setBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        getContentPane().add(jp2);
        (jp1 = new ScreenWithButton()).setBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        getContentPane().add(jp1);
        jp1.setVisible(true);
        jp2.setVisible(true);
        setVisible(true);
        jp1.info.setEnabled(false);
      public static final BufferedImage getBufferedImage(String url)
        try
            BufferedImage image = javax.imageio.ImageIO.read(new File("c:\\" + url));
            return image;
        catch (Exception ex)
            ex.printStackTrace();
            return null;
    package swing.test.bug;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    public class ScreenWithButton extends JPanel
      JButton info;
      public ScreenWithButton()
        setOpaque(false);
        setLayout(null);
        info = new JButton("", new ImageIcon(MainFrame.getBufferedImage("/com/b_n.png")));
        info.setPressedIcon(new ImageIcon(MainFrame.getBufferedImage("/com/b_h.png")));
        info.setDisabledIcon(new ImageIcon(MainFrame.getBufferedImage("/com/b_h.png")));
        info.setContentAreaFilled(true);
        info.setBorderPainted(false);
        info.setFocusPainted(false);
        info.setBounds(1000, 82, 122, 120);
        info.setFocusable(false);
        info.setRolloverEnabled(false);
        add(info);
    package swing.test.bug;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import javax.swing.JComponent;
    import javax.swing.JPanel;
    public class ScreenWithImage extends JPanel
      public ScreenWithImage()
        setOpaque(false);
        setLayout(null);
        ImagePanel p = new ImagePanel();
        p.setImage((BufferedImage) MainFrame.getBufferedImage("/com/background.png"));
        p.setBounds(0, 0, MainFrame.SCREEN_WIDTH, MainFrame.SCREEN_HEIGHT);
        p.setPreferredSize(new Dimension(MainFrame.SCREEN_WIDTH, MainFrame.SCREEN_HEIGHT));
        add(p);
      public class ImagePanel extends JComponent
        private BufferedImage image;
        public void paintComponent(Graphics g)
            if(image != null)
                g.drawImage(image,0,0,null);
        public void setImage(BufferedImage value)
            image = value;
    }

    Hi Alcrouchy,
    I apologize, I'm a bit unclear on exactly what you are describing. If the screen appears to be sliding downward (leaving a blank portion at the top), you may be seeing the Reachability feature of iOS 8 on the iPhone 6/6 Plus. It is intended to make it easier to reach elements towards the top of the screen on the larger iPhones, and is activated by a double tap (not press) on the Home button. There is a bit more about it on this Design page about the iPhone 6:
    Apple - iPhone 6 - Design
    Regards,
    - Brenden

  • Overlapping two JPanels on a JLayeredPane

    I am having some problems overlapping two JPanels on a JLayeredPane for some reason only one of them shows when I compile the program! Any help would be greatly appreciated
    The code is the following:
    import java.lang.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class SpaceBall
    //To do the background just draw a JPanel inside another //JPanel just set the opacity of the outside one
    //to false and let
    //it hold all the components of the game
    public static void main(String[] args)
    //declaring the buttons
    JButton test=new JButton("test");
    JButton test1=new JButton("test1");
    JButton test2=new JButton("test2");
    //declaring and setting the properties of the frame
    JFrame SpaceBall= new JFrame("Space Ball");
    SpaceBall.setSize(700,650);
    //declaring the Panels
    JLayeredPane bgPanel= new JLayeredPane();
    JPanel fgPanel= new JPanel();
    JPanel topPanel= new JPanel();
    JPanel sidePanel= new JPanel();
    JPanel lowPanel= new JPanel();
    JPanel masterPanel= new JPanel();
    //adding the buttons to the corresponding panels
    fgPanel.add(test1);
    sidePanel.add(test2);
    topPanel.add(test);
    ImageIcon background= new ImageIcon("images/background.jpg");
    JLabel backlabel = new JLabel(background);
    backlabel.setBounds(0,0,background.getIconWidth(),background.getIconHeight());
    backlabel.add(test1);
    bgPanel.add(backlabel, new Integer(0));
    fgPanel.setOpaque(false);
    bgPanel.add(fgPanel, new Integer(100));
    bgPanel.moveToFront(fgPanel);
    //adding bgPanel and sidePanel to lowPanel
    lowPanel.setLayout(new GridLayout(1,2));
    lowPanel.add(bgPanel);
    lowPanel.add(sidePanel);
    //adding the Panels to the masterPanel
    masterPanel.setLayout(new GridLayout(2,1));
    masterPanel.add(topPanel);
    masterPanel.add(lowPanel);
    //getting the container of SpaceBall and adding the Panels to it
    Container cp=SpaceBall.getContentPane();
    cp.add(masterPanel);
    //displaying everything
    SpaceBall.show();
    WindowListener ClosingTheWindow=new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    SpaceBall.addWindowListener(ClosingTheWindow);

    Take a look at the section from the Swing tutorial titled "How to Use Layered Panes". It has a sample program:
    http://java.sun.com/docs/books/tutorial/uiswing/components/layeredpane.html

  • Setting Up a GUI - FlowLayout - Using Two JPanels

    Hello:
    I am getting confused with setting up a GUI with two JPanels one that would be on top and the other middlePanel having a FlowLayout.
    I set up two JPanels but obviously have something wrong because my northPanel has "disappeared" when I added a middlePanel. My componets are all over the place and again my northPanel is no longer showing.
    Idea of what I'm doing.
    1) Enter total number of diners
    2)Confirm that diners # is correct.
    3)Enter name of Diner
    4)Take order - Entree (Pull-Down)
    5)Two sides (CheckBox)
    6)Display Completed Order of diners.
    P.S. I hope my question is not too stupid I am new and has justed started Java Programming. I have tried to look through the Documentation but am getting confused with GUI relating to FlowLayout, GridLayout. etc. I'm just not sure which one I should use to set up my GUI in an organized manner. Am I on the right track or is my code completely screwed. Thanks.
    ** My Code **
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Menu extends JFrame {
    private JTextField partyNumField, dinerName;
    private JComboBox orderComboBox;
    private int partyNum;
    private JButton getParty, continueOrder;
    private JLabel party, companyLogo, dinerLabel, entreeOrder;
    private String dinnerEntree[] = {"Filet Mignon", "Chicken Cheese Steak", "Tacos", "Ribs"};
    private JCheckBox mashed, cole, baked, french;
    public Menu() {
    super("O'Brien Caterer - Where we make good Eats!");
    Container container = getContentPane();
    JPanel northPanel = new JPanel();
    northPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 80, 5));
    companyLogo = new JLabel("Welcome to O'Brien's Caterer's");
    northPanel.add(companyLogo);
    party = new JLabel("Enter the Total Number in Party Please");
    partyNumField = new JTextField(5);
    northPanel.add(party);
    northPanel.add(partyNumField);
    getParty = new JButton("GO - Continue with Order");
    getParty.addActionListener(
    new ActionListener(){
    public void actionPerformed(ActionEvent actionEvent)
    partyNum = Integer.parseInt(partyNumField.getText());
    String ans=JOptionPane.showInputDialog(null, "Total Number is party is: "
    + partyNum + " is this correct?\n\n" + "Enter 1 to continue\n"
    + "Enter 2 to cancel\n");
    if (ans.equals("1")) {
    System.out.println(ans+"=continue"); // handle continue
    } else { // assume to be 2 for cancel
    System.out.println(ans+"=cancel"); // handle cancel
    ); // end Listener
    northPanel.add(getParty);
    JPanel middlePanel = new JPanel();
    middlePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    dinerLabel = new JLabel("Please enter Diner's name");
    dinerName = new JTextField(30);
    continueOrder = new JButton("continue");
    middlePanel.add(dinerLabel);
    middlePanel.add(continueOrder);
    middlePanel.add(dinerName);
    entreeOrder = new JLabel("Please choose an entree");
    orderComboBox = new JComboBox(dinnerEntree);
    orderComboBox.setMaximumRowCount(4);
    //orderComboBox.addItemListener(
    // new ItemListener(){
    // public void itemsStateChanged(ItemEvent event)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // add entree order to Person
    // continue ** enable the two sides order
    mashed = new JCheckBox("Mashed Potatoes");
    middlePanel.add(mashed);
    cole = new JCheckBox("Cole Slaw");
    middlePanel.add(cole);
    baked = new JCheckBox("Baked Beans");
    middlePanel.add(baked);
    french = new JCheckBox("FrenchFries");
    middlePanel.add(french);
    // CheckBoxHandler handler = new CheckBoxHandler();
    // mashed.addItemListener(handler);
    // cole.addItemListener(handler);
    // baked.addItemListener(handler);
    // french.addItemListener(handler);
    middlePanel.add(entreeOrder);
    middlePanel.add(orderComboBox);
    container.add(northPanel);
    container.add(middlePanel);
    middlePanel.setEnabled(true);
    setSize(500, 500);
    show();
    // private class to handle event of choosing Check BOx Item
    // private class CheckBoxHandler implements ItemListener{
    // private int count = 0;
    // public void itemStateChanged(ItemEvent event){
    // if (event.getsource() == mashed)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    // add mashed choice to person's order
    // if (event.getsource() == cole)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add cole slaw to person's order
    // if (event.getsource() == baked)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add baked beans to person's order
    // if (event.getsource() == french)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add french to person's order
    public static void main(String args[])
    Menu application = new Menu();
    application.addWindowListener(
    new WindowAdapter(){
    public void windowClosing(WindowEvent windowEvent)
    System.exit(0);
    }

    This looks better, i myself don't like the flow layout
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Menu1 extends JFrame
         private JTextField partyNumField, dinerName;
         private JComboBox orderComboBox;
         private int partyNum;
         private JButton getParty, continueOrder;
         private JLabel party, companyLogo, dinerLabel, entreeOrder;
         private String dinnerEntree[] = {"Filet Mignon", "Chicken Cheese Steak", "Tacos", "Ribs"};
         private JCheckBox mashed, cole, baked, french;
    public Menu1()
         super("O'Brien Caterer - Where we make good Eats!");
         addWindowListener(new WindowAdapter()
             public void windowClosing(WindowEvent ev)
                   dispose();
                   System.exit(0);
         Container container = getContentPane();
         JPanel northPanel = new JPanel();
         northPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 120,15));
         companyLogo   = new JLabel("Welcome to O'Brien's Caterer's");
         northPanel.add(companyLogo);
         party         = new JLabel("Enter the Total Number in Party Please");
         partyNumField = new JTextField(5);
         northPanel.add(party);
         northPanel.add(partyNumField);
         getParty    = new JButton("GO - Continue with Order");
         northPanel.add(getParty);
         northPanel.setPreferredSize(new Dimension(700,150));
         getParty.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent actionEvent)
                   partyNum = Integer.parseInt(partyNumField.getText());
                   String ans=JOptionPane.showInputDialog(null, "Total Number is party is: "
                   + partyNum + " is this correct?\n\n" + "Enter 1 to continue\n"
                   + "Enter 2 to cancel\n");
                   if (ans.equals("1"))
                        System.out.println(ans+"=continue"); // handle continue
                   else { // assume to be 2 for cancel
                   System.out.println(ans+"=cancel"); // handle cancel
         }}); // end Listener
         JPanel middlePanel = new JPanel();
         middlePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
         dinerLabel         = new JLabel("Please enter Diner's name");
         dinerName          = new JTextField(30);
         continueOrder      = new JButton("continue");
         middlePanel.add(dinerLabel);
         middlePanel.add(dinerName);
         middlePanel.add(continueOrder);
         entreeOrder   = new JLabel("Please choose an entree");
         orderComboBox = new JComboBox(dinnerEntree);
         orderComboBox.setMaximumRowCount(4);
    //orderComboBox.addItemListener(
    // new ItemListener(){
    // public void itemsStateChanged(ItemEvent event)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // add entree order to Person
    // continue ** enable the two sides order
         mashed = new JCheckBox("Mashed Potatoes");
         middlePanel.add(mashed);
         cole   = new JCheckBox("Cole Slaw");
         middlePanel.add(cole);
         baked  = new JCheckBox("Baked Beans");
         middlePanel.add(baked);
         french = new JCheckBox("FrenchFries");
         middlePanel.add(french);
    // CheckBoxHandler handler = new CheckBoxHandler();
    // mashed.addItemListener(handler);
    // cole.addItemListener(handler);
    // baked.addItemListener(handler);
    // french.addItemListener(handler);
         middlePanel.add(entreeOrder);
         middlePanel.add(orderComboBox);
    //container.add(northPanel);
    //container.add(middlePanel);
         container.add(northPanel, java.awt.BorderLayout.NORTH);
         container.add(middlePanel, java.awt.BorderLayout.CENTER);
         middlePanel.setEnabled(true);
         setSize(600, 500);
         show();
    // private class to handle event of choosing Check BOx Item
    // private class CheckBoxHandler implements ItemListener{
    // private int count = 0;
    // public void itemStateChanged(ItemEvent event){
    // if (event.getsource() == mashed)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    // add mashed choice to person's order
    // if (event.getsource() == cole)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add cole slaw to person's order
    // if (event.getsource() == baked)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add baked beans to person's order
    // if (event.getsource() == french)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add french to person's order
    public static void main(String args[])
         new Menu1();
    no edit
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Menu1 extends JFrame
         private JTextField partyNumField, dinerName;
         private JComboBox orderComboBox;
         private int partyNum;
         private JButton getParty, continueOrder;
         private JLabel party, companyLogo, dinerLabel, entreeOrder;
         private String dinnerEntree[] = {"Filet Mignon", "Chicken Cheese Steak", "Tacos", "Ribs"};
         private JCheckBox mashed, cole, baked, french;
    public Menu1()
         super("O'Brien Caterer - Where we make good Eats!");
         addWindowListener(new WindowAdapter()
         public void windowClosing(WindowEvent ev)
                   dispose();
                   System.exit(0);
         Container container = getContentPane();
         JPanel northPanel = new JPanel();
         northPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 120,15));
         companyLogo = new JLabel("Welcome to O'Brien's Caterer's");
         northPanel.add(companyLogo);
         party = new JLabel("Enter the Total Number in Party Please");
         partyNumField = new JTextField(5);
         northPanel.add(party);
         northPanel.add(partyNumField);
         getParty = new JButton("GO - Continue with Order");
         northPanel.add(getParty);
         northPanel.setPreferredSize(new Dimension(700,150));
         getParty.addActionListener(new ActionListener()
              public void actionPerformed(ActionEvent actionEvent)
                   partyNum = Integer.parseInt(partyNumField.getText());
                   String ans=JOptionPane.showInputDialog(null, "Total Number is party is: "
                   + partyNum + " is this correct?\n\n" + "Enter 1 to continue\n"
                   + "Enter 2 to cancel\n");
                   if (ans.equals("1"))
                        System.out.println(ans+"=continue"); // handle continue
                   else { // assume to be 2 for cancel
                   System.out.println(ans+"=cancel"); // handle cancel
         }}); // end Listener
         JPanel middlePanel = new JPanel();
         middlePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
         dinerLabel = new JLabel("Please enter Diner's name");
         dinerName = new JTextField(30);
         continueOrder = new JButton("continue");
         middlePanel.add(dinerLabel);
         middlePanel.add(dinerName);
         middlePanel.add(continueOrder);
         entreeOrder = new JLabel("Please choose an entree");
         orderComboBox = new JComboBox(dinnerEntree);
         orderComboBox.setMaximumRowCount(4);
    //orderComboBox.addItemListener(
    // new ItemListener(){
    // public void itemsStateChanged(ItemEvent event)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // add entree order to Person
    // continue ** enable the two sides order
         mashed = new JCheckBox("Mashed Potatoes");
         middlePanel.add(mashed);
         cole = new JCheckBox("Cole Slaw");
         middlePanel.add(cole);
         baked = new JCheckBox("Baked Beans");
         middlePanel.add(baked);
         french = new JCheckBox("FrenchFries");
         middlePanel.add(french);
    // CheckBoxHandler handler = new CheckBoxHandler();
    // mashed.addItemListener(handler);
    // cole.addItemListener(handler);
    // baked.addItemListener(handler);
    // french.addItemListener(handler);
         middlePanel.add(entreeOrder);
         middlePanel.add(orderComboBox);
    //container.add(northPanel);
    //container.add(middlePanel);
         container.add(northPanel, java.awt.BorderLayout.NORTH);
         container.add(middlePanel, java.awt.BorderLayout.CENTER);
         middlePanel.setEnabled(true);
         setSize(600, 500);
         show();
    // private class to handle event of choosing Check BOx Item
    // private class CheckBoxHandler implements ItemListener{
    // private int count = 0;
    // public void itemStateChanged(ItemEvent event){
    // if (event.getsource() == mashed)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    // add mashed choice to person's order
    // if (event.getsource() == cole)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add cole slaw to person's order
    // if (event.getsource() == baked)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add baked beans to person's order
    // if (event.getsource() == french)
    // if (event.getStateChange() == ItemEvent.SELECTED)
    // count++;
    //add french to person's order
    public static void main(String args[])
         new Menu1();
    }

  • Help Please, Problem in displaying same  JTables on two JPanels

    Problem in displaying same JTables on two JPanels. In an application, I have a dynamic display of JTables on one JPanel. After a print preview button action, I have to bring same JTables on another JPanels, while taking this the previous JPanels content(JTables) become invisible? Why this happened? may be single component. Is the Cloning process nedded?

    Hi,
    you can add a component to one container only. If you try to add it to a second container, it will be removed from the first.
    You could try holding one member of the TableModel and set that one to both tables.
    Greets,
    Christian

  • Can't get around this error after adding second dataset...A scope is required for all aggregates used outside of a data region unless the report contains exactly one dataset

    I added a dataset to an existing report and broke an aggregation.  In the old (i.e. single dataset) report, this expression below worked fine.  I wanted to get a distinct count of the vst_ext_id field when my educated field was like "VTE1*"
    = CountDistinct(IIF(Fields!educated.Value like "VTE1*", Fields!vst_ext_id.Value, Nothing))
    After adding a new dataset, this no longer works and I get the error " A scope is required for all aggregates used outside of a data region unless the report contains exactly one dataset".  Having done some research online, I found that I
    needed to specify my dataset explicitly and I thought this new expression might work, but still no success...
    = CountDistinct(IIF(Fields!educated.Value,"DataSet1" like "VTE12*", Fields!vst_ext_id.Value,"DataSet1", Nothing))
    Am I missing something?  Based on online responses, this explicit dataset naming convention seems to help most people, but it isn't working for me. 
    Thanks in advance!
    Brian

    I found the answer.  Apparently, my expression syntax was off.  This expression does the trick...
    = CountDistinct(IIF(Fields!educated.Value like "VTE12*", Fields!vst_ext_id.Value,Nothing),"DataSet1")
    I just happened upon this particular syntax searching online.  I was trying to specify the dataset name after each .value, but I never got that to work.   This is the only time I have found this particular syntax online. 

  • JButton not visible after use of Jpanel removeAll ..

    Hi!
    I'm having a calculator class that inherits JFrame. I need to add more buttons after setting an option from the (view) menu bar .. (from normal to scientific calculator). I needed to use the JPanel removeAll method and then add the normal buttons plus extra buttons. But the problem is, that the Buttons are only visible when I touch them with the mouse.
    Does anybody know why? Thanks for your help!
    See code below (still in construction phase):
    Name: Hemanth. B
    Original code from Website: java-swing-tutorial.html
    Topic : A basic Java Swing Calculator
    Conventions Used in Source code
         1. All JLabel components start with jlb*
         2. All JPanel components start with jpl*
         3. All JMenu components start with jmenu*
         4. All JMenuItem components start with jmenuItem*
         5. All JDialog components start with jdlg*
         6. All JButton components start with jbn*
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Calculator extends JFrame
    implements ActionListener {
    // Constants
    final int NORMAL = 0;
    final int SCIENTIFIC = 8;
    final int MAX_INPUT_LENGTH = 20;
    final int INPUT_MODE = 0;
    final int RESULT_MODE = 1;
    final int ERROR_MODE = 2;
    // Variables
    int displayMode;
    int calcType = SCIENTIFIC;
    boolean clearOnNextDigit, percent;
    double lastNumber;
    String lastOperator, title;
    private JMenu jmenuFile, jmenuView, jmenuHelp;
    private JMenuItem jmenuitemExit, jmenuitemAbout;
    private JRadioButtonMenuItem jmenuItemNormal = new JRadioButtonMenuItem("Normal");
    private JRadioButtonMenuItem jmenuItemScientific = new JRadioButtonMenuItem("Scientific");
    private     ButtonGroup viewMenuButtonGroup = new ButtonGroup();
    private JLabel jlbOutput;
    private JButton jbnButtons[];
    private JPanel jplButtons, jplMaster, jplBackSpace, jplControl;
    * Font(String name, int style, int size)
    Creates a new Font from the specified name, style and point size.
    Font f12 = new Font("Verdana", 0, 12);
    Font f121 = new Font("Verdana", 1, 12);
    // Constructor
    public Calculator(String title) {
    /* Set Up the JMenuBar.
    * Have Provided All JMenu's with Mnemonics
    * Have Provided some JMenuItem components with Keyboard Accelerators
         //super(title);
         this.title = title;
         //displayCalculator(title);
    }     //End of Contructor Calculator
    private void displayCalculator (String title) {
         //add WindowListener for closing frame and ending program
         addWindowListener (
         new WindowAdapter() {     
         public void windowClosed(WindowEvent e) {
         System.exit(0);
         //setResizable(false);
    //Set frame layout manager
         setBackground(Color.gray);
         validate();
         createMenuBar();
         createMasterPanel();      
         createDisplayPanel();
         clearAll();
         this.getContentPane().validate();
         requestFocus();
         pack();
         //getContentPane().
         setVisible(true);
    private void createMenuBar() {
    jmenuFile = new JMenu("File");
    jmenuFile.setFont(f121);
    jmenuFile.setMnemonic(KeyEvent.VK_F);
    jmenuitemExit = new JMenuItem("Exit");
    jmenuitemExit.setFont(f12);
    jmenuitemExit.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_X,
                                            ActionEvent.CTRL_MASK));
    jmenuFile.add(jmenuitemExit);
    jmenuView = new JMenu("View");
    jmenuFile.setFont(f121);
    jmenuFile.setMnemonic(KeyEvent.VK_W);
    jmenuItemNormal.setMnemonic(KeyEvent.VK_N);
    viewMenuButtonGroup.add(jmenuItemNormal);
    jmenuView.add(jmenuItemNormal);
    jmenuItemScientific.setMnemonic(KeyEvent.VK_S);
    viewMenuButtonGroup.add(jmenuItemScientific);
    jmenuView.add(jmenuItemScientific);
    if (jmenuItemNormal.isSelected() == false &&
    jmenuItemScientific.isSelected() == false)
    jmenuItemScientific.setSelected(true);
         jmenuHelp = new JMenu("Help");
         jmenuHelp.setFont(f121);
         jmenuHelp.setMnemonic(KeyEvent.VK_H);
         jmenuitemAbout = new JMenuItem("About Calculator");
         jmenuitemAbout.setFont(f12);
         jmenuHelp.add(jmenuitemAbout);
         JMenuBar menubar = new JMenuBar();
         menubar.add(jmenuFile);
         menubar.add(jmenuView);
         menubar.add(jmenuHelp);
         setJMenuBar(menubar);
         jmenuItemNormal.addActionListener(this);
         jmenuItemScientific.addActionListener(this);
         jmenuitemAbout.addActionListener(this);
         jmenuitemExit.addActionListener(this);
    private void createDisplayPanel() {
         if (jlbOutput != null) {
         jlbOutput.removeAll();     
         jlbOutput = new JLabel("0",JLabel.RIGHT);
         jlbOutput.setBackground(Color.WHITE);
         jlbOutput.setOpaque(true);
         // Add components to frame
         getContentPane().add(jlbOutput, BorderLayout.NORTH);
         jlbOutput.setVisible(true);
    private void createMasterPanel() {
         if (jplMaster != null) {
         jplMaster.removeAll();     
         jplMaster = new JPanel(new BorderLayout());
         createCalcButtons();      
         jplMaster.add(jplBackSpace, BorderLayout.WEST);
         jplMaster.add(jplControl, BorderLayout.EAST);
         jplMaster.add(jplButtons, BorderLayout.SOUTH);
         ((JPanel)getContentPane()).revalidate();
         // Add components to frame
         getContentPane().add(jplMaster, BorderLayout.SOUTH);
         jplMaster.setVisible(true);
    private void createCalcButtons() {
         int rows = 4;
         int cols = 5 + calcType/rows;
         jbnButtons = new JButton[31];
         // Create numeric Jbuttons
         for (int i=0; i<=9; i++) {
         // set each Jbutton label to the value of index
         jbnButtons[i] = new JButton(String.valueOf(i));
         // Create operator Jbuttons
         jbnButtons[10] = new JButton("+/-");
         jbnButtons[11] = new JButton(".");
         jbnButtons[12] = new JButton("=");
         jbnButtons[13] = new JButton("/");
         jbnButtons[14] = new JButton("*");
         jbnButtons[15] = new JButton("-");
         jbnButtons[16] = new JButton("+");
         jbnButtons[17] = new JButton("sqrt");
         jbnButtons[18] = new JButton("1/x");
         jbnButtons[19] = new JButton("%");
         jplBackSpace = new JPanel();
         jplBackSpace.setLayout(new GridLayout(1, 1, 2, 2));
         jbnButtons[20] = new JButton("Backspace");
         jplBackSpace.add(jbnButtons[20]);
         jplControl = new JPanel();
         jplControl.setLayout(new GridLayout(1, 2, 2 ,2));
         jbnButtons[21] = new JButton(" CE ");
         jbnButtons[22] = new JButton("C");
         jplControl.add(jbnButtons[21]);
         jplControl.add(jbnButtons[22]);
         //if (calcType == SCIENTIFIC) {     
         jbnButtons[23] = new JButton("s");
         jbnButtons[24] = new JButton("t");
         jbnButtons[25] = new JButton("u");
         jbnButtons[26] = new JButton("v");
         jbnButtons[27] = new JButton("w");
         jbnButtons[28] = new JButton("x");
         jbnButtons[29] = new JButton("y");
         jbnButtons[30] = new JButton("z");
    // Setting all Numbered JButton's to Blue. The rest to Red
         for (int i=0; i<jbnButtons.length; i++)     {
         //activate ActionListener
         System.out.println("add action listener: " + i);
         jbnButtons.addActionListener(this);
         //set button text font/colour
         jbnButtons[i].setFont(f12);
         jbnButtons[i].invalidate();
         if (i<10)
              jbnButtons[i].setForeground(Color.blue);               
         else
              jbnButtons[i].setForeground(Color.red);
         // container for Jbuttons
         jplButtons = new JPanel(new GridLayout(rows, cols, 2, 2));
    System.out.println("Cols: " + cols);      
         //Add buttons to keypad panel starting at top left
         // First row
         // extra left buttons for scientific
         if (calcType == SCIENTIFIC) {
         System.out.println("Adding Scientific buttons");
         setSize(400, 217);
         setLocation(200, 250);
         jplButtons.add(jbnButtons[23]);
         jplButtons.add(jbnButtons[27]);
         } else {
         setSize(241, 217);
         setLocation(200, 250);
         for(int i=7; i<=9; i++)          {
         jplButtons.add(jbnButtons[i]);
         // add button / and sqrt
         jplButtons.add(jbnButtons[13]);
         jplButtons.add(jbnButtons[17]);
         // Second row
         // extra left buttons for scientific
         if (calcType == SCIENTIFIC) {
         System.out.println("Adding Scientific buttons");
         jplButtons.add(jbnButtons[24]);
         jplButtons.add(jbnButtons[28]);
         for(int i=4; i<=6; i++)     {
         jplButtons.add(jbnButtons[i]);
         // add button * and x^2
         jplButtons.add(jbnButtons[14]);
         jplButtons.add(jbnButtons[18]);
         // Third row
         // extra left buttons for scientific
         if (calcType == SCIENTIFIC) {
         System.out.println("Adding Scientific buttons");
         jplButtons.add(jbnButtons[25]);
         jplButtons.add(jbnButtons[29]);
         for( int i=1; i<=3; i++) {
         jplButtons.add(jbnButtons[i]);
         //adds button - and %
         jplButtons.add(jbnButtons[15]);
         jplButtons.add(jbnButtons[19]);
         //Fourth Row
         // extra left buttons for scientific
         if (calcType == SCIENTIFIC) {
         System.out.println("Adding Scientific buttons");
         jplButtons.add(jbnButtons[26]);
         jplButtons.add(jbnButtons[30]);
         // add 0, +/-, ., +, and =
         jplButtons.add(jbnButtons[0]);
         jplButtons.add(jbnButtons[10]);
         jplButtons.add(jbnButtons[11]);
         jplButtons.add(jbnButtons[16]);
         jplButtons.add(jbnButtons[12]);
         jplButtons.revalidate();
    // Perform action
    public void actionPerformed(ActionEvent e){
         double result = 0;
         if(e.getSource() == jmenuitemAbout) {
         //JDialog dlgAbout = new CustomABOUTDialog(this,
         //                              "About Java Swing Calculator", true);
         //dlgAbout.setVisible(true);
         } else if(e.getSource() == jmenuitemExit) {
         System.exit(0);
    if (e.getSource() == jmenuItemNormal) {
    calcType = NORMAL;
    displayCalculator(title);
    if (e.getSource() == jmenuItemScientific) {
    calcType = SCIENTIFIC;
    displayCalculator(title);
    System.out.println("Calculator is set to "
    + (calcType == NORMAL?"Normal":"Scientific") + " :" + jbnButtons.length);      
         // Search for the button pressed until end of array or key found
         for (int i=0; i<jbnButtons.length; i++)     {
         if(e.getSource() == jbnButtons[i]) {
              System.out.println(i);
              switch(i) {
              case 0:
                   addDigitToDisplay(i);
                   break;
              case 1:
                   System.out.println("1");
                   addDigitToDisplay(i);
                   break;
              case 2:
                   addDigitToDisplay(i);
                   break;
              case 3:
                   addDigitToDisplay(i);
                   break;
              case 4:
                   addDigitToDisplay(i);
                   break;
              case 5:
                   addDigitToDisplay(i);
                   break;
              case 6:
                   addDigitToDisplay(i);
                   break;
              case 7:
                   addDigitToDisplay(i);
                   break;
              case 8:
                   addDigitToDisplay(i);
                   break;
              case 9:
                   addDigitToDisplay(i);
                   break;
              case 10:     // +/-
                   processSignChange();
                   break;
              case 11:     // decimal point
                   addDecimalPoint();
                   break;
              case 12:     // =
                   processEquals();
                   break;
              case 13:     // divide
                   processOperator("/");
                   break;
              case 14:     // *
                   processOperator("*");
                   break;
              case 15:     // -
                   processOperator("-");
                   break;
              case 16:     // +
                   processOperator("+");
                   break;
              case 17:     // sqrt
                   if (displayMode != ERROR_MODE) {
                   try {
                        if (getDisplayString().indexOf("-") == 0)
                        displayError("Invalid input for function!");
                        result = Math.sqrt(getNumberInDisplay());
                        displayResult(result);
                   catch(Exception ex) {
                        displayError("Invalid input for function!");
                        displayMode = ERROR_MODE;
                   break;
              case 18:     // 1/x
                   if (displayMode != ERROR_MODE){
                   try {
                        if (getNumberInDisplay() == 0)
                        displayError("Cannot divide by zero!");
                        result = 1 / getNumberInDisplay();
                        displayResult(result);
                   catch(Exception ex) {
                        displayError("Cannot divide by zero!");
                        displayMode = ERROR_MODE;
                   break;
              case 19:     // %
                   if (displayMode != ERROR_MODE){
                   try {
                        result = getNumberInDisplay() / 100;
                        displayResult(result);
                   catch(Exception ex) {
                        displayError("Invalid input for function!");
                        displayMode = ERROR_MODE;
                   break;
              case 20:     // backspace
                   if (displayMode != ERROR_MODE) {
                   setDisplayString(getDisplayString().substring(0,
                   getDisplayString().length() - 1));
                   if (getDisplayString().length() < 1)
                        setDisplayString("0");
                   break;
              case 21:     // CE
                   clearExisting();
                   break;
              case 22:     // C
                   clearAll();
                   break;
    void setDisplayString(String s) {
         jlbOutput.setText(s);
    String getDisplayString () {
         return jlbOutput.getText();
    void addDigitToDisplay(int digit) {
         if (clearOnNextDigit)
         setDisplayString("");
         String inputString = getDisplayString();
         if (inputString.indexOf("0") == 0) {
         inputString = inputString.substring(1);
         if ((!inputString.equals("0") || digit > 0)
                             && inputString.length() < MAX_INPUT_LENGTH) {
         setDisplayString(inputString + digit);
         displayMode = INPUT_MODE;
         clearOnNextDigit = false;
    void addDecimalPoint() {
         displayMode = INPUT_MODE;
         if (clearOnNextDigit)
         setDisplayString("");
         String inputString = getDisplayString();
         // If the input string already contains a decimal point, don't
         // do anything to it.
         if (inputString.indexOf(".") < 0)
         setDisplayString(new String(inputString + "."));
    void processSignChange() {
         if (displayMode == INPUT_MODE) {
         String input = getDisplayString();
         if (input.length() > 0 && !input.equals("0"))     {
              if (input.indexOf("-") == 0)
              setDisplayString(input.substring(1));
              else
              setDisplayString("-" + input);
         } else if (displayMode == RESULT_MODE) {
         double numberInDisplay = getNumberInDisplay();
         if (numberInDisplay != 0)
         displayResult(-numberInDisplay);
    void clearAll() {
         setDisplayString("0");
         lastOperator = "0";
         lastNumber = 0;
         displayMode = INPUT_MODE;
         clearOnNextDigit = true;
    void clearExisting() {
         setDisplayString("0");
         clearOnNextDigit = true;
         displayMode = INPUT_MODE;
    double getNumberInDisplay()     {
         String input = jlbOutput.getText();
         return Double.parseDouble(input);
    void processOperator(String op) {
         if (displayMode != ERROR_MODE) {
         double numberInDisplay = getNumberInDisplay();
         if (!lastOperator.equals("0")) {
              try {
              double result = processLastOperator();
              displayResult(result);
              lastNumber = result;
              catch (DivideByZeroException e)     {
              displayError("Cannot divide by zero!");
         } else {
         lastNumber = numberInDisplay;
         clearOnNextDigit = true;
         lastOperator = op;
    void processEquals() {
         double result = 0;
         if (displayMode != ERROR_MODE){
         try {
              result = processLastOperator();
              displayResult(result);
         catch (DivideByZeroException e) {
              displayError("Cannot divide by zero!");
         lastOperator = "0";
    double processLastOperator() throws DivideByZeroException {
         double result = 0;
         double numberInDisplay = getNumberInDisplay();
         if (lastOperator.equals("/")) {
         if (numberInDisplay == 0)
              throw (new DivideByZeroException());
         result = lastNumber / numberInDisplay;
         if (lastOperator.equals("*"))
         result = lastNumber * numberInDisplay;
         if (lastOperator.equals("-"))
         result = lastNumber - numberInDisplay;
         if (lastOperator.equals("+"))
         result = lastNumber + numberInDisplay;
         return result;
    void displayResult(double result){
         setDisplayString(Double.toString(result));
         lastNumber = result;
         displayMode = RESULT_MODE;
         clearOnNextDigit = true;
    void displayError(String errorMessage){
         setDisplayString(errorMessage);
         lastNumber = 0;
         displayMode = ERROR_MODE;
         clearOnNextDigit = true;
    public static void main(String args[]) {
         Calculator calci = new Calculator("My Calculator");
         calci.displayCalculator("My Calculator");
    System.out.println("Exitting...");
    }     //End of Swing Calculator Class.
    class DivideByZeroException extends Exception{
    public DivideByZeroException() {
         super();
    public DivideByZeroException(String s) {
         super(s);
    class CustomABOUTDialog extends JDialog implements ActionListener {
    JButton jbnOk;
    CustomABOUTDialog(JFrame parent, String title, boolean modal){
         super(parent, title, modal);
         setBackground(Color.black);
         JPanel p1 = new JPanel(new FlowLayout(FlowLayout.CENTER));
         StringBuffer text = new StringBuffer();
         text.append("Calculator Information\n\n");
         text.append("Developer:     Hemanth\n");
         text.append("Version:     1.0");
         JTextArea jtAreaAbout = new JTextArea(5, 21);
         jtAreaAbout.setText(text.toString());
         jtAreaAbout.setFont(new Font("Times New Roman", 1, 13));
         jtAreaAbout.setEditable(false);
         p1.add(jtAreaAbout);
         p1.setBackground(Color.red);
         getContentPane().add(p1, BorderLayout.CENTER);
         JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER));
         jbnOk = new JButton(" OK ");
         jbnOk.addActionListener(this);
         p2.add(jbnOk);
         getContentPane().add(p2, BorderLayout.SOUTH);
         setLocation(408, 270);
         setResizable(false);
         addWindowListener(new WindowAdapter() {
              public void windowClosing(WindowEvent e) {
                   Window aboutDialog = e.getWindow();
                   aboutDialog.dispose();
         pack();
    public void actionPerformed(ActionEvent e) {
         if(e.getSource() == jbnOk) {
         this.dispose();
    Message was edited by:
    dungorg

    Swing related questions should be posted in the Swing forum.
    After adding or removing components from a visible panel you need to use panel.revalidate() and sometimes panel.repaint();
    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 (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.

  • HT4477 One complete family file missing after installing iPhoto 11 ??

    One complete family file of photo's is missing after installing iPhoto 11. Installation went smoothly, and all other files complete. Have checked thru entire photo lists, including photo list at the top. Found two photo's in that should have been in that photo list that were downloaded 2 months prior to installing iPhoto 11. I keep files of each family branch on left side iPhoto window. Only the one file is missing. ????

    I meant folder. Have 6 kids, and to keep track of each family quickly, I set up folders on left side of iPhoto. All others are there.

  • Two JPanels inside another panel should be equal in width

    Hi everybody,
    I have two JPanels which both have a titledborder. I want them to have the same with, but I can not get it done. You can see how it looks here: http://jborsje.nl/jpanels.png. As you can see the JPanels are not equal in width. Here is the code I used (please note that p_hopsControl = true).
         * Initialize the sidebar of the graph panel.
         * @param p_hopsControl Indicates whether or not a widget for controlling the
         * hops in the graph should be added to the panel.
        private JPanel getSideBar(boolean p_hopsControl)
            // Create the panel.
            JPanel panel = new JPanel(new GridBagLayout());
            GridBagConstraints constraints = new GridBagConstraints();
            constraints.anchor = GridBagConstraints.FIRST_LINE_START;
            // Add the label and the spinner to the panel.
            constraints.gridx = 0;
            if (!p_hopsControl) constraints.weighty = 1;
            constraints.gridy = 0;
            panel.add(getLegend(), constraints);
            if (p_hopsControl)
                constraints.gridy = 1;
                constraints.weighty = 1;
                constraints.weightx = 1;
                panel.add(getHopsWidgets(), constraints);
            // Set the background of the panel.
            panel.setBackground(m_display.getBackground());
            return panel;
        private JEditorPane getLegend()
            String content = "<html><body>" +
                    "<table>" +
                    "<tr><td bgcolor=\"" + Integer.toHexString(Constants.NODE_COLOR_CLASS & 0x00ffffff) + "\" width=\"20px\"></td><td>OWL class</td></tr>" +
                    "<tr><td bgcolor=\"" + Integer.toHexString(Constants.NODE_COLOR_INDIVIDUAL & 0x00ffffff) + "\"></td><td>OWL individual</td></tr>" +
                    "<tr><td bgcolor=\"" + Integer.toHexString(Constants.NODE_COLOR_SELECTED & 0x00ffffff) + "\"></td><td>Node selected</td></tr>" +
                    "<tr><td bgcolor=\"" + Integer.toHexString(Constants.NODE_COLOR_HIGHLIGHTED & 0x00ffffff) + "\"></td><td>Node highlighted</td></tr>" +
                    "<tr><td bgcolor=\"" + Integer.toHexString(Constants.NODE_COLOR_SEARCH & 0x00ffffff) + "\"></td><td>Node in search result set</td></tr>" +
                    "<tr><td bgcolor=\"" + Integer.toHexString(Constants.NODE_DEFAULT_COLOR & 0x00ffffff) + "\"></td><td>Node in search result set</td></tr>" +
                    "</body></html>";
            JEditorPane legend = new JEditorPane("text/html", content);
            legend.setEditable(false);
            legend.setBorder(new TitledBorder("Legend"));
            JPanel panel = new JPanel();
            panel.setBorder(new TitledBorder("Legend"));
            panel.add(legend);
            return legend;
         * Create a panel containing a JSpinner which can be used to set the number
         * of hops, used in the graph distance filter.
         * @return A JPanel containing the hops widgets.
        private JPanel getHopsWidgets()
            // Get the GraphDistanceFilter.
            GraphDistanceFilter filter = m_display.getDistanceFilter();
            // Create the panel.
            JPanel panel = new JPanel(new GridBagLayout());
            GridBagConstraints constraints = new GridBagConstraints();
            constraints.anchor = GridBagConstraints.FIRST_LINE_START;
            // Create the label.
            JLabel label = new JLabel("Number of hops: ");
            // Create the spinner and its model.
            SpinnerNumberModel model = new SpinnerNumberModel(filter.getDistance(), 0, null, 1);
            m_spinner = new JSpinner();
            m_spinner.addChangeListener(this);
            m_spinner.setModel(model);
            // Add the label and the spinner to the panel.
            constraints.gridx = 0;
            constraints.gridy = 0;
            panel.add(label, constraints);
            constraints.gridx = 1;
            constraints.weighty = 1;
            panel.add(m_spinner, constraints);
            // Set the background of the panel.
            panel.setBackground(m_display.getBackground());
            // Add a titled border to the panel.
            panel.setBorder(new TitledBorder("Hops control"));
            return panel;
        }Does anybody know how this can be done?

    Thanks, that solved my issue for the width part. Now the content of the "hops control" panel is centered, althoug I explicitely said "constraints.anchor = GridBagConstraints.FIRST_LINE_START;".
    The update image can still be found here: http://www.jborsje.nl/jpanels.png.

  • I have added two new extension on CUCM, Directory not showing in attendant console even after resynch on CUCM and attendant cosn

    I have added two new extension on CUCM, Directory not showing in attendant console even after resynch on CUCM and attendant cosnole
    Any idea?

    Hello,
    Can you tell us what versions of CUCM and CUxAC you are using?  Just extensions alone in CUCM will not sync to the corporate directory within the attendant console application.  You will at least have to have user's associated with those extensions and depending on your rule set within the console that should then bring those extensions into the console directory.
    Thanks,
    Tony

  • After installing two updates, I cannon create .pdf documents as the window says "Missing PDF Maker Files."  I've uninstalled Acrobat and re-installed twice, same problem

    After installing two updates, I cannon create .pdf documents as the window says "Missing PDF Maker Files."  I've uninstalled Acrobat and re-installed twice, same problem.  How do I correct problem?

    Thank you.   I googled my problem and got good answers involving making changes to my Office settings - which worked. 
    Sent via the Samsung GALAXY S® 5, an AT&T 4G LTE smartphone

  • Missing inventory & COGS transaction after adding credit memo

    Dear All,
    There is an problem that the inventory and COGS transaction is missed out after adding credit memo.
    Not all the transaction is like that, but only a few. i am wondering what action can cause this result.
    Do anyone has any idea?
    The case is like, in the Sales - A/R -> Return -> Accounting Tab -> Journal Remark, it should have an "orange arrow" and can drill down to see the transactions, it should have both the cr. and dr., but for some Returns, it didn't has any, therefore it affect the GL amount.
    Please kindly help on this, million thanks

    Dear All,
    i don't really understand the meaning in the solution in the note # 1057515, hopefully someone can help on this:
    Q1. "these transactions will set the cost price independently of what was defined in the Item Master Data.The possibility to set the cost price in the Item Master Data was created to accommodate the   scenario above. The Item Cost field is only active when there is no onhand quantity."
    Q2. What's the function of the "Stock Revaluation" ?
    Million thanks

  • Count not updating when counting table rows (after adding one)

    following this code from this link:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/479cbc96-6ec2-4d9f-b2f8-a2b43a09111e/html-client-dynamically-count-records-in-a-collection-on-browse-screen?forum=lightswitch
    I have got my screen to count how many rows are present when the screen first loads. In my scenario I have a add button located on the bottom navigation bar. this opens up a dialog window where the user can add the relevant information. However when the
    user hits save, and is navigated back to the browse screen, the count still displays the previous value. If i was to refresh the page it updates but this is not what i am after, when i navigate back i want the value to add by one, am i missing something in
    this code?
                screen.ExpanderLines.addChangeListener("state", function() {
                        screen.countExp = screen.ExpanderLines.data.length;
    thanks for any help

    Try this:
    screen.ExpanderLines.addChangeListener("count", function () {
    screen.countExp = screen.ExpanderLines.count;
    Dave
    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

Maybe you are looking for

  • Favicons not displaying in tabs, but showing fine in the address bar and with bookmarks.

    We had a power outage this evening while I was on the computer, and now, all of a sudden, when I open a site in a tab, the tab itself fails to display the site's favicon when applicable, but the icons display without any issue in both the address bar

  • Designing for Retina Display without dealing with the retina.js addition

    Is it possible for me, as the designer, to create a website in muse and then have someone more tech saavy apply the retina.js stuff at the end? This work around/fix/addition is discussed here: http://retinajs.com/   and   http://www.muse-themes.com/b

  • Setting styles dynamically

    Can I set a style dynamically? In the component below, I want to change the button style (in the onChange event handler) according to the selected state of the button, but the style is ignored and replaced with a default version of a button. If not,

  • Use variables inside MovieClip names to call them in ASP 3.

    This line of code works fine for me: this.helpB1Btns.helpB1B3.alpha = 0.3; But I wonder how can I use variables instead of numbers ( 1 and 3 ) above?? I mean for example: var i:int = 1; var j:int = 3; this["helpB"+i+"Btns.helpB"+i+"B"+j+".alpha"] = 0

  • "We could not complete you iTunes store request.  An unknown error..."

    "We could not complete you iTunes store request. An unknown error ocurred (-50). There was an error in the iTunes store. Please try again later." I have a macbook that has two users, me and my daughter. Whenever my daughter tries to open the iTunes s