Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

regarding dialog.

 
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
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic