Hi! I have a class extending JPanel(ScoreBoard) acting as a scoreboard for a game, ScoreBoard contains 5 Jpanels, each containing a JTable. ScoreBoard uses a CardLayout. Adding an instance of ScoreBoard to my JFrame(GameArea) doesn't work. It compiles, runs, showing all others components(using Flow- or BorederLayout). But ScoreBoard remains invisible!!!??? If I change ScoreBoard's LayoutManager to something other than CardLayout, it works!!?? What to do...
hi you put one empty panel in jFrame(game) and set cardlayout to that, then add Jpanel(scoreboard) to that panel.then it works fine .
Joined: Oct 29, 2001
Originally posted by kallam reddy: hi you put one empty panel in jFrame(game) and set cardlayout to that, then add Jpanel(scoreboard) to that panel.then it works fine .
Thanks for instant reply! Do u mean that my mistake is that I first build my ScoreBoard(JPanel), then add it to the JFrame? From your advise I take it I should add an additional JPanel, giving it a CardLayout, and THEN, add my ScoreBoard instance to that. Why is this "extra" panel necessary?