John Delmark Aguilar
Would you like to react to this message? Create an account in a few clicks or log in to continue.
John Delmark Aguilar

Personal Forum
 
HomeSearchLatest imagesRegisterLog in

 

 Basic Window(OOP)

Go down 
AuthorMessage
dElmARk
Admin
Admin
dElmARk


Posts : 92
Join date : 09/04/2012

Basic Window(OOP) Empty
PostSubject: Basic Window(OOP)   Basic Window(OOP) Icon_minitimeTue Oct 23, 2012 9:18 pm

Creating Window-Based Java

Code:
import javax.swing.*;
import java.awt.*;
import java.util.*;
class act{
    public static void main(String [] args){
Scanner xet = new Scanner(System.in);


    System.out.print("Title: ");
    String title = xet.nextLine();
    System.out.print("Name: ");
    String name = xet.nextLine();   
    System.out.print("Course: ");
    String course = xet.nextLine();   
    System.out.print("Food: ");
    String food = xet.nextLine();   
    System.out.print("Place: ");
    String place = xet.nextLine();
   


    System.out.print("X Pos: ");
    int x = xet.nextInt();   
    System.out.print("Y Pos: ");
    int y = xet.nextInt(); 
    System.out.print("Width: ");
    int w = xet.nextInt();
    System.out.print("Hight: ");
    int h = xet.nextInt();
   

   
   
JFrame myFrame = new JFrame(title);
 myFrame.setBounds(x,y,h,w);
 myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 myFrame.setVisible(true);
 JButton BTitle = new JButton(title);
 JButton BName = new JButton(name);
 JButton BFood = new JButton(food);
 JButton BPlace = new JButton(place);
 JButton BCourse = new JButton(course);
 
 JPanel myP = new JPanel(new BorderLayout());
  myP.add(BTitle, BorderLayout.CENTER);
  myP.add(BName, BorderLayout.NORTH);
  myP.add(BFood, BorderLayout.WEST);
  myP.add(BPlace, BorderLayout.EAST);
  myP.add(BCourse, BorderLayout.SOUTH); 
  myFrame.add(myP);
   
   
    }
}
Back to top Go down
https://delmark.forumtl.com
 
Basic Window(OOP)
Back to top 
Page 1 of 1
 Similar topics
-
» [JS] New Window (window.open)
» Tutorial: The Basic of ASM

Permissions in this forum:You cannot reply to topics in this forum
John Delmark Aguilar :: dElmARk Productions :: Java Programs :: Tutorials-
Jump to: