I'm using Eclipse to build a version of....notepad. However, i always get stuck on the ActionListener for the button for creating a tab. Here:
package com.Marko2155.BetterNotepad;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
class MainProgram{
public static void main(String[] args) {
JFrame frame = new JFrame();
JButton button = new JButton("Click here to add a tab");
JTabbedPane tabs = new JTabbedPane();
JTextArea field = new JTextArea();
//Add component settings here
button.addActionListener(
//ActionListener cannot be resolved to a variable
ActionListener listener = new ActionListener(){
public void actionPerformed(ActionEvent e) {
}
});
//Add manual tabs here
tabs.addTab("+", button);
//Add components here
frame.add(tabs);
//Window settings here
frame.setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
frame.setSize(800, 600);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.setTitle("BetterNotepad");
}
}