• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding dialog.

 
mnsvPrasad
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am Using the Dialog class in theApplet to give some message.
for that i am doing like this
import java.awt.*;
import java.awt.event.*;
import java.applet.*;

public class MyApp extends Applet implements ActionListener
{
private java.awt.Button OkBut = null;
private java.awt.Label lblMessage =null;
private java.awt.Panel MessagePane = null;
private java.awt.Dialog AppletDlg = null;
Button b;
public void init(){
setLayout(null);
b = new Button("Click me");
b.setBounds(100,100,100,25);
b.addActionListener(this);
add(b);
getOkBut().addActionListener(this);
}
public void actionPerformed(ActionEvent ae){
if(ae.getSource() == b){
getDialog().show();
}
if(ae.getSource() == getOkBut()){
getDialog().dispose();
}

}
private java.awt.Button getOkBut() {
if (OkBut == null) {
try {
OkBut = new java.awt.Button();
OkBut.setBounds(110, 40, 50, 25);
OkBut.setLabel("OK");
}catch (java.lang.Throwable ivjExc) {
}
}
return OkBut;
}
private java.awt.Label getMsgLabel() {
if (lblMessage == null) {
try {
lblMessage = new java.awt.Label();
lblMessage.setBounds(0, 10, 275, 25);
lblMessage.setAlignment(Label.CENTER);
lblMessage.setText("Sample Message");
} catch (java.lang.Throwable ivjExc) {
}
}
return lblMessage;
}

private java.awt.Panel getContentsPane() {
if (MessagePane == null) {
try {
MessagePane = new java.awt.Panel();
MessagePane.setName("ContentsPane");
MessagePane.setLayout(null);
getContentsPane().add(getOkBut());
getContentsPane().add(getMsgLabel());
} catch (java.lang.Throwable ivjExc) {
}
}
return MessagePane;
}
private java.awt.Dialog getDialog() {
if (AppletDlg == null) {
try {
AppletDlg = new java.awt.Dialog(new java.awt.Frame());AppletDlg.setName("Dialog1");
AppletDlg.setLayout(new java.awt.BorderLayout());
AppletDlg.setBounds(200, 200,275, 125);
AppletDlg.setResizable(false);
AppletDlg.setModal(true);
getDialog().setTitle("Applet Message");
getDialog().add(getContentsPane(), "Center");
getDialog().addWindowListener(new DialogHandler(AppletDlg));
} catch (java.lang.Throwable Ex) {
}
}
return AppletDlg;
}
class DialogHandler extends WindowAdapter {
Dialog d;
DialogHandler(java.awt.Dialog d){
this.d = d;
}
public void windowClosing(WindowEvent e){
getDialog().dispose();
}
}
}
in this i am adding one Button and a Label to the Dialog.
and i am showing the dialog Like this " getDialog().show()" but
in IE it is giving some warning like Warning : AppletWindow, and
in Netscape it is giving some warning like "SignedBy: Unsigned classes from local hard disk"
How to remove these Warnings?
Sir if you respond Immediately it will be very helpful to me
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic