//fix: scrolling discrpcy import javax.swing.*; import javax.swing.event.*; import java.awt.event.*; import java.awt.*; import java.util.*; public class MEd2 implements WindowListener, ActionListener{ GBLTool.GBC gbc; GBLTool gtool=new GBLTool(); JFrame parFrame; Container contents; DocumentListener mList; JTextArea mainField; JLabel wit; JButton enterTxt; public MEd2(String name, int sizx, int sizy) { parFrame=new JFrame(name); // mainField=new JTextArea("hello there", 3, 30); JScrollPane fieldPane=new JScrollPane(mainField); // wit= new JLabel(); enterTxt=new JButton("Relay Text"); enterTxt.addActionListener(this); gbc=new GBLTool.GBC(); gtool.add(parFrame, mainField, gbc.fill(GridBagConstraints.BOTH).weightx(0.0).gridx(0).gridy(0).gridwidth(3)); gtool.add(parFrame, wit, gbc.weightx(0.0).gridx(0).gridy(4)); gtool.add(parFrame, enterTxt, gbc.gridx(0).gridy(5)); parFrame.pack(); parFrame.setSize(sizx, sizy); parFrame.setVisible(true); parFrame.addWindowListener(this); } //WindowListener public void windowClosing(WindowEvent e) { Window theWindow=e.getWindow(); theWindow.dispose(); } public void windowClosed(WindowEvent e) { System.exit(0); } public void windowActivated(WindowEvent e) {} public void windowDeactivated(WindowEvent e) {} public void windowIconified(WindowEvent e) {} public void windowDeiconified(WindowEvent e) {} public void windowOpened(WindowEvent e) {} //ActionListener public void actionPerformed(ActionEvent e) { String thetxt=mainField.getText(); StringTokenizer firstWord=new StringTokenizer(thetxt); thetxt=firstWord.nextToken(); wit.setText(thetxt); } }