Skip to content

Instantly share code, notes, and snippets.

@MXP2095onetechguy
Created March 28, 2022 03:09
Show Gist options
  • Select an option

  • Save MXP2095onetechguy/7eb8b8112f0a66da33fb255912c70663 to your computer and use it in GitHub Desktop.

Select an option

Save MXP2095onetechguy/7eb8b8112f0a66da33fb255912c70663 to your computer and use it in GitHub Desktop.
A text pad that is multidocument in java with jshell
//usr/bin/env jshell --show-version --execution local "$0" "$@"; exit $?
// A JShell script for JIFpad (a text pad, multidocument)
import javax.swing.*;
JFrame jf = new JFrame("JIFPad");
JInternalFrame jif = new JInternalFrame();
int inty = 1;
jf.add(jif);
jif.setVisible(true);
JDesktopPane jdp = new JDesktopPane();
jif.add(jdp);
{
JMenuBar jmb = new JMenuBar();
jif.setMenuBar(jmb);
{
JMenu fm = new JMenu("File");
JMenuItem newjif = new JMenuItem("New JIF");
newjif.addActionListener((e) -> {
JInternalFrame JIFFY = new JInternalFrame("JIFFY" + inty, true, true, true, true);
JIFFY.setBounds(0, 0, 250, 85);
JIFFY.add(new JScrollPane(new JTextArea()));
jdp.add(JIFFY);
JIFFY.setVisible(true);
inty += 1;
});
fm.add(newjif);
JMenuItem quitjif = new JMenuItem("RageQuit");
quitjif.addActionListener((e) -> System.exit(0));
fm.add(quitjif);
jmb.add(fm);
}
}
jf.pack();
jf.setVisible(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment