java-help

java-help

hello sir, please help me.....the below given is the output.java program
here in this program am using the stmts
ta. append("clustering")
where ta is a textarea created in input.java file.i have designed only one form with button and textarea. on button press this output.java file is called.now i want this output.java file to print in textarea.
now this output.java program is not printing the reult in the textarea.
i feel this output.java file not recognising where ta(text area is) how to solve this...


import javax.swing.*;
import javax.swing.JTextArea.*;
import javax.swing.ScrollPaneLayout.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;

class Output extends JFrame {
//private javax.swing.JTextArea ta;
JTextArea ta=null;
JScrollPane sp=null;
File f=null;
FileOutputStream fos=null;
BufferedOutputStream bos=null;
byte b[],b1[];
Cluster[] clustersOutput=null;
// CURE cure;
ClusterAlgorithm cj=null;
Vector v=null;
public Output(ClusterAlgorithm ca){
// super("Output");

cj=ca;

ta=new JTextArea();
sp=new JScrollPane(ta);

clustersOutput=cj.getClusters();
v=new Vector();

Container c=this.getContentPane();
c.setLayout(null);






// setVisible(true);
v=ReadFile.getDP();

for(int i=0; i<clustersOutput.length; i++,ta.append("\n")){
ta.append("CLUSTER "+(i+1)+"\n");
ta.append("----------------\n");
for(int j=0; j<clustersOutput[i].getClusterSize(); j++){
String s="("+(clustersOutput[i].getDataPoint(j).getX())+","+(clustersOutput[i].getDataPoint(j).getY())+")--"+(v.indexOf(clustersOutput[i].getDataPoint(j))+1)+"--\n";
ta.append(s);
ta.getText();
System.out.println("this is punithaaaaaa");
}
}

if (cj instanceof CURE){
for(int i=0; i<clustersOutput.length; i++,ta.append("\n")){
ta.append("CLUSTER "+(i+1)+" RepPoints\n");
ta.append("-----------------------------\n");
for(int j=0; j<clustersOutput[i].getNoOfRepPoints(); j++){
String s="("+(clustersOutput[i].getRepPoint(j).getX())+","+(clustersOutput[i].getDataPoint(j).getY())+")\n";
ta.append(s);
}
}
}//if
}

public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
/* public void actionPerformed(ActionEvent ae){
if(ae.getSource()==exit){
System.exit(0);
}else if(ae.getSource()==saveOutput){
try{
String s=JOptionPane.showInputDialog(null,"Enter the file name to erite the output","Input",JOptionPane.INFORMATION_MESSAGE);
String s1;
f=new File(s);
fos=new FileOutputStream(f);
bos=new BufferedOutputStream(fos);
int i,j,k;
for(i=0; i<clustersOutput.length; i++){
s="----------------CLUSTER "+(i+1)+"----------------\r\n";
b=s.getBytes();
bos.write(b);
for(j=0; j<clustersOutput[i].getClusterSize(); j++){
s1="(";
b1=s1.getBytes();
bos.write(b1);
bos.flush();
s=""+(clustersOutput[i].getDataPoint(j)).getX();
b=s.getBytes();
bos.write(b);
bos.flush();
s1=",";
b1=s1.getBytes();
bos.write(b1);
bos.flush();
s=""+(clustersOutput[i].getDataPoint(j)).getY()+"--"+(v.indexOf(clustersOutput[i].getDataPoint(j))+1)+"--";
b=s.getBytes();
bos.write(b);
bos.flush();
s1=")\r\n";
b1=s1.getBytes();
bos.write(b1);
bos.flush();
}
System.out.println("Cluster"+(i+1)+"successfully written");
}

if (cj instanceof CURE){
for(i=0; i<clustersOutput.length; i++){
s="----------------CLUSTER "+(i+1)+" RepPoints----------------\r\n";
b=s.getBytes();
bos.write(b);
bos.flush();
for(j=0; j<clustersOutput[i].getNoOfRepPoints(); j++){
s1="(";
b1=s1.getBytes();
bos.write(b1);
bos.flush();
s=""+(clustersOutput[i].getRepPoint(j)).getX();
b=s.getBytes();
bos.write(b);
bos.flush();
s1=",";
b1=s1.getBytes();
bos.write(b1);
bos.flush();
s=""+(clustersOutput[i].getRepPoint(j)).getY();
b=s.getBytes();
bos.write(b);
bos.flush();
s1=")\r\n";
b1=s1.getBytes();
bos.write(b1);
bos.flush();
}
System.out.println("Cluster"+(i+1)+" RepPoints successfully written");
}
}//if CURE
}catch(Exception ex){
ex.printStackTrace();
}
}else if(ae.getSource()==showGraph){
cj.showGraph();
}
}*/
}
View Answers









Related Tutorials/Questions & Answers:
java help!
java help!   I need help starting off a program I am trying to write for class. The class should contain a private instance variable to represent temperature in Degrees Celsius and it should have the following methods
java help?
java help?  Write a program, where you first ask values to an array with 6 integer values and then count the sum and average of the values in methods (send in the array & return the counted value to the main program). Print
Advertisements
java help
java help   Write a Java program that does the following: 1.Creates a grading program based on the Baker College grading standard. You will need to look up the current grade standard. You may use only the letter grades without
Intro Java help with Double
Intro Java help with Double  I have to evaluate a math expression using double in Java. I can input the code fine for the expression, but I don't know how to view the answer that it gives me. help
Java Help Please
Java Help Please  I can't seem to figure out how to make this program, can some one help me please? It is due soon!! 4) Write a program that will take an input (Date object will contain fields for the month, day, and year - all
Java Help (Beginer Tutorial)
Java Help (Beginer Tutorial)  Hi this is my first year for Java... doing so I was wondering if anyone was willing to help me solve a couple of them... would appericate any help at all! Im using Eclipse by the way. Practice 2)Write
Java help needed
Java help needed  Create a web application that will allow a user to play the popular Hangman computer game using Java application program. How... options: One for accessing help using the program, one for adding new words, one
java help
java help  How to Open CSV Files in a Microsoft Excel Application Using Java Code with example pgm
java help
java help  Rational numbers are numbers that can be represented as a fraction p / q where p is an integer number and q is a positive integer (q != 0). Design and implement a Java class RationalNumber for representing such numbers
java help
java help  Design and implement a class called DateWriter that has three instance variables: a string for month, an integer for day, and an integer for year. The class should has a constructor to accept and initialize the values
java help
java help  1) build class(es) for the dresses, choose (dress ID, color, price, designer)( link lists) 2) construct the driver class by establishing two separate objects for each sister 3) let them both to enter the dresses
Java help
Java help  Write a Temperature class that represents temperatures in degrees in both Celsius and Fahrenheit. Use a Floating-point number for the temperature and a character for the scale: either 'C' for Celsius or 'F
Java Help
Java Help  Write a Temperature class that represents temperatures in degrees in both Celsius and Fahrenheit. Use a Floating-point number for the temperature and a character for the scale: either 'C' for Celsius or 'F
Java Help Center
Java Help Center       Welcome to Java help Center service...; In this section, we provide you round the clock Java Help
Java Help and Java Glossary
Java Help and Java Glossary       We provide Java Help online through our website. Browser....    Java Help Center Welcome to Java help
PLZ Need some help JAVA...HELP !!
PLZ Need some help JAVA...HELP !!  Create a class names Purchase Each purchase contains an invoice number, amount of sale and amount of sales tax. Include set methods for the invoice number and sale amount. Within the set
java help - Java Beginners
java help  Write the code for a method named getFile that accepts a file name and returns a file created from the RandomAccessFile class. This method should catch the FileNotFoundException if it occurs and print the message ?File
java help - Java Beginners
java help  Code a try statement that parses a string variable named quantityString to an int variable and then calls the calculateDiscount method and assigns the return value to a double variable named discountPct. Code a catch
Java help - Java Beginners
Java help  I need to write an application that uses the circle class. It must read a radius of a circle from the user creates a circle object, and return the object. The program creates a circle object by using the above method
java help - Java Beginners
java help  Code a try statement that catches an IOException and an EOFException. If an IOException occurs, print the message ?An I/O error occurred.? to the console. If an EOFException occurs, print the message ?End of file
java help - Java Beginners
java help  Code a statement to test a catch block that catches an IOException.  Hi friend, Code a statement to test a catch block that catches an IOException. import java.io.*; class IOExample { public static
java help - Java Beginners
java help  Code a catch block that catches a NumberFormatException and then prints the stack trace.  Hi friend, Code a catch block that catches a NumberFormatException and prints stack trace : class
java help - Java Beginners
java help  Code a try statement that calls the calculateDiscount method and assigns the return value to a double variable named discountPct... information on Exception Handling in Java visit to : http://www.roseindia.net/java
java help - Java Beginners
java help  I would like to modify the client program so that it catches input mismatch and arithmetic exceptions and asks the user to correct them.. thanks.. import java.util.*; public class Rubayya { static Scanner
java help - Java Beginners
java help  Write the code for a method named calculateTax that accepts a double parameter named subtotal and a boolean parameter named isFresno and calculates and returns the sales tax. If isFresno is false, the sales tax should
java help - Java Beginners
java help  Write the code for a method named calculateTax...(e.getMessage()); } return sales_tax; } } For more information on Java visit to : http://www.roseindia.net/java/ Thanks Vineet   
java-help - Java Beginners
java-help  hello sir, please help me.....the below given is the output.java program here in this program am using the stmts ta. append("clustering") where ta is a textarea created in input.java file.i have designed only one
Java help - Java Beginners
Java help  Was this code created by netbeans or any other tool?? I am not supposed to use any tools. Just wondering! Thanks! import javax.swing.*; import java.awt.*; import java.text.*; import java.awt.event.*; import
Java help - Java Beginners
Java help  I didnot get the code ,therefore I am posting my question again.. Thanks in advance ...:) Programming Assignment: A) Consider the outpatient pharamacy at University Hospital. At the entrance of the pharmacy
java help - Java Beginners
java help  Code a catch block that catches a NumberFormatException and then prints the name of the class that the exception was created from along... information on Exception Handling in Java visit to : http://www.roseindia.net/java
java help - Java Beginners
java help  Code a catch block that catches an IOException, prints the message ?An I/O exception occurred.? to the console, and then throws the exception to the calling method.   Hi friend, Code a catch block
java help - Java Beginners
java help  Code a try statement that catches the NumberFormatException that may be thrown when the following statement is executed: int count... on Java visit to : http://www.roseindia.net/java/exceptions/ Thanks
java,java,java,help
java,java,java,help  Dear people, can anyone help me complete this program import java.util.*; public class StringDemo { static String a="{a=100;b=200;c=300}"; public static void main(String args[]) { String b[]=a.split
Graphic interface java help
Graphic interface java help  A modified checkers program with class name Checkers using double buffering. Somehow the program must have two top..., please help
Java Help and Java Glossary
Core Java Topics
Core Java Topics Following are the topics, which are covered under Core Java. In the roseindia website for core java, programmer will find completed details of every core java topic and simple example of core java that will help you learn
Iterator in java
Iterator in java In this section you will learn about Iterator in java. ... enumeration in java collection. Iterator in java, is traversing the object from... are traversed based on index but Iterator in java is to traverse through object as well
Encapsulation in Java Programming
Encapsulation in Java - One of the 4 OOPs concept In this video tutorial I will explain you the Encapsulation concept of the Java Programming language... the features of the encapsulation in Java and teaches you how to create
Threads in Java
Threads in Java help in multitasking. They can stop or suspend a specific... in increasing the speed of the processes. In Java programming, Java Virtual Machine (JVM... temporarily and allows other threads to execute. Example of Threads in Java
SCJP Module-4 Question-2
SCJP Module-4 Question-7
SCJP Module-3 Question-8
SCJP Module-5 Question-4
Learning Java programming for Beginners
methods, Java classes, Java functions, keywords and others and then help him/her...Learning Java programming is not a difficult task as it has been hyped... there are class room training provided to teach Java, it is considered difficult to keep
Training and Placement
Training and Placement   Where can I give my son a perfect training of java to help him find a good job
Data Transfer - Java Beginners
Data Transfer  Looking for a program in java or help in begining to wirte an algorithm to show the effectiveness and quality of data transefer between platforms. Namely PC to mobile and Vice versa
When is java main method called?
When is java main method called?  When is java main method called? Please explain the main method in Java with the help of code.   In a java class, main(..) method is the first method called by java environment when
how to generate random questions - Java Beginners
friend, Plz specify the technology with full details like Java,JSP,Servlet,ASP and .net etc... See the below code in Java to help in solving the problem
Java Tutorial for Beginners in Java Programming
Java Tutorial for Beginners - Getting started tutorial for beginners in Java programming language These tutorials for beginners in Java will help you learning the basic concept of Java and help you in quickly getting started
Can we learn Java online?
Can we learn Java online?  Hi, I want to learn Java with the help of may online tutorials on Internet. Is it possible to learn Java programming from many tutorials available online on Internet. Can we learn Java online? Thanks

Ads