Results 1 to 2 of 2
  1. #1
    Spyderpig is offline Member
    Join Date
    Feb 2011
    Posts
    24
    Rep Power
    0

    Default Help Displaying an Array

    Array needs to look like:



    this is what i have so far... the inside values arent exactly the same because it is for testing purposes only right now.
    Java Code:
    	int[][] toReverse = {
    			{1,2,3,4,5},
    			{1,2,3,4,5},
    			{1,2,3,4,5},
    			{1,2,3,4,5},
    			{1,2,3,4,5}}
    			;
    
    System.out.println("                To Depot #");
    	int[] toDepot = {0,1,2,3,4};
    	
    	System.out.print("From Depot #");
    	int[] fromDepot = {0,1,2,3,4};
    
    	for (int i=0;i<toDepot.length;i++)
    	{
    	System.out.print(" " + toDepot[i]);
    	}
    	
    	for (int i=0;i<fromDepot.length;i++){
    		System.out.printf("%8s", fromDepot[i]);
    	}
    	
    	System.out.println();
    	for (int r = 0; r <toReverse.length; r++) {
    		for (int c = 0; c < toReverse[0].length; c++) {
    			System.out.printf("%4s", " " + toReverse[r][c]);
    		}
    		System.out.println();
    	
    	}

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    Maybe you should use a GUI instead, you can then easily create and edit the look-and-feel of your application with software like NetBeans IDE, and then program the code behind it.

    Displaying things in a particular manner in a command-line box is always going to be tedious and time-consuming.

Similar Threads

  1. displaying an array
    By exose in forum New To Java
    Replies: 5
    Last Post: 03-10-2011, 03:06 PM
  2. Help displaying an array from a seperate class
    By aeon1613 in forum New To Java
    Replies: 2
    Last Post: 01-16-2011, 08:15 AM
  3. Displaying an image through an array
    By BariMutation in forum New To Java
    Replies: 0
    Last Post: 12-04-2010, 04:20 AM
  4. Displaying array values in jstl page
    By keshaba in forum Advanced Java
    Replies: 0
    Last Post: 04-23-2010, 10:00 AM
  5. Problems displaying and array of JPanels
    By dousedfirepants in forum New To Java
    Replies: 3
    Last Post: 11-13-2008, 05:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •