Skip to main content

Jpanel and GridLayout



This the code (used at the screen-cam) to create at Run-Time the buttons inside your jPanel, which has a gridLayout of 6 columns and 14 Rows (as required by your project)

for (int Row=0;Row < seats.length;Row++)
for (int Column=0; Column < seats[Row].length; Column++) {
JButton b = new JButton();
b.setEnabled(false);
b.setBackground(Color.BLUE);
seats[Row][Column]=b;
jPanel1.add(b);
}


Make sure you place the code above in the correct position in your source code... inside
jbInit() method

make also sure that you have declared:
private JButton seats [][] = new JButton [14][6];
on top of your code inside :
public class _______ extends JFrame {
where all object declarations are...





Comments

Popular posts from this blog

How to create JRadioButtons, JComboBoxes and JtextAreas

Today I feel much better... These past few days I have been exploring the distance teaching/learning possibilities... Virtual Class did not work, through our computer lab firewall (unfortunately) but today I created two screen recording with sound to try and show you how you can use other swing components like: Radio Button, Printable text Areas and comboboxes. Try to watch the 2 parts of my video (its less than 15 mins) Part 1 Part 2 If you have any questions please comment...
How to Fix Slider Module Slide General Settings not Displayed I installed Divi (3.0.40)  template on my Wordpress  (4.9.5)  site  yesterday to test it... and I immediately run into a problem... in various cases, one of them the slider - slide settings where not visible . I figured out that the  wp-color-picker-alpha.min.js  Javascript, which was adding a height of 100% to a span inside the wp-picker-container class, was causing the problem. To solve the problem go to folder: \wp-content\themes\Divi\includes\builder\scripts\ext\ and edit wp-color-picker-alpha.min.js Find this line: css({width:"100%",height:"100%",position:"absolute",top:0,left:0,"border-top-left-radius":"3px","border-bottom-left-radius":"3px",background:r.color.toString()})) and change the height to "0px" css({width:"100%",height:"0px",position:"absolute",top:0,left:0,"border-top-left-rad...

GUI Components

This presentation describes JAVA swing GUI components and Layout Managers Powerpoint presentation in movie mode....