public PasteDialog(IRCMainFrame owner, String chan) {
    super(owner, true);
    setTitle("Paste Dialog - "+ chan);
    this.mainFrame = owner;
    this.chan = chan;
    JButton okay = new JButton("OK");
    JButton cancel = new JButton("Cancel");
    okay.addActionListener(new ActionListener() { 
      public void actionPerformed(ActionEvent e) {
        sendInput();
        dispose();
      }
    } );
    cancel.addActionListener(new ActionListener() { 
      public void actionPerformed(ActionEvent e) {
        dispose();
      }
    } );

    JPanel bottom = new JPanel(); // child of the main panel
    bottom.add(okay);
    bottom.add(cancel);

    input = new JTextArea();
    JScrollPane scrollpane = new JScrollPane(input, 
        JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 
        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    JPanel center = new JPanel();
    center.setLayout(new GridLayout(1,1));
    center.add(scrollpane);

    JPanel main = new JPanel();
    main.setLayout(new BorderLayout());
    main.add(center, BorderLayout.CENTER);
    main.add(bottom, BorderLayout.SOUTH);
    getContentPane().add(main);

    setSize(275,300); 
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension mySize = getSize();
    if (mySize.height > screenSize.height)
      mySize.height = screenSize.height;
    if (mySize.width > screenSize.width)
      mySize.width = screenSize.width;
    int x = (screenSize.width - mySize.width)/2;
    int y = (screenSize.height - mySize.height)/2;
    setLocation(x, y); 
    setVisible(true);
  }