Hello, I am programming for my Robotics team, and I have to write code for a dashboard, including different camera feeds and setting up rows or columns for the different elements. I am quite new to Java, but I gotten through most of it except for the rows. I can't figure out how to add rows for each heading (element). Here is what I have so far, and any help would be greatly appreciated. Thanks for your time.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;
import java.awt.TextArea.*;
public class Dashboard1 extends JFrame {
public Dashboard1() {
super("Dashboard");
setLookAndFeel();
setSize(845,700);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//toolbar buttons
JTextArea row1 = new JTextArea("Speed/RPM");
row1.setFocusable(false);
JTextArea row2 = new JTextArea("Jag Temp");
row2.setFocusable(false);
JTextArea row3 = new JTextArea("U-Bar Status");
row3.setFocusable(false);
JTextArea row4 = new JTextArea("Autobalance");
row4.setFocusable(false);
JTextArea row5 = new JTextArea("Octanum Status");
row5.setFocusable(false);
JButton button6 = new JButton();
button6.setText("Contour Feed");
button6.setSize(350,300);
button6.setLocation(465, 35);
button6.setBackground(Color.black);
button6.setVisible(true);
JButton button7 = new JButton();
button7.setText("Reg Vid Feed");
button7.setSize(350,300);
button7.setLocation(465, 350);
button7.setVisible(true);
button7.setBackground(Color.black);
//build toolbar
JToolBar bar = new JToolBar();
JWindow window = new JWindow();
bar.add(row1);
bar.add(row2);
bar.add(row3);
bar.add(row4);
bar.add(row5);
add(button6);
add(button7);
//build text area
JTextArea edit = new JTextArea(8, 40);
JScrollPane scroll = new JScrollPane(edit);
//create Frame
BorderLayout border = new BorderLayout();
setLayout(border);
add("North", bar);
add("West", scroll);
setVisible(true);
setFocusable(false);
}
private void setLookAndFeel() {
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"
);
} catch (Exception exc) {
//ignore error
}
}
public static void main(String[] args) {
Dashboard1 frame = new Dashboard1();
}
}