import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
// <applet code=internalframe.class width=400 height=400></applet>
public class internalframe extends JApplet implements ActionListener {
JDesktopPane d=new JDesktopPane(); JTextField j;JPanel p; JButton b;
static int frameno=1;
public void init()
{
p=new JPanel();
j=new JTextField(20);
p.setBackground(Color.magenta);
Container contentPane=getContentPane();
JButton b=new JButton("click to open another frame");
b.addActionListener(this);
p.add(j);
p.add(b);
contentPane.add(p,BorderLayout.SOUTH);
contentPane.add(d,BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==b)
{
String name=j.getText();
if(name.length()==0)
{
JOptionPane.showMessageDialog(internalframe.this,"You didn�t enter anything!","moron",
JOptionPane.INFORMATION_MESSAGE);
}
else
{
JOptionPane.showMessageDialog(internalframe.this,"Hello!" + name,"Salutations",
JOptionPane.INFORMATION_MESSAGE);
}
j.requestFocus();
}
JInternalFrame fr=new JInternalFrame();
Container contentPane=fr.getContentPane();
fr.setLocation(20,20);
fr.setResizable(true);
fr.setTitle("Frame "+frameno);
frameno++;
fr.setClosable(true);
fr.setIconifiable(true);
fr.setClosable(true);
fr.setMaximizable(true);
fr.setVisible(true);
contentPane.setLayout(new FlowLayout());
contentPane.add(new JLabel("welcome"),"North");
contentPane.add(j,"centre");
fr.pack();
d.add(fr,2);
}
public void paint(Graphics g) {
}
}
Subscribe to:
Post Comments (Atom)
Popular Posts
-
Hi folks, I got a chance to work with JSF, it was an interesting requirement. Its about a custom component which would be of more use to ...
-
Hi Folks, I would like to share my another POC task in JSF with you all. "Primefaces Dropdown with Pagination & Filter "...
-
We shall create temp table in mysql using the sql script CREATE TEMPORARY TABLE testraghu(name VARCHAR(50) , phone VARCHAR(50)) Let us se...
-
Hi all, i would like to share a simple example of storing haspmap in mysql db. In order to store object into your db, the field type must ...
No comments:
Post a Comment