Created
March 28, 2022 03:09
-
-
Save MXP2095onetechguy/7eb8b8112f0a66da33fb255912c70663 to your computer and use it in GitHub Desktop.
A text pad that is multidocument in java with jshell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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