I am using two classes, Inventory.java and MainScreen.java. Inventory.java has a Java array here:
package InventoryManagementSystem;
import java.util.ArrayList;
import java.util.Arrays;
import java.lang.String;
import java.io.*;
import java.util.*;
import InventoryManagementSystem.MainScreen;
public class Inventory {
String[] products = {"Lawnmower", "Refrigerator", "Microwave", "Dishwasher",
"Radio"};
String[] allParts = {"Blades", "Droors", "Chip", "Rack", "Antenna"};
}
MainScreen.java is here:
package InventoryManagementSystem;
import javax.swing.table.DefaultTableModel;
import java.lang.String;
import InventoryManagementSystem.Inventory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.*;
import java.util.*;
import java.awt.*;
public class MainScreen extends javax.swing.JFrame {
public MainScreen() {
initComponents();
}
@SuppressWarnings("unchecked")
private void MainPartsSearchBtnActionPerformed(java.awt.event.ActionEvent
evt) {
String searchText = mainSearchBar.getText();
System.out.println(searchText);
System.out.println(Arrays.toString(products));
}
}
I want to click on the search button in the Java swing JFrame GUI and have it print the "products" array to the console. However, it gives me an error that says "cannot find symbol" even though I have Inventory.java imported at the top. Any suggestions?