Displaying Text on a JFrame
Java
1
Posts
1
Posters
0
Views
1
Watching
-
I'm trying to display text in the shape of a cross on a JFrame using 4 JTextAreas but when I do all of the JTextAreas display correctly except the last one which ends up in the upper left corner. It is always the last item that ends up in the wrong spot. For instance I tried creating the west one first and it was then fine but then south became wrong. Here's the display code thanks in advance for your help. Mike
JFrame frame = new JFrame(); //north jtextnorth = new JTextArea ("North" + '\\n' + party\[0\] + '\\n'); jtextnorth.setLocation(150, 0); jtextnorth.setSize(100,100); frame.add(jtextnorth); //east jtexteast = new JTextArea ("East" + '\\n' + party\[1\] + '\\n'); jtexteast.setLocation(300, 150); jtexteast.setSize(100,100); frame.add(jtexteast); //south jtextsouth = new JTextArea ("South" + '\\n' + party\[2\] + '\\n'); jtextsouth.setLocation(150, 300); jtextsouth.setSize(100,100); frame.add(jtextsouth); //west jtextwest = new JTextArea ("West" + '\\n' + party\[3\] + '\\n'); jtextwest.setLocation(25, 150); jtextwest.setSize(100,100); frame.add(jtextwest); frame.setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE); frame.setSize(400,400); frame.setVisible(true);