Note that there are some explanatory texts on larger screens.

plurals
  1. POJPanel Not displaying Buttons
    primarykey
    data
    text
    <p>I am trying to get a JPanel to display a series of Buttons.On each of these buttons is one of the values associated to my Sudoku Board Values. I have created my board added a menu and now i am trying to display the selectable options below the menu but before the board..in the same Jframe. I was hoping i could put all my buttons onto the JPanel and put that panel onto the Frame. It will display the JPanel but none of the buttons. At one time i got the panels to display but none of them were sized and there were to many. The question i have to be more specific is the code i am using correct for displaying my series of buttons on my JPanel, that is placed on in a Frame containing my Sudoku Board, which is also a series of buttons.</p> <p>Is this final toolbar and buttons to much for this single JFrame, is that why it is not working? Anyways here is just the code for my toolbar which is my JPanel.</p> <pre><code>class ToolBar extends JPanel { // instance initializer (constructor equivalent) public ToolBar() { super(); this.setLayout(myLayout); myLayout.setAlignment(FlowLayout.TRAILING); Button[] panelButton = new Button[size]; //Rectangle rec = new Rectangle(330,45,BUTTON, BUTTON); //setBounds(rec); setPreferredSize(new Dimension(330, 45)); for(int i = 0; i &lt; size; i++) { Rectangle r = new Rectangle(12, 12, 22, 22); center = new ImageIcon(view.drawSymbol(i)); panelButton[i]= new Button(); panelButton[i].setIcon(center); panelButton[i].setOpaque(true); panelButton[i].setBorder(BorderFactory.createLineBorder(Color.black)); panelButton[i].setBounds(r); this.add(panelButton[i]); this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); this.setVisible(true); } } }; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload