How to Skip a Position in GridLayout in Java
Java is a versatile computer programming language which can be used to develop applications for computer, mobile devices or even appliances. When building a graphical interface with Java, it is sometimes necessary to use the GridLayout function. This function creates a table containing a certain number of cells, depending on the selected number of rows and columns. You can skip a cell with GridLayout in Java by inserting a code snippet into the source code of your program.
Instructions
-
-
1
Open the source code of your Java application in a dedicated development environment or in Notepad, the Windows text editor.
-
2
Insert the following code snippet at the place where you want to skip a cell:
p.add(new JLabel(""));This instruction will assign a blank label to the cell, which is mandatory since GridLayout cannot handle unlabeled blank cells.
-
-
3
Save your file, compile it and run it.
-
1