I want to add another Page to my Applet when clicked Submit, and to be clear need to retrieve data from the server where data is logs. please let me know what shall i do.
package com.stage.logs;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.applet.*;
import javax.swing.*;
import javax.swing.plaf.TextUI;
public abstract class LogViewerDatabase extends Applet implements ActionListener {
/**
*
*/
//private static final long serialVersionUID = 1L;
String str = "", str1 ="" ;
Object x[];
JLabel n,a,i,lbl;
JTextArea LogValue;
JList<?> server;
JButton b1,b2;
Container c;
private ActionListener iframe;
public void init(){
//Create JFrame and Container
JFrame jf = new JFrame();
c=jf.getContentPane();
//display white background color in container
c.setBackground(Color.white);
//donot set any layout to c
c.setLayout(null);
//display the frame
jf.setVisible(true);
//set the size and title
jf.setSize(500, 400);
jf.setTitle("LogViewer Database");
//display the heading in the frame using the label
Font f = new Font("Dialog", Font.BOLD,24);
lbl = new JLabel();
lbl.setFont(f);
lbl.setForeground(Color.red);
lbl.setText("LogViewer Database");
lbl.setBounds(200,10,500,50);
c.add(lbl);
//Text Area and a lable for entering Log Value
a=new JLabel("LogValue:",JLabel.LEFT);
LogValue = new JTextArea(5,10);
a.setBounds(50,150,100,30);
LogValue.setBounds(200,150,200,100);
c.add(a);
c.add(LogValue);
//List box for selecting Server
i = new JLabel("Select Server",JLabel.LEFT);
String[] data = {"Auth-Server 1", "Auth-Server 2","App-Server 1","App-Server 2"};
server = new JList<Object>(data);
i.setBounds(50,70,100,30);
server.setBounds(200,270,200,100);
c.add(i);
c.add(server);
//add push button: Submit
b1 = new JButton("Submit");
b2 = new JButton("Clear");
b1.setBounds(200,400,100,30);
b2.setBounds(350,400,100,30);
c.add(b1);
c.add(b2);
//add listeners to buttons
b1.addActionListener(iframe);
b2.addActionListener(this);
}
//this method is executed when the button is clicked
public void actionperformed(ActionEvent ae)
{
//Know which button is clicked
str = ae.getActionCommand();
//if the button label Submit is clicked
if(str.equals("submit"))
{
str1=LogValue.getText()+"\n";
x = server.getContainerListeners();
LogValue.setUI((TextUI) iframe);
}
else {
LogValue.setText("");
server.clearSelection();
}
}
}