Skip to main content

Posts

Showing posts from February, 2016

Button class in java

                          button class                                              Button class: This class is used to create the command button, which is used to initiate the particular action. The constructors of the Button class: a)   Button() b)   Button(String s) Button() : This constructor is used to create the command button with not caption on it( caption is the information which is displayed over the command button) Button(String s): This constructor is used to create the command button with s as a caption on it. Methods: 1. setLabel()This method is used to set the information which we want to display over the command button i.e. its caption   The general form of the method is ,   void setLabel(String s)  where ,  ...

label class example

                    label class example PROGRAM-1 import java.applet.*; import java.awt.*; /* <applet code="LabelDemo" height=200 width=200> </applet> */ public class LabelDemo extends Applet {             public void init()             {                         Label L1=new Label("BMB",Label.LEFT);                         add(L1);                         Label L2=new Label("PNT",Label.RIGHT);         ...

label class

                         Label class 1. Label class: A Label object is a component for placing text in a container. A label displays a single line of read-only text. The text can be changed by the application, but a user cannot edit it directly. The label control is used to display the information on the applet or a dialog box or a window.It is not editable by the user. We can set information on it only via code. Constructors of Label class : (a) Label()                         This constructor is used to create the blank label (b) Label(String s)             This constructor is used to create the label and s which is the String class object will specify the information to be displayed over the Label class object. (c) Label(String s,int al...

change background & foreground color

                                             background  & foreground color PROGRAM import java.applet.*; import java.awt.*; /*             <applet code="StatusWindow" height=200 width=200>             </applet> */ public class StatusWindow extends Applet {             public void init()             {                         setBackground(Color.BLUE);                     ...

Simple Applet Display Method

               Simple Applet Display Method AWT : The AWT make use of the Container class which is the super base class for all the classes of the package java.awt. Basically it provides the method add() to add the component on the applet The general form will be                                          add(object); If we add the component to the applet window then only it can be we visible on the applet. Simple Applet Display Method:                                     setBackground(Color.newColor);              ...

Difference b/w c++ and java

                  Difference b/w c++ and java Java C++ Java does not support pointers, templates, unions, operator overloading, structures etc.  The Java language promoters initially said "No pointers!", but when many programmers questioned how you can work without pointers, the promoters began saying "Restricted pointers." Java supports what it calls "references". References act a lot like pointers in C++ languages but you cannot perform arithmetic on pointers in Java. References have types, and they're type-safe. These references cannot be interpreted as raw address and unsafe conversion is not allowed. C++ supports structures, unions, templates, operator overloading, pointers and pointer arithmetic. Java support automatic garbage collection. It does not support destructors as C++ does. C++ support destructors, which is automatically invoked when the object is destroyed. Java does not support conditional compilation and inclu...

difference b/w awt and swing

            difference b/w awt and swing AWT Swing AWT stands for Abstract windows toolkit. Swing is also called as JFC’s (Java Foundation classes). AWT components are called Heavyweight component. Swings are called light weight component because swing components sits on the top of AWT components and do the work. AWT components require java.awt package. Swing components require javax.swing package. AWT components are platform dependent. Swing components are made in purely java and they are platform independent. This feature is not supported in AWT. We can have different look and feel in Swing. These feature is not available in AWT. Swing has many advanced features like JTabel, Jtabbed pane which is not available in AWT. Also. Swing components are called "lightweight" because they do not require a native OS object to implement their functionality. JDialog and JFrame are heavyweight, because they do have a peer. So components like JButton, JTextAre...