Advance Java Sem 5
Advance Java Sem 5
ADVANCE JAVA
Method
showInputDialog
Description
prompt for input
showMessageDialog
display a message
showConfirmDialog
JOptionPane
Display information
SEM 5
ADVANCE JAVA
SEM 5
ADVANCE JAVA
E.Explain JScrollBar and identify the difference between JscrollBar and JscrollPane.
-> JScrollBar-The class JScrollBar is an implementation of scrollbar.
ConstructorJScrollBar-Creates a vertical scrollbar with the following initial values:
JScrollBar(int orientation)- Creates a scrollbar with the specified orientation and
the following initial values:
MethodcreateHorizontalScrollBar()-Returns a JScrollPane.ScrollBar by default.
createVerticalScrollBar()-Returns a JScrollPane.ScrollBar by default.
JscrollBar
Scrollbar is a component
scrollbar cannot have a scrollpane.
JscrollPane.
Scrollpane is a container
ScrollPane can have a scrollbar
SEM 5
ADVANCE JAVA
SEM 5
ADVANCE JAVA
API SpecificationThe Java Print Service API consists of these four packages:
javax.print:
Provides the principal classes and interfaces for the Java Print Service API.
javax.print.attribute:
Provides classes and interfaces that describe the types of Java Print Service
attributes and how they can be collected into attribute sets.
javax.print.attribute.standard:
Contains classes defining specific printing attributes.
javax.print.event:
Contains event classes and listener interfaces for monitoring print services and
the progress of a specific print job.
SEM 5
ADVANCE JAVA
SEM 5
ADVANCE JAVA
wait() tells calling thread to give up monitor and go to sleep until some
other thread enters the same monitor and call notify.
notifyAll() wakes up all the thread that called wait() on same object.
SEM 5
ADVANCE JAVA
getConnection(String url)
Here each form requires a database URL. A database URL is an address that
points to your database.
2)Conection.createStatement()-
SEM 5
ADVANCE JAVA
SEM 5
ADVANCE JAVA
SDP support is disabled by default. The steps to enable SDP support are:
Set the system property that specifies the location of the configuration file.
SEM 5
ADVANCE JAVA
SEM 5
ADVANCE JAVA
Exampleimport javax.swing.*;
import java.awt.*;
class JDialogExample extends JFrame
{
JDialog d1;
public JDialogExample()
{
createAndShowGUI();
}
SEM 5
ADVANCE JAVA
// Set size
d1.setSize(400,400);
d1.add(new JButton("Button"));
d1.add(new JLabel("Label"));
d1.add(new JTextField(20));
setSize(400,400);
setVisible(true);
SEM 5
ADVANCE JAVA
new JDialogExample();
}
}
SEM 5
ADVANCE JAVA
This class is thread-safe i.e multiple threads can share a single Timer
object without the need for external synchronization.
SEM 5
ADVANCE JAVA
D.What are the step involved in creating and running RMI programs.
->
RMI
application
can
be
divided
A Server program
into
creates
two
some
part,Client program
remote
object,
A Clientprogram make request for remote objects on server and invoke method
on them. Stub and Skeleton are two important object used for communication
with remote object.
Steps for Creating a RMI program
SEM 5
ADVANCE JAVA
Steps for running a RMI programYou are running both the Server and Client programs on the same machine:
set path=C:\j2sdk1.4.0-rc\bin
Step 1: compile all the java programs
1) javac addserverintf.java
2) javac addserverimpl.java
3) javac addclient.java
4) javac addserver.java
Step 2: Generate stubs and skeleton
> rmic addserverimpl
Step 3: start the rmiregistry
> start rmiregistry [A new blank window will be generated]
Step 4: In a new window
> java addserver
Step 5: In another window
> java addclient 127.0.0.1 4 5
SEM 5
ADVANCE JAVA