Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


valarmathi
java swings
2 Answer(s)      5 years and 2 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 1, 2009 at 3:21 PM


Hi Friend,

import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

public class migration extends JPanel implements ActionListener {

private static final long serialVersionUID = 6877636757727044238L;
JList jbossactivemqlist, jbossibmmqlist;
JLabel jbossactivemqlabel,jbossibmmqlabel;
JButton jbossaddbutton;
JTextField jbossText;
DefaultListModel jbossactivemqlistmodel, jbossibmmqlistmodel;
String searchText3 = (char) 34 + "";
String substringofqueue[] = new String[50];
StringBuffer displayqmrlist = new StringBuffer();
String substringofqueuetemp = null;
String st="";
ArrayList<Object> selected1;
Object selected2[];
String substr = null;
String substrloop = null;
public migration() throws SAXException, IOException {
setLayout(null);
jbossactivemqlistmodel = new DefaultListModel();
jbossibmmqlistmodel = new DefaultListModel();
jbossibmmqlist = new JList(jbossibmmqlistmodel);
jbossaddbutton = new JButton(">>");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
Document doc = builder.parse("c:\\jbossmq-destinations-service.xml");
Element root = doc.getDocumentElement();
StringBuilder strbuf = new StringBuilder();
NodeList list = doc.getElementsByTagName("mbean");
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
String str = node.getAttributes().getNamedItem("name").toString();
int startpoint = str.indexOf("Queue,name");
jbossactivemqlist = new JList();
if (startpoint > 0) {
String substr = str.substring(startpoint, str.toString().length());
int startpointnextlevel = substr.indexOf("name=");
substringofqueuetemp = substr.substring(startpointnextlevel + 5, substr.toString().length() - 1);
substringofqueue[i] = substringofqueuetemp;
}
}
jbossactivemqlabel = new JLabel("Active MQ");
add(jbossactivemqlabel);
jbossactivemqlabel.setBounds(50, 50, 160, 14);
jbossactivemqlist.setListData(substringofqueue);
JScrollPane jbossactivemqscrollPane = new JScrollPane(jbossactivemqlist);
jbossactivemqscrollPane.setBounds(40, 80, 160, 150);
add(jbossactivemqscrollPane);
add(jbossaddbutton);
jbossaddbutton.setBounds(220, 140, 50, 20);
jbossibmmqlabel = new JLabel("IBM MQ");
add(jbossibmmqlabel);
jbossibmmqlabel.setBounds(310, 50, 160, 14);
jbossibmmqlist = new JList();
JScrollPane jbossibmmqscrollpane = new JScrollPane(jbossibmmqlist);
jbossibmmqscrollpane.setBounds(290, 80, 160, 150);
add(jbossibmmqscrollpane);
setVisible(true);
jbossaddbutton.addActionListener(this);
selected1 = new ArrayList<Object>();
selected2 = new Object[50];
}


October 1, 2009 at 3:22 PM


continue.................

public void actionPerformed(ActionEvent ae) {
try {
Runtime rt1 = Runtime.getRuntime();
//Process proc1 = rt1.exec(new String[] { "cmd", "/c","start C:\\zconnqmanager.bat" });
} catch (Throwable t) {
t.printStackTrace();
}
String fileName = "qmanager.txt";
try {
StringBuilder sb = new StringBuilder();
String sbb = null;
StringBuilder sb1 = new StringBuilder();
BufferedReader reader = new BufferedReader(new FileReader(fileName));
while (reader.ready()) {
sb.append(reader.readLine());
}
substrloop = sb.toString();
int oddnumber = 0;
int increment = 0;
while (substrloop.length() > 0) {
int serpos = substrloop.toString().indexOf("(");
int str = substrloop.toString().indexOf(")");
if (oddnumber == 0) {
substr = substrloop.substring(serpos + 1, str);
System.out.println("QName = " + substr);
substrloop = substrloop.substring(str + 1, substrloop.toString().length());
oddnumber = oddnumber + 1;
} else {
String substr1 = substrloop.substring(serpos + 1, str);
System.out.println("Status = " + substr1);
if (substr1.equals("Running")) {
System.out.println("Running Queue name:" + substr);
displayqmrlist.append(substr +"\n");
increment ++;
}
substrloop = substrloop.substring(str + 1, substrloop.toString().length());
oddnumber = oddnumber - 1;
}
}
st= displayqmrlist.toString();
System.out.println("Test by valar- string" +st);
} catch (IOException ex) {
ex.printStackTrace();
}
Object selected[] = jbossactivemqlist.getSelectedValues();
for (int j = 0; j < selected.length; j++) {
selected1.add(selected[j]);
}
for (int i = 0; i < selected1.size(); i++) {
selected2[i] = selected1.get(i);
}
if( jbossactivemqlist.getSelectedValues().equals(selected.length)){
jbossactivemqlist.setEnabled(false);
}
jbossibmmqlist.setListData(selected2);
String[] arr=st.split("\n");
for(int i=0;i<arr.length;i++) {
System.out.println("array"+i+" :"+arr[i]);
}
JOptionPane.showInputDialog(jbossaddbutton, "Select the Queue Manager Name", "Queue Manager Name",
JOptionPane.PLAIN_MESSAGE, null, arr, "Joe");
String str = ae.getActionCommand();
if (str.equals(">>")) {
JOptionPane.showMessageDialog(jbossaddbutton,
"Succesfully moved the Value", "Migration Queue", 1);
}
}
public static void main(String[] args) throws SAXException, IOException {
JFrame frame = new JFrame();
JTabbedPane pane = new JTabbedPane();
pane.add("JBoss Queue", new migration());
pane.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 12));
pane.setBackground(Color.decode("#99FFFF"));
frame.getContentPane().add(pane);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.setVisible(true);
Image icon = Toolkit.getDefaultToolkit().getImage("e:\\zylog_logo.gif");
frame.setIconImage(icon);
frame.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 12));
frame.setTitle("ACTIVE MQ - IBM MQ TOOL");
frame.setResizable(false);
frame.setBounds(250, 250, 500, 500);
}
}
Thanks


Related Tutorials/Questions & Answers:
Java Swings
Java Swings  I am doing one project on java Swings, in this i have created one jframe where i defined some JButtons and Jcombobox's, here i need to insert one JTable with headers(IN CURRENT JFrame only).pls help me urgently
java swings - Java Beginners
java swings   Do you want to add textfields on the JPanel
Advertisements
java swings - Java Beginners
java swings   Hi, I need the code for click the refresh button then list values will be refresh.Please send the code ........... Thanks, Valarmathi
java swings
java swings  hi... I am having multiple swing forms.. when i click on a button another form is going to opening but it is opening as different form... Now i want it to be open dynamically instead separately.... Is there any
java swings
java swings  Hi, I need a sample code for once click the exit tab the frame window will be closed. Instead of button close i need tab close option.Please send the sample code immediately.......?Its very urgent........ Thanks
java swings
java swings  how can we use the shared locks of dbms in java? I am working on a mini project which is based on the eamcet councilling .i am struck with a problem where if a student select a college and a branch and sees
java swings
java swings  Hi, I have one class file using three panel methods,the three methods is used for three tabs.then how can i set the background image.Please send the sample code for me. I already posted two questions,but i didnt get
java swings
java swings  Hi, I need the sample code for how to set the background image using jframe and also set the jtext field and jlable boxes under the bachground image. Please send the code immediately,its very urgent.Please send me
java code using swings
java code using swings  code that should be able to enter data of student details using all swings into the access database using jdbc connectivity
java swings - Java Beginners
java swings   Hi, I need the code for joptionpane with jcombobox. my requirement is click on add button,one joptionpane will come.from the option pane i need to select the combobox values. Please send the sample code
about swings - Java Beginners
about swings   Dear sir,Good evening, i am doing mca sir,i am doing the project in swings,so plz provide the material about swings sir...: http://www.roseindia.net/java/example/java/swing/ Hope
java swings - Java Beginners
java swings   Hi, I already posted the question for three times.... I have two listboxes.If i select first value in the first listbox and moved to second listbox.The next time the same value will not able to move the first
java swings - Swing AWT
write the code for bar charts using java swings.  Hi friend, I am...java swings  I am doing a project for my company. I need a to show.... http://www.roseindia.net/java/example/java/swing/draw-simple-bar
java swings - Java Beginners
java swings   Hi, I have two classes(two tabbed panes). how can i get the one class jtextfield value into another class method. Please send the code as sson as possible. Thanks, Valarmathi  Hi Friend, Try
java swings - JavaMail
java swings  Hi sir,i am doing a project on swings,i don't have any...://www.roseindia.net/java/example/java/swing/GrideComponents.shtml http://www.roseindia.net/java/example/java/swing/AbsCoordinate.shtml http://www.roseindia.net
java swings - Java Beginners
java swings   Hi, This is my code. How can i set the jtextfield...", Font.BOLD, 12)); javapathname = new JLabel("Java Path"); javatextpath = new JTextField(33); javatextpath.setToolTipText("Java Installation Path
java swings - Java Beginners
java swings   Hi , I have two listboxes.I want to move one listbox... correct the value and send it to me. This is my java code package...,because place the xml file in the c:/ directly and run the java code
java swings - Java Beginners
java swings   hi, I posted the same question two times,but i didnt get the reply. Please change the jframe look and feel type of code.please send the code immediately. This is my code package com.zsl.ibm.mqtool; import
swings - Java Beginners
for this in google, but i got very difficult programs. i am beginner in java swings . i want...); } } For more information, visit the following link: http://www.roseindia.net/java/example/java/swing/ Thanks
java-swings - Java Beginners
java-swings  How to write a program for JTree within a JTable cell in java swings.A table should be displayed when i click on the cell of the table. Please help. Thank u
java swings - Java Beginners
java swings  Hi, I need simple code for JButton JOptionPane.Please send the code. Thanks, Valarmathi
Java-Swings - Java Beginners
Java-Swings  How to set size of JButton depending on it's dynamic caption in java? Here caption is not known at desing time it is geerated at runtime.  Hi friend, Please give in details and full source code where
SWINGS
SWINGS  WHAT ARE THE DIFFERENCES BETWEEN AWT AND SWINGS
Java Swings - Java Beginners
Java Swings  hi , I am doing project using netbeans. I have a combobox . I want to add items in that combobox from a method.For this i found... code: http://www.roseindia.net/java/example/java/swing
java swings - Java Beginners
java swings  Hi, I need the code for how to jlistbox value enable disable . please send the code as soon as possible. Please its urgent. Thanks, Valarmathi
java swings - Java Beginners
java swings  Hi, I have two listboxes .Move the one listbox value into another listbox using add button.Move the value one by one into another listbox.Please give the code using jpanel. Thanks, Valarmathi
java swings - Java Beginners
java swings  Hi, I already send the question. But i didnt get the reply. I can't able to set the jfiledialog directory selection in the textbox. Please send the code urgently. Thanks, Valarmathi
Java-Swings - Java Beginners
Java-Swings  How to set the size of a JButton,JLabel depending on it's caption?  Hi, import javax.swing.*; import java.awt....://www.roseindia.net/java/example/java/swing/ Thanks
java swings - Java Beginners
java swings  Hi, I need the code for how can i set the joptionpane color(background and foreground). can i set the delay time for joptionpane display. Please send the code .its urgent. Thanks, Valarmathi
java swings - Java Beginners
java swings  Hi, I have JoptionPane combobox,in the joptionpane jcombobox have array of values. If i select one value from the joptionpane combobox ,then the selected value will be displayed in the listbox. Please send
Java-swings - Java Beginners
Java-swings  How to move JLabels in a Frame  Hi friend, plz specify in detail. I am sending you a text drag code one textarea...); } } ------------------------------------------------- Visit for more information: http://www.roseindia.net/java/example/java
 

 

 

DMCA.com