W1R3 – Add Specified Components to the Edit Panel.

Added a for loop to initialise the creation of the rows.
In my next iteration i aim to create a max size for the buttons and a max spacing for the buttons.
created a method specifically to create and populate a row.
This commit is contained in:
K2320390 committed 2025-02-02 19:16:28 +00:00
1 parent 0dd754d933
commit 108e3210bb
1 file changed
+15 -13
@@ -16,7 +16,20 @@ import javax.swing.JFrame;
public class MainViewer { public class MainViewer {
private JFrame viewer; private JFrame viewer;
public MainViewer() private void CreateRow() // Function to create a row // holds all the data of a row in the grid layout below.
{
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.
JButton JB1 = new JButton("Edit");
JButton JB2 = new JButton("Delete");
viewer.add(JR);
viewer.add(JB1);
viewer.add(JB2);
}
public MainViewer() // main viewer window
{ {
int a = 3; // this represents a value that is to declare how many rows are to be made int a = 3; // this represents a value that is to declare how many rows are to be made
@@ -39,16 +52,5 @@ public class MainViewer {
} }
private void CreateRow() // Function To create rows of radio button , button x2
{
String name = "Name";
JRadioButton JR = new JRadioButton(name);
JButton JB1 = new JButton("Edit");
JButton JB2 = new JButton("Delete");
viewer.add(JR);
viewer.add(JB1);
viewer.add(JB2);
}
} }