Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Displaying Text on a JFrame

Displaying Text on a JFrame

Scheduled Pinned Locked Moved Java
help
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MikeMarq
    wrote on last edited by
    #1

    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);
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups