import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.*; public class SimpleGUI extends JFrame implements ActionListener { public String version = "1"; private static SimpleGUI frame; private JFileChooser chooser; private JEditorPane textPane = new JEditorPane(); private static JMenu file; private static JMenu help; private static JMenu op; private static JMenuItem word; private static JMenuItem open; private static JMenuItem cred; private static JMenuItem save; private static JMenuItem exit; private static FileWriter thefile; private static PrintWriter output; private static JButton button1; private static JTextArea text; public static void main(String[] args) throws IOException { frame = new SimpleGUI(); frame.setTitle("Cursed Notes"); frame.setSize(600,700); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setVisible(true); thefile = new FileWriter("info.txt", true); output = new PrintWriter(thefile); } public SimpleGUI() { JMenuBar menu = new JMenuBar(); file = new JMenu("File"); help = new JMenu("Help"); cred = new JMenuItem("Credits"); open = new JMenuItem("Open"); save = new JMenuItem("Save"); exit = new JMenuItem("Exit"); word = new JMenuItem("Word"); button1 = new JButton("Save"); text = new JTextArea("Be Sure to check for updates!\n\nVersion: " + version); add(menu, "North"); menu.add(file); menu.add(help); menu.add(op); file.add(open); file.add(save); file.addSeparator(); file.add(exit); help.add(cred); op.add(word); add(new JScrollPane(text)); add(button1, "South"); button1.addActionListener(this); save.addActionListener(this); exit.addActionListener(this); cred.addActionListener(this); open.addActionListener(this); word.addActionListener(this); text.setBounds(25,100,200,300); } public void actionPerformed(ActionEvent e) { if (e.getSource() == button1) { output.println(text.getText()); output.flush(); } if (e.getSource() == open) { // loadFile(); text.setText("Open is coming soon!"); } if (e.getSource() == save) { output.println(text.getText()); output.flush(); } if (e.getSource() == op) { if (text.setLineWrap(false)) { if (text.setWrapStyleWord(false)) { text.setWrapStyleWord(true); text.setLineWrap(true); } } else { text.setWrapStyleWord(false); text.setLineWrap(false); } } if (e.getSource() == cred) { text.setText("Utility - Cursed\n\nThank you for using my tool, I really hope you enjoy it and for new updates be sure to check: http://www.codersrus.org/smf"); } if (e.getSource() == exit) { output.close(); System.exit(0); } } public void loadFile() { chooser = new JFileChooser(); int result = chooser.showOpenDialog(this); if (result == JFileChooser.CANCEL_OPTION) return; try { File file = chooser.getSelectedFile(); java.net.URL url = file.toURL(); textPane.setPage(url); text.setText("" + url); } catch (Exception e) { textPane.setText("Could not load file: " + e); } } }