Saturday 28 June 2014

Program to show the example of radio buttons

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
public class Radio extends Applet implements ActionListener
{
Checkbox ch1,ch2;
CheckboxGroup cbg;
Button b1;

public void init()
{
cbg=new CheckboxGroup();
b1=new Button("check");
ch1= new Checkbox("male",cbg,true);
ch2= new Checkbox("female", cbg,true);
add(ch1);
add(ch2);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
String a=" ", b=" ", c=" ";
if(e.getSource()==b1)
{
if(ch1.getState()==true)
{a="male";}
else if(ch2.getState()==true)
{b="female";}

JOptionPane.showMessageDialog(this, "u have selected "+a+b);

}
}}

output:


Program to show two listed choices and print their table

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Mullist extends Applet implements ItemListener{
Choice ch1,ch2;
List l1;
int c,d;
public void init()
{
ch1=new Choice();
ch2=new Choice();
l1=new List(10);
for(int i=1; i<=100; i++)
{
ch1.add(String.valueOf(i));
ch2.add(String.valueOf(i));
}
add(ch1);
add(ch2);
add(l1);
ch1.addItemListener(this);
ch2.addItemListener(this);

}
public void itemStateChanged(ItemEvent e) {
if(e.getSource()==ch1)
{
c=Integer.parseInt(ch1.getSelectedItem());
}
if(e.getSource()==ch2)
{
d=Integer.parseInt(ch2.getSelectedItem());
}

for(int i=1; i<=d; i++)
{
l1.add(""+c+"x"+i+"="+c*i+"\n");
}
}

}

output:




Friday 27 June 2014

Make your own KBC(kaun banega crorepati) game

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
public class Kbc extends Applet implements ActionListener{
Label l1,l2,l3;
Panel p1,p2,p3,p4;
CheckboxGroup c1,c2,c3;
Checkbox  ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,ch11,ch12;
Button b1,b2,b3,b4;


public void init()
{
setLayout(null);
p1=new Panel();
p1.setBounds(100,10,800,500);
add(p1);
c1=new CheckboxGroup();
c2=new CheckboxGroup();
c3=new CheckboxGroup();
b1= new Button("lock the answer");
l1 = new Label();
l1.setText("Q1: what is the capital of india?");
p1.add(l1);
ch1= new Checkbox("delhi",c1,false);
ch2= new Checkbox("chandigarh", c1,false);
ch3= new Checkbox("manipur", c1,false);
ch4= new Checkbox("mumbai", c1,false);
p1.add(ch1);
p1.add(ch2);
p1.add(ch3);
p1.add(ch4);
p1.add(b1);
b1.addActionListener(this);
p2=new Panel();
p2.setBounds(100,10,800,500);
add(p2);
b2= new Button("lock the answer");
l2 = new Label();
l2.setText("Q2: who is the founder of facebook");
p2.add(l2);
ch5= new Checkbox("mark zukerberg",c2,false);
ch6= new Checkbox("james wat", c2,false);
ch7= new Checkbox("sherlock", c2,false);
ch8= new Checkbox("orkut", c2,false);
p2.add(ch5);
p2.add(ch6);
p2.add(ch7);
p2.add(ch8);
p2.add(b2);
b2.addActionListener(this);
p3=new Panel();
p3.setBounds(100,10,800,500);
add(p3);
b3= new Button("lock the answer");
l3 = new Label();
l3.setText("Q2: what is the capital of punjab?");
p3.add(l3);
ch9= new Checkbox("iraq",c3,false);
ch10= new Checkbox("chandigarh", c3,false);
ch11= new Checkbox("crap", c3,false);
ch12= new Checkbox("mumbai", c3,false);
p3.add(ch9);
p3.add(ch10);
p3.add(ch11);
p3.add(ch12);
p3.add(b3);
b3.addActionListener(this);

p1.setBackground(Color.blue);
p2.setBackground(Color.cyan);
p3.setBackground(Color.pink);


p4=new Panel();
p4.setBounds(100,10,800,500);
add(p4);
p4.setBackground(Color.gray);
b4=new Button("done");
p4.add(b4);
b4.addActionListener(this);
p1.setVisible(true);
p2.setVisible(false);
p3.setVisible(false);
p4.setVisible(false);
}
public void actionPerformed(ActionEvent e) {
String a=" ", b=" ";

if(e.getSource()==b1)
{
if(ch1.getState()==true)
a="right";
else if(ch2.getState()==true)
b="wrong";
else if(ch3.getState()==true)
b="wrong";
else if(ch4.getState()==true)
b="wrong";

JOptionPane.showMessageDialog(this, "u have selected "+a+b);
p1.setVisible(false);
p2.setVisible(true);
p3.setVisible(false);
p4.setVisible(false);
}
if(e.getSource()==b2)
{
if(ch5.getState()==true)
a="right";
else if(ch6.getState()==true)
b="wrong";
else if(ch7.getState()==true)
b="wrong";
else if(ch8.getState()==true)
b="wrong";
JOptionPane.showMessageDialog(this, "u have selected "+a+b);
p1.setVisible(false);
p2.setVisible(false);
p3.setVisible(true);
p4.setVisible(false);
}
if(e.getSource()==b3)
{
if(ch9.getState()==true)
b="wrong";
else if(ch10.getState()==true)
a="right";
else if(ch11.getState()==true)
b="wrong";
else if(ch12.getState()==true)
b="wrong";
JOptionPane.showMessageDialog(this,"u have selected "+a+b);
p1.setVisible(false);
p2.setVisible(false);
p3.setVisible(false);
p4.setVisible(true);
}
if(e.getSource()==b4)
System.exit(0);
}}

Wednesday 25 June 2014

Program to print delayed output using multithreading


public class loading implements Runnable{


public void run() {
// TODO Auto-generated method stub
int i;

for(i=0; i<=5; i++)
{
try
{

Thread.sleep(1000);

}
catch(Exception e){}
System.out.println("i="+i);
}

}
public static void main(String[] args)
{
loading l=new loading();
Thread t=new Thread(l);
t.start();

}}

output:
i=0
i=1
i=2
i=3
i=4
i=5

Program to print delayed output

import javax.swing.*;

public class delayed {

public static void main(String[] args)
{
int i;

for(i=0; i<=5; i++)
{
try
{

Thread.sleep(1000);

}
catch(Exception e){}
System.out.println("i="+i);
}

}}

output:
i=0
i=1
i=2
i=3
i=4
i=5

Tuesday 24 June 2014

Program to show Panels and Buttons

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class addingpanelonpanel extends Applet implements ActionListener{
Panel p1,p2;
Button b1,b2;

public void init()
{
setLayout(null);
b1= new Button("open panel 2");
b2= new Button("open panel 1");
b1.setBounds(130,130,160,20);
b2.setBounds(450,130,160,20);
p1=new Panel();
p2=new Panel();
p1.setBounds(120,120,220,120);
p2.setBounds(420,120,220,120);
p1.setBackground(Color.red);
p2.setBackground(Color.PINK);
b1.addActionListener(this);
b2.addActionListener(this);
p1.setVisible(true);
p2.setVisible(false);
add(p1);
add(p2);
p1.add(b1);
p2.add(b2);
}
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==b1)
{
p2.setVisible(true);
p1.setVisible(false);
}
else
{
p1.setVisible(true);
p2.setVisible(false);
}
}

}

output:

Creating a frame having menu

import java.awt.Frame;
import java.awt.Menu;
import java.awt.*;
import java.awt.event.*;
public class Menucreation extends Frame implements WindowListener{
Menucreation()
{
MenuBar mb;

Menu f,e,w;
MenuItem n,c,cpy,pst,h;
mb= new MenuBar();
f=new Menu("file");
e=new Menu("edit");
w=new Menu("window");
n=new MenuItem("new");
c=new MenuItem("cut");
cpy=new MenuItem("copy");
pst=new MenuItem("paste");
h=new MenuItem("help");

this.setMenuBar(mb);
mb.add(f);
mb.add(e);
mb.add(w);
f.add(n);
e.add(c);
e.add(cpy);
e.add(pst);
w.add(h);
this.setVisible(true);
this.setSize(1000, 600);
this.setTitle("mine");
this.addWindowListener(this);
}

public static void main(String[] args) {
new Menucreation();

}

public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
System.exit(0);
}

public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub

}

}

output:

Creating a new frame

import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class Framecreation extends Frame implements WindowListener{
Framecreation()
{
this.setVisible(true);
this.setSize(200, 200);
this.setTitle("mine");
this.addWindowListener(this);
}

public static void main(String[] args) {
new Framecreation();

}

public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
System.exit(0);
}

public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub

}

public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub

}

}

output:


Monday 23 June 2014

Program to show the example of choice

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
public class  choic extends Applet implements ItemListener
{
Choice ch1;
public void init()
{
ch1=new Choice();
ch1.add("green");
ch1.add("red");
ch1.add("blue");
add(ch1);
ch1.addItemListener(this);
}
public void itemStateChanged(ItemEvent e) {
if(e.getSource()==ch1)
{
int c =ch1.getSelectedIndex();
switch(c)
{
case 0:
this.setBackground(Color.green);
break;
case 1:
this.setBackground(Color.red);
break;
case 2:
this.setBackground(Color.blue);
break;
default:
this.setBackground(Color.black);


}

}}}

output:


Program to show the example of LIST and add items to it

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

import javax.swing.JOptionPane;
public class  liss extends Applet implements ItemListener, ActionListener
{
List ch1;
Button b1,b2,b3;
TextField t;
public void init()
{
ch1=new List(6);
ch1.add("green");
ch1.add("red");
ch1.add("blue");
add(ch1);
t=new TextField(" ");
add(t);
b1=new Button("add");
add(b1);
b1.addActionListener(this);
b2=new Button("remove");
add (b2);
b2.addActionListener(this);
ch1.addItemListener(this);
ch1.addActionListener(this);

}

public void itemStateChanged(ItemEvent e) {
if(e.getSource()==ch1)
{
int c =ch1.getSelectedIndex();

switch(c)
{
case 0:
this.setBackground(Color.green);
break;
case 1:
this.setBackground(Color.red);
break;
case 2:
this.setBackground(Color.blue);
break;
default:
this.setBackground(Color.black);


}

}}

public void actionPerformed(ActionEvent e) {
if(e.getSource()==b1)
{
ch1.add(t.getText());
}
else
{
ch1.remove(ch1.getSelectedIndex());
}
}}


OUTPUT:

Program to make a paint brush in java

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class paint extends Applet implements MouseMotionListener{
Graphics g;
public void init()
{
g = getGraphics();
this.addMouseMotionListener(this);
}


public void mouseDragged(MouseEvent e) {
g.fillRect(e.getX(), e.getY(), 10, 10);
}
public void mouseMoved(MouseEvent arg0) {
}

}

outout:

Saturday 21 June 2014

Program to show boolean data type

package sum;

public class bool {

public static void main(String[] args) {
// Demonstrate boolean values.
boolean b;
b = false;
System.out.println("b is " + b);
b = true;
System.out.println("b is " + b);
// a boolean value can control the if statement
if(b) System.out.println("This is executed.");
b = false;
if(b) System.out.println("This is not executed.");
// outcome of a relational operator is a boolean value
System.out.println("10 <9 is " + (10 < 9));

}

}

output:
b is false
b is true
This is executed.
10 <9 is false

Wednesday 18 June 2014

Program to illustrate the use of mouse listener, mouse motion listener and key listener

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
//import java.awt.event.MouseMotionListener;

public class Swingmouse extends Applet implements MouseListener, MouseMotionListener, KeyListener{
int x,y;
char k= ' ';
String str= " ";
Font f=new Font(" ", 50, 50);
public void init()
{
this.setFont(f);
this.addMouseListener(this);
this.addMouseMotionListener(this);
this.addKeyListener(this);
}
public void paint(Graphics g)
{
g.drawString(str, 45,45);
}
public void mouseClicked(MouseEvent e) {
str="mouse clicked";
repaint();

}
public void mouseEntered(MouseEvent e) {
str="mouse entered";
repaint();


}
public void mouseExited(MouseEvent e) {
str="mouse exited";
repaint();

}
public void mousePressed(MouseEvent e) {
str="mouse pressed";
repaint();


}
public void mouseReleased(MouseEvent e) {
str="mouse released";
repaint();

}
public void mouseDragged(MouseEvent e) {
str="mouse dragged";
x=e.getX();
y=e.getY();
repaint();

}
public void mouseMoved(MouseEvent e) {
str="mouse moved";
repaint();

}
public void keyPressed(KeyEvent e) {
k=e.getKeyChar();
repaint();
}
public void keyReleased(KeyEvent e) {
str= " ";
repaint();
}
public void keyTyped(KeyEvent e) {
k=e.getKeyChar();
str=String.valueOf(e.getKeyChar());
repaint();
}
}

Program to use applets and make a diagram

import java.applet.Applet;
import java.awt.*;
public class graph extends Applet {

Font f=new Font("cambria",65,32);

public void init()
{
this.setFont(f);
}
public void paint(Graphics g)
{

g.drawLine(220,114,120,240);
g.drawLine(220,114,320,240);
g.drawLine(125,235,125,350);
g.drawLine(315,235,315,390);
g.drawLine(125,350,315,390);
g.drawLine(220,114,400,114);
g.drawLine(315,235,490,235);
g.drawLine(400,114,490,235);
g.drawLine(490,235,490,350);
g.drawLine(315,390,490,350);
g.drawRect(385,275,50,40);
g.drawLine(255,377,255,260);
g.drawLine(190,363,190,260);
g.drawLine(255,260,190,260);
g.drawLine(490,325,590,325);
g.drawLine(490,345,590,345);
g.drawLine(490,305,590,305);
g.drawLine(125,325,25,325);
g.drawLine(125,345,25,345);
g.drawLine(125,305,25,305);
g.drawString("HOME SWEET HOME",175,90);

}
}

output:

Sunday 15 June 2014

general Program to sow try catch statement

package sum;

import javax.swing.JOptionPane;

public class implementtryandcatch {

public static void main(String[] args) {
int a,b,c=0;
try
{
a=Integer.parseInt(JOptionPane.showInputDialog("enter  A:"));
b=Integer.parseInt(JOptionPane.showInputDialog("enter  B:"));
c=a/b;
}
catch (Exception p)
{
System.out.print(p.getMessage());
}
System.out.print("\ndivision="+c);
}

}

output:
enter A 5
enter B 0
/ by zero
division=0

Program to show Exception handling ( try and catch statement)

package sum;

import javax.swing.JOptionPane;

public class finallyaftercatch {

public static void main(String[] args) {
int a,b,c=0;
try
{
a=Integer.parseInt(JOptionPane.showInputDialog("enter  A:"));
b=Integer.parseInt(JOptionPane.showInputDialog("enter  B:"));
c=a/b;
}
catch (NumberFormatException p)
{
System.out.print("wrong value entered");
}
catch (ArithmeticException p)
{
System.out.print("denominator zero entered");
}
finally {
System.out.print("\ndivision="+c); }

}

}
 enter A 5
enter B 0
denominator zero entered
division=0

Program to show function overloading

import javax.swing.JOptionPane;

class over
{
int a,b;
public void in()
{
a=Integer.parseInt(JOptionPane.showInputDialog("enter  A:"));
b=Integer.parseInt(JOptionPane.showInputDialog("enter  B:"));

}
public void add()
{
int k=a+b;
System.out.print("\nsum="+k);
}
public void add(int k, int m)
{
int c=k+m;
System.out.print("\nsum="+c);
}
public int add(int q, int w, int e)
{
return (q+w+e);
}
}
public class overloading {

public static void main(String[] args) {
over t=new over();
t.in();
t.add();
t.add(2,4);
int l=t.add(1,2,3);
System.out.print("\nsum="+l);


}

}

output
enter a 2
enter b 3
sum=5
sum=6
sum=6

Program to show constructors in java

class A
{
int a,b,c;
public A() //default constructor
{
a=4;
b=5;
c=a*b;
System.out.print("into= "+c);
}
public A(int x, int y)  //parameterised constructor
{
c=x+y;
System.out.print("\nSUM= "+c);
}

}
public class consdes {

public static void main(String[] args) {
A t=new A();

A o=new A(1,2);

}

}

output:
into= 20
SUM= 3

Program to add two numbers in single inheritance

import javax.swing.JOptionPane;
 abstract class k
{
public int a,b;
public void show()
{
a=Integer.parseInt(JOptionPane.showInputDialog("enter  A:"));
b=Integer.parseInt(JOptionPane.showInputDialog("enter  B:"));

System.out.print("\nshow");
}
public int ret()
{
return (a);

}
public int urn()
{
return (b);
}
}
class l extends k
{
int sum;

public void in()
{
sum=a+b;
System.out.print("\nsum=" +sum);
System.out.print("\nin");
}
}
public class abs {

public static void main(String[] args) {

l n=new l();

n.show();
n.in();


}

}

output:
enter a 2
enter b 2
show
sum=4
in

Program to show single inheritance in java

class am
{
public void show()
{
System.out.print("\nshow");
}
}
class B extends am
{
public void in()
{
System.out.print("\nin");
}
}

public class Aaa {

public static void main(String[] args) {

am m=new am();
B n=new B();
m.show();
n.in();
n.show();
}
}
output:

show
in
show

Friday 13 June 2014

How to use java on ADT (android developer tool) kit

Java development overview
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of any Java application, including Eclipse plug-ins. It adds a Java project nature and Java perspective to the Eclipse Workbench as well as a number of views, editors, wizards, builders, and code merging and refactoring tools. The JDT project allows Eclipse to be a development environment for itself.

Preparing Eclipse

In this section, you will verify that Eclipse is properly set up for Java development.
The following is assumed:
  • You are starting with a new Eclipse installation with default settings.
  • You are familiar with the basic Eclipse workbench mechanisms, such as views and perspectives.

Verifying JRE installation and classpath variables

1.     If you still see the Eclipse Welcome page, click the arrow icon to begin using Eclipse.
2.     Select the menu item Description: Goto workbench preferencesWindow > Preferences... to open the workbench preferences. 
3.     Select the Description: Goto the installed JREs preference pageJava > Installed JREs preference page to display the installed Java Runtime Environments. Confirm that a JRE has been detected. By default, the JRE used to run the workbench will be used to build and run Java programs. It should appear with a checkmark in the list of installed JREs. We recommend that you use a Java SDK instead of a JRE. An SDK is designed for development and contains the source code for the Java library, easing debugging. Additional SDKs can be added by searching the hard drive for installed SDKs. To do so, simply click the Search... button and specify a root folder for the search.
If you work with code that does not yet use generics (as we do in this tutorial), we recommend that you install a Java SDK 1.4 as well, but leave the most recent version checked as default.


4.   Select the Description: Goto the workspace preference pageGeneral > Workspace preference page. Confirm that the Build automatically option is checked.
             5.     Select the Description: Goto the Java build path preference pageJava > Build Path preference page. Confirm that Source and                  output folder is set to Folders
             6.     Select the Description: Goto the Java editor preference pageJava > Editor preference page. Confirm that option Report                      problems as you type is checked. 
7.     Select the Description: Goto the Java compiler preference pageJava > Compiler preference page. Confirm that option Compiler compliance level matches your default JRE version (usually 1.6). 
8.     Click on OK to save the preferences. 






Understanding the workbench use and its features of ADT kit

The Workbench
When the Workbench is launched, the first thing you see is a dialog that allows you to select where the workspace should be located. The workspace is the directory where your work will be stored. For now, just click OK to pick the default location.
After the workspace location is chosen, a single Workbench window is displayed. A Workbench window offers one or more perspectives. A perspective contains editors and views, such as the Project Explorer. Multiple Workbench windows can be opened simultaneously. Initially, in the first Workbench window that is opened, the Java perspective is displayed, with only the Welcome view visible. Click the arrow labeled Workbench in the Welcome view to cause the other views in the perspective to become visible. Note you can get the Welcome view back at any time by selecting Description: command linkHelp > Welcome.
A shortcut bar appears in the top right corner of the window. This allows you to open new perspectives and switch between ones already open. The name of the active perspective is shown in the title of the window and its item in the shortcut bar is highlighted.

You should be seeing the Java perspective. We will switch to the simpler Resource perspective to simplify this tutorial. Select Description: command linkWindow > Open Perspective > Other... > Resource. The Project Explorer, Outline, and Tasks views should now be visible.
Editors

Depending on the type of file that is being edited, the appropriate editor is displayed in the editor area. For example, if a .TXT file is being edited, a text editor is displayed in the editor area. The figure below shows an editor open on the file file1.txt. The name of the file appears in the tab of the editor. An asterisk (*) appearing at the left side of the tab indicates that the editor has unsaved changes. If an attempt is made to close the editor or exit the Workbench with unsaved changes, a prompt to save the editor's changes will appear.
When an editor is active, the Workbench menu bar and toolbar contain operations applicable to the editor. When a view becomes active, the editor operations are disabled. However, certain operations may be appropriate in the context of a view and will remain enabled.
The editors can be stacked in the editor area and individual editors can be activated by clicking the tab for the editor. Editors can also be tiled side-by-side in the editor area so their content can be viewed simultaneously. In the figure below, editors for JanesFile.txt and JanesFile2.txt have been placed above the editor for JanesText.txt. Instructions will be given later in this tutorial explaining how to rearrange views and editors.
If a resource does not have an associated editor, the Workbench will attempt to launch an external editor registered with the platform. These external editors are not tightly integrated with the Workbench and are not embedded in the Workbench's editor area.
Editors can be cycled through using the back and forward arrow buttons in the toolbar. These move through the last mouse selection points and permit moving through several points in a file before moving to another one. Additionally, editors can be cycled by using the Ctrl+F6 accelerator (Command+F6 on the Macintosh). Ctrl+F6 pops up a list of currently open editors. By default, the list will have selected the editor used before the current one, allowing you to easily go back to the previous editor.
Description: Windows onlyOn Windows, if the associated editor is an external editor, the Workbench may attempt to launch the editor in-place as an OLE document editor. For example, editing a DOC file will cause Microsoft Word to be opened in-place within the Workbench if Microsoft Word is installed on the machine. If Microsoft Word has not been installed, Word Pad will open instead.

Views

The primary use of Views is to provide navigation of the information in the Workbench. For example:
  • The Bookmarks view displays all bookmarks in the Workbench along with the names of the files with which the bookmarks are associated.
  • The Project Explorer view displays the Workbench projects, their folders and files.
A view might appear by itself or stacked with other views in a tabbed notebook.  

To activate a view that is part of a tabbed notebook simply click its tab.
Views have two menus. The first, which is accessed by right clicking on the view's tab, allows the view to be manipulated in much the same manner as the menu associated with the Workbench window.


 The second menu, called the "view pull-down menu", is accessed by clicking the down arrow Description: View down arrow. The view pull-down menu typically contains operations that apply to the entire contents of the view, but not to a specific item shown in the view. Operations for sorting and filtering are commonly found in the view pull-down. 
A view can be displayed by selecting it from the Window > Show View menu. A perspective determines which views may be required and displays these on the Show View sub-menu. Additional views are available by choosing Description: command linkOther... at the bottom of the Show View sub-menu. This is just one of the many features that provide for the creation of a custom work environment.
Through the normal course of using the Workbench you will open, move, resize, and close views. If you'd like to restore the perspective back to its original state, you can select the Window > Reset Perspective menu operation.