Hello,
I'm trying to create a class (TextAnalyzer) which contains another class (GUI_Interface). I want to create a GUI_Interface object (called fereastra) in TextAnalyzer's public static void main() function. But I get an error here: GUI_Interface fereastra = new GUI_Interface();
I'm using Eclipse JUNO. If I try to write the classes separately (not one inside the other), it also shows an error, telling me that I have to put each class into its separate file. I'd like to avoid doing that because I'll use a lot of classes (it's a complex project), and I'm trying group the classes as much as I can.
This is my code:
import javax.swing.*; import java.awt.Color; public class TextAnalyzer { public class GUI_Interface extends JFrame{ public GUI_Interface(){ super("Psy Analyzer"); super.setBounds(100, 50, 800, 800); super.setBackground(Color.WHITE); JPanel content = new JPanel(); JLabel eticheta = new JLabel("Drag file here"); content.add(eticheta); this.getContentPane().add(content); } } public static void main(String args[]){ GUI_Interface fereastra = new GUI_Interface(); //window fereastra.setVisible(true); } }