0

How to show this loop inside a frame?

String R="Reserved";
String A="Available";
String name;
int option;
int roomNumber;
  int value=6;
String reserveRoom[] = new String[value];
Scanner in = new Scanner(System.in);        

System.out.print("\n*****WELCOME!*****\n");
System.out.print("Enter your name:\n");
name=in.nextLine();
System.out.print("ROOM #.     STATUS\n");
        roomNumber=1;
        for(int i=1;i<value;i++) {

            reserveRoom[i]=A;
            System.out.println("   " +roomNumber + "\t    " +reserveRoom[i]);
            roomNumber++;
        } 

Edited by pritaeas: Moved.

2
Contributors
1
Reply
23
Views
4 Years
Discussion Span
Last Post by Vedoo
0

I will give you some idea to start with. If you want to display the results in a frame using GUI coponents, go through JFrame of Swing component in Java. Your JFrame will show the interface where your code is run and show the results. Go through JList and JScrollPane to display the results.

If you want to display the results in a frame in a simple way, go through JOptionPane.showMessageDialog to show all the results. See here on StackOverflow on similar problem: Click Here. Good Luck :)

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.