Thanks for your kindly reply.
I got the output.
How to set the bounds,i will send the code ,can u set the bounds for the textbox and labels for the first tab(OS Verify)only.
this is my code,please set the bounds ...
package com.zsl.swing.mq;
import java.awt.Color;
import java.awt.GridLayout;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
class OSInformation extends JPanel
{
/**
*
*/
private static final long serialVersionUID = 752052456706205768L;
public OSInformation()
{
JLabel osname, osversion, osarchitecture, javapathname, javalibrarypath, javatemppath;
JTextField osnametext,ostextversion,ostextarch,javatextpath,javatextlibrary,javatemptextpath;
osname = new JLabel("Opearting System Name");
osnametext = new JTextField(25);
osnametext.setEditable(false);
String osName = System.getProperty("os.name");
osnametext.setText(osName);
osversion = new JLabel(" Opearting System Version");
ostextversion = new JTextField(25);
ostextversion.setEditable(false);
String osVersion = System.getProperty("os.version");
ostextversion.setText(osVersion);
osarchitecture = new JLabel(" Opearting System Architecture");
ostextarch = new JTextField(25);
ostextarch.setEditable(false);
String osType = System.getProperty("os.arch");
ostextarch.setText(osType);
javapathname = new JLabel(" Java Path");
javatextpath = new JTextField(25);
javatextpath.setEditable(false);
String jPathName = System.getProperty("java.home");
javatextpath.setText(jPathName);
javalibrarypath = new JLabel("Java Library Path");
javatextlibrary = new JTextField(25);
javatextlibrary.setEditable(false);
String jlibraryPath = System.getProperty("java.library.path");
javatextlibrary.setText(jlibraryPath);
javatemppath = new JLabel("Java Temp Directory");
javatemptextpath = new JTextField(25);
javatemptextpath.setEditable(false);
String jTempPath = System.getProperty("java.io.tmpdir");
javatemptextpath.setText(jTempPath);
add(osname);
add(osnametext);
osname.setBounds(10, 50, 50, 50);
osnametext.setBounds(350, 90, 50, 50);
add(osversion);
add(ostextversion);
osversion.setBounds(10, 250, 50, 50);
ostextversion.setBounds(350, 90, 150, 30);
add(osarchitecture);
add(ostextarch);
add(javapathname);
add(javatextpath);
add(javalibrarypath);
add(javatextlibrary);
add(javatemppath);
add(javatemptextpath);
setBackground(Color.GRAY);
}
}
class JBossServerInformation extends JPanel
{
/**
*
*/
JLabel jbosshostname,jbossportno,jbosspath,jbossstatus;
JTextField jbosstexthostname,jbosstextportno,jbosstextpath,jbosstextstatus;
int serpos=0;
private static final long serialVersionUID = 5717171480546865982L;
public JBossServerInformation()
{
String searchText = "java.exe";
StringBuilder sb =new StringBuilder();
Map<String, String> env = System.getenv();
for (String envName : env.keySet()) {
// System.out.format("%s=%s%n", envName, env.get(envName));
}
try
{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(new String[]{"cmd","/c","start C:\\toolserver.bat"});
// System.out.println("Process exitValue: " + proc.hashCode());
} catch (Throwable t)
{
t.printStackTrace();
}
try
{
URL url = new URL("
http://localhost:8080/jmx-console/";);
URLConnection connection = url.openConnection();
// System.out.println("Content type " + connection.getContentType());
if( !( connection.getContentType() != null))
{
//System.out.println("JBOSS SERVER IS NOT STARTED");
}
}
catch (Exception e)
{
System.out.println(e.toString());
}
String fileName = "c:\\tasklistservice.txt";
try {
BufferedReader reader =
new BufferedReader(
new FileReader(fileName));
//Reads until the end-of-file met
while (reader.ready()) {
//Read line-by-line directly
sb.append(reader.readLine());
}
}
catch(IOException ex) {
ex.printStackTrace();
}
String fileText = sb.toString();
// System.out.println(fileText.length());
// System.out.println("Search Position in file is : " +fileText.indexOf(searchText));
serpos = fileText.indexOf(searchText);
if (serpos > 0)
{
System.out.println("JBOSS Server is started");
}
else
{
System.out.println("JBOSS Server is NOT started");
}
jbosshostname = new JLabel(" JBoss Server HostName");
jbosstexthostname = new JTextField(20);
jbosstexthostname.setEditable(true);
jbosstexthostname.setText("");
jbossportno = new JLabel(" JBoss Server PortNumber");
jbosstextportno = new JTextField(20);
jbosstextportno.setEditable(true);
jbosstextportno.setText("");
jbosspath = new JLabel(" JBoss Server Path");
jbosstextpath = new JTextField(20);
jbosstextpath.setEditable(true);
jbosstextpath.setText("");
jbossstatus = new JLabel(" JBoss Server Status");
jbosstextstatus = new JTextField(20);
jbosstextstatus.setEditable(false);
jbosstextstatus.setText("");
add(jbosshostname);
add(jbosstexthostname);
jbosshostname.setBounds(30, 50, 50, 50);
jbosstexthostname.setBounds(250, 90, 125, 30);
add(jbossportno);
add(jbosstextportno);
jbossportno.setBounds(30, 50, 50, 50);
jbosstextportno.setBounds(250, 90, 125, 30);
add(jbosspath);
add(jbosstextpath);
jbosspath.setBounds(30, 50, 50, 50);
jbosstextpath.setBounds(250, 90, 125, 30);
add(jbossstatus);
add(jbosstextstatus);
jbossstatus.setBounds(30, 50, 50, 50);
jbosstextstatus.setBounds(250, 90, 125, 30);
}
}
public class ActiveMQSwing extends JPanel{
/**
*
*/
private static final long serialVersionUID = -4184537838529955448L;
JLabel ibmmqstatus,mqserverstatus,mqserverpath;
JTextField ibmmqtextstatus,mqservertextstatus,mqservertextpath;
String status;
public ActiveMQSwing()
{
String searchText = "MQSeriesServices";
String searchText2 = (char)34 + "C:";
StringBuilder sb =new StringBuilder();
String fileName = "c:\\servicelist.txt";
try {
BufferedReader reader = new BufferedReader( new FileReader(fileName));
//Reads until the end-of-file met
while (reader.ready()) {
//Read line-by-line directly
sb.append(reader.readLine());
}
}
catch(IOException ex) {
ex.printStackTrace();
}
String fileText = sb.toString();
int serpos = fileText.indexOf(searchText);
if (serpos > 0)
{
try
{
FileInputStream fstream = new FileInputStream("c:\\servicelistpath.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringBuffer str = new StringBuffer();
String strLine;
while ((strLine = br.readLine()) != null) {
str.append(strLine);
}
int startpoint = str.indexOf(searchText2);
String substr = str.substring(startpoint+1,str.toString().length());
status="MQSeriesServices Started" ;
mqserverpath = new JLabel(" MQ Server Path");
mqservertextpath = new JTextField(20);
mqservertextpath.setEditable(false);
String path = substr.substring(0, 48);
mqservertextpath.setText(path);
in.close();
}
catch (Exception e){
System.err.println("Error: " + e.getMessage());
}
catch (Throwable t)
{
t.printStackTrace();
}
}
else
{
status="MQSeriesServices Stopped" ;
System.out.println("MQSeriesServices is not present");
}
mqserverstatus = new JLabel(" MQ Server Status");
mqservertextstatus = new JTextField(20);
mqservertextstatus.setEditable(false);
mqservertextstatus.setText(status);
add(mqserverpath);
add(mqservertextpath);
mqserverpath.setBounds(30, 50, 50, 50);
mqservertextpath.setBounds(250, 90, 125, 30);
add(mqserverstatus);
add(mqservertextstatus);
mqserverstatus.setBounds(30, 130, 100, 100);
mqservertextstatus.setBounds(250, 120, 125, 30);
setBackground(Color.GRAY);
}
public static void main(String[] args) {
JFrame frame = new JFrame();
JTabbedPane pane = new JTabbedPane();
pane.add("OS Verify" ,new OSInformation());
pane.add("MQServer Verify" ,new ActiveMQSwing());
//pane.add("JBossServer Verify", new JBossServerInformation());
frame.getContentPane().add(pane);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.setVisible(true);
frame.setTitle("ACTIVE MQ - IBM MQ TOOL");
frame.setResizable(false);
frame.setBounds(250, 250, 500, 500);
}
}
Thanks
Valarmathi