Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import javax.swing.text.*;
- import java.awt.*;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- public class GUI {
- public JFrame frame;
- public JTextPane console;
- public JTextField input;
- public JScrollPane scrollpane;
- public StyledDocument document;
- boolean trace = false;
- public CommandLine central = new CommandLine();
- public static String text;
- @SuppressWarnings("static-access")
- public static void main(String[] args) {
- new GUI();
- CommandLine central = new CommandLine();
- central.main(text);
- }
- public GUI() {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception ex) {}
- frame = new JFrame();
- frame.setTitle("Command Line");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- console = new JTextPane();
- console.setForeground(Color.BLACK);
- console.setEditable(false);
- console.setFont(new Font("Courier New", Font.PLAIN, 13));
- console.setOpaque(false);
- document = console.getStyledDocument();
- input = new JTextField();
- input.setBorder(null);
- input.setBounds(0, 303, 528, 25);
- input.setEditable(true);
- input.setFont(new Font("Courier New", Font.PLAIN, 13));
- input.setBackground(Color.WHITE);
- input.setForeground(Color.WHITE);
- input.setCaretColor(Color.GREEN);
- input.setOpaque(false);
- scrollpane = new JScrollPane(console);
- scrollpane.setBounds(0, 0, 660, 303);
- scrollpane.setBorder(null);
- scrollpane.setOpaque(false);
- scrollpane.getViewport().setOpaque(false);
- frame.getContentPane().setLayout(null);
- frame.getContentPane().add(input);
- frame.getContentPane().add(scrollpane);
- frame.getContentPane().setBackground(new Color(40, 40, 40));
- JButton submit = new JButton("Enter");
- submit.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- text = input.getText();
- }
- });
- submit.setBounds(540, 301, 120, 29);
- frame.getContentPane().add(submit);
- frame.setLocationRelativeTo(null);
- frame.setSize(660, 350);
- frame.setResizable(true);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement