0
package javaapplication1;

public class Main {

    public static void main(String[] args) {
        //display the table heading
        System.out.print("     Multiplication Table\n");
        System.out.print("------------------------------\n");
        //Display the number title
        System.out.print("     ");
        for(int j=1;j<=9;j++)
           System.out.print("   "+j);
        System.out.print("\n");

       //Print the body of the table
        for(int i=1;i<=9;i++)
        {
            System.out.print(i+"  | ");
            for (int j=1;j<=9;j++)
            {
                if(i*j<10)
                    System.out.print("   "+i*j);
                else System.out.print("  "+i*j);
            }
            System.out.print("\n");
        }
    }
}

I'm a beginner to java and I saw in the graphics I can draw a panel ad write in it
so I wanted to write the results of multiplication in the panel.
I tried to write it in a panel but the first row only is included in it not all the table
Can anyone give me a hand??

Edited by Nick Evan: Added code-tags, changed to thread

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by james chaco
0

i think your approach is wrong in writing on the panel because system.out.....is used when we have to write something on the console screen.

for u'r problem must add components on the panel like textfield, textarea to write something on it..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.