W1R3 – Add Specified Components to the Edit Panel.
added a counter to whenever a row is created as this will come in use for listeners.
This commit is contained in:
1 parent
108e3210bb
commit
d386b5ceec
1 file changed
+6
-2
@@ -16,8 +16,9 @@ import javax.swing.JFrame;
|
||||
public class MainViewer {
|
||||
private JFrame viewer;
|
||||
|
||||
private void CreateRow() // Function to create a row // holds all the data of a row in the grid layout below.
|
||||
private void CreateRow(int count) // Function to create a row // holds all the data of a row in the grid layout below.
|
||||
{
|
||||
count++;
|
||||
String name = "Name";
|
||||
|
||||
JRadioButton JR = new JRadioButton(name); // temporary use of name as label for JRadioButton - to allow for the use of text being manipulated // changed.
|
||||
@@ -27,6 +28,9 @@ public class MainViewer {
|
||||
viewer.add(JR);
|
||||
viewer.add(JB1);
|
||||
viewer.add(JB2);
|
||||
|
||||
System.out.println("Row number: "+ count + " Has been created!");
|
||||
|
||||
}
|
||||
|
||||
public MainViewer() // main viewer window
|
||||
@@ -44,7 +48,7 @@ public class MainViewer {
|
||||
|
||||
for (int i=0; i<a; i++)
|
||||
{
|
||||
CreateRow();
|
||||
CreateRow(i);
|
||||
}
|
||||
|
||||
viewer.setVisible(true);
|
||||
|
||||
Reference in new issue
Block a user