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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


punitha
java-help
0 Answer(s)      4 years and 8 months ago
Posted in : Java Beginners


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();
}
}*/
}

Advertisement
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  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
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  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  How to Open CSV Files in a Microsoft Excel Application Using Java Code with example pgm
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
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,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
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 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  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  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  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  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  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  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  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 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 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
Advertisements
 

 

 

DMCA.com