Using containers in Java Assignment Help

Assignment Help: >> Containers and layouts in Java >> Using containers in Java

Using containers in Java:

An object of class Window provides a top-level window without borders or a title bar. As it stands it is not entirely useful, except for implementing a pop-up window, but it forms the basic building unit for the Window subclasses. The JFrame subclass, for example, has borders and a title bar and is normally used as the root window for building stand­ alone Java applications. 

The following code is a very simple application that displays a frame and sets the title of the window:

import java.awt. *;
import javax.swing. *;

public class FrameDemo extends JFrame
{
public FrameDemo (String title)
{
setSize(200, 200);
setTitle(title);
}
}

To run the code we use the following class:

public class FrameDemoTest
{
public static void main (String [] args)
{
FrameDemo fd = new FrameDemo("We Love Java");
fd.setVisible(true);
}
}

Remember that a JFrame object is normally used for applications. The above code creates a frame, sizes the frame (to 200 by 200 pixels), sets the title and then displays it on the screen using the method setVisible(true). Once you have an object that is described by a class that is a subclass of the Container class (for example, JFrame) then you can add other user interface elements quite easily. If you run the code for class FrameDemoTest, you will see a simple window on your screen. The screen shot corresponding to the code above is shown in Figure.

1633_Using containers in Java.png

Figure: A simple frame showing only a title, the standard icon and the window buttons

If you press the close box in the top right-hand corner, the window disappears as you would expect. However, the program has not stopped running. In order to stop the program you will need to use the facilities of your IDE interface. 

Once you have created a top-level frame you can use the JPanel class to divide it up into manageable sections.

 

Java Assignment Help - Java Homework Help

Struggling with java programming language? Are you not finding solution for your Using containers in Java homework and assignments? Live Using containers in Java experts are working for students by solving their doubts & questions during their course studies and training program. We at Expertsmind.com offer Using containers in Java homework help, java assignment help and Using containers in Java projects help anytime from anywhere for 24x7 hours. Computer science programming assignments help making life easy for students.

Why Expertsmind for assignment help

  1. Higher degree holder and experienced experts network
  2. Punctuality and responsibility of work
  3. Quality solution with 100% plagiarism free answers
  4. Time on Delivery
  5. Privacy of information and details
  6. Excellence in solving java programming language queries in excels and word format.
  7. Best tutoring assistance 24x7 hours

 

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd