I know it has been posted before, but I was not able to achieve any results so I am asking for help.
I am trying to call my JFrame
class to my main class that will be setting up the Comm port. The frame is created using the design in the Netbeans software.
My question is why is my main Java file not able to open the frame that is created in another class?
Below are the shortened codes:
The main class is SerialTest
package javaapplication1;
import javaapplication1.RCDA_JFrame;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;
import java.util.Enumeration;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.IOException;
import javax.swing.JButton;
import javax.swing.JFrame;
public class SerialTest extends JFrame implements SerialPortEventListener {
public static void main(String[] args) throws Exception {
JFrame RCDA_JFrame = new JFrame();
RCDA_JFrame.setVisible(true);
}
}
And my GUI class is RCDA_JFrame
package javaapplication1;
import java.io.IOException;
//import java.io.OutputStream;
import javaapplication1.SerialTest;
public class RCDA_JFrame extends javax.swing.JFrame {
//private OutputStream SerialOut;
public RCDA_JFrame() {
initComponents();
}
public static void main(String args[]) {
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new RCDA_JFrame().setVisible(true);
}
});
}
}