java

java

View Answers

September 17, 2009 at 2:34 PM

Hi Friend,

Please send servicelistpath.txt and servicelist.txt.
Do you want to set the path to the tabbed pane in OperatingSystem.java file?

Thanks

September 17, 2009 at 5:35 PM

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









Related Tutorials/Questions & Answers:
java
java  diff bt core java and java
java
java  what is java
Advertisements
java
java   why iterator in java if we for loop
Java
Java   Whether Java is pure object oriented Language
JAVA
JAVA  how the name came for java language as "JAVA
java
java  explain technologies are used in java now days and structure java
java
java  different between java & core java
java
java  is java open source
java
java  what is java reflection
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java  why to set classpath in java
java
java  RARP implementation using java socket
java
java  sample code for RARP using java
Java
Java  how to do java in command prompt
java
java  how use java method
java
java  is java purely object oriented language
java
java  why multiple inheritance is not possible in java
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java   What is ?static? keyword
java
java  Does java allows multiline comments
java
java  Write a java code to print "ABABBABCABABBA
java
java  write a program in java to acess the email
java
java  send me java interview questions
java
java  what are JAVA applications development tools
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  explain object oriented concept in java
java
java   difference between class and interface
Java
Java  how to draw class diagrams in java
java
java  write a java program using filenotfoundexception
java
java  how to edit text document by using java then how to edit starting and ending of text document by using java
java
java  different between java & core java print("code sample
java
java  how can use sleep in java   which book learn of java language
java
java  hi im new to java plz suggest me how to master java[email protected]
java
java   How to set java Policy for applet using jdk 6
java
java pattern code for a given words  java pattern code for a given words pattern
java
java  dear, i want a field for date picker using java/java script
java
java  create java program for delete and update the details,without using database, just a normal java program
java
java  why methods in java raise exceptions   Have a look at the following link: Java Exceptions
java
java code to search the nodes  how to write the java code to search the nodes using routers
java
java online telephone directory  i need coding for online telephone directory..by using java....pls help me
java
java  different between java & core java print("code sample
java
java  how to invoke one chart java file from another java file
java
java  how to prepare the java   Hi Friend, If you want to learn how to install java, creating and running a java program then go through the following links: http://www.roseindia.net/java/beginners/index.shtml http
java
java  java swing   Swing is a principal GUI toolkit for the Java programming language. It is a part of the JFC (Java Foundation Classes), which is an API for providing a graphical user interface for Java programs
java
java  what is the need of java if java is not there what will happen... work unless you have Java installed, and more are created every day. Java... to scientific supercomputers, cell phones to the Internet, Java is everywhere! http

Ads