Hello people.
I made a simple and fast code for a JFrame in which i try to get a string to get one white spaces between every letter in the string.
That works as it should but at the end i would like to copy and paste the result but i cannot do so.
Any ideas as to how i can copy the results from the JFrame?
Thanks.
PS: Left the code if anyone wants to see it.
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class SpacesInText extends JFrame { /** * */ private static final long serialVersionUID = 5769884900610946321L; JPanel jp = new JPanel(); JLabel jl = new JLabel(); JTextField jt = new JTextField(30); JButton jb = new JButton("Enter"); static String input; public SpacesInText() { setTitle("M e m e s p a c e m a k e r ! "); setVisible(true); setSize(400, 200); setDefaultCloseOperation(EXIT_ON_CLOSE); jp.add(jt); jt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { input = jt.getText(); jl.setText(space()); } }); jp.add(jb); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { input = jt.getText(); jl.setText(space()); } }); jp.add(jl); add(jp); } public static String space() { String s = input.replace("", " "); return s; } public static void main(String[] args) { @SuppressWarnings("unused") SpacesInText t = new SpacesInText(); } }