All pastes #235429 Raw Edit

Jirk-GUI

public java v1 · immutable
·published 2006-11-03 06:24 UTC
rendered paste body
import javax.swing.*;import java.awt.*;import java.awt.event.*;//import GUI.class;public class GUI implements ActionListener,ItemListener{JEditorPane pane;	private static void createGUI(){		JFrame.setDefaultLookAndFeelDecorated(false);		JFrame frame = new JFrame("Jirk IRC Client");	   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);	   frame.setSize(new Dimension(120, 40));			GUI gui = new GUI();      frame.setJMenuBar(gui.createMenuBar());      frame.setContentPane(gui.createContentPane());       //Display the window.       frame.setSize(450, 260);       frame.setVisible(true);	}    public JMenuBar createMenuBar() {        //menu stuff	   JMenuBar menuBar = new JMenuBar();	   //setMenuBar(menuBar);	   	   JMenu menuFile = new JMenu("FILE");	   menuBar.add(menuFile);	   	   JMenu menuEdit = new JMenu("EDIT");	   	JMenuItem menuEditPreferences = new JMenuItem("Preferences");	   	menuEditPreferences.addActionListener(this);	   	menuEdit.add(menuEditPreferences);	   menuBar.add(menuEdit);	   		//menuitemExit = new JMenuItem("QUIT");		//menuFile.add(menuitemExit);        return menuBar;    }    public void actionPerformed(ActionEvent e) {        JMenuItem source = (JMenuItem)(e.getSource());        String s = "Action event detected: "+ source.getText();        pane.setText(pane.getText() + s + "\n");        //output.append(s + newline);        //output.setCaretPosition(output.getDocument().getLength());    }    public void itemStateChanged(ItemEvent e) {        JMenuItem source = (JMenuItem)(e.getSource());        String s = "Action event detected: "+ source.getText();        pane.setText(pane.getText() + s + "\n");        //output.append(s + newline);        //output.setCaretPosition(output.getDocument().getLength());    }	public Container createContentPane() {        //Create the content-pane-to-be.        JPanel contentPane = new JPanel(new BorderLayout());        contentPane.setOpaque(true);						pane = new JEditorPane();	   	pane.setEditable(false);	   	//frame.getContentPane().add(new JScrollPane(pane), "Center");        //Add the text area to the content pane.        contentPane.add(pane, BorderLayout.CENTER);        return contentPane;    }}