How to clear two dimension array and content in JTextArea
hi all....
i have a problem to clear the counter in JTextArea..currently i design a program to store all the student details in two dimensian array...when i click "RESET"button..it will only reset the textarea..but can not clear the actual content inside the array..and when i click "Print Button" again..it's supposed nothing to display..but it displayed the thing which i previously entered......
so i think i need to clear the array...i use append to insert the text...,for this i also can not reset...
which the code is shown below :
txtArea.append(msg1);
the coding for reset area as below :
txtArea.setText("")
Anyone can help me?????
thks...
How are you trying to reset the array?, you can just creat a new array.
Noah
Similar Messages
-
Selecting one dimension of a two dimension array?
hi, i want to select only one dimension of an array and put it into an arraylist (or casting the array verbatim into the arraylist)
for example, here is an two dimension array:
Object[][] data =
{ { new Date(), "A", new Integer(1), Boolean.TRUE },
{ new Date(), "B", new Integer(2), Boolean.FALSE },
{ new Date(), "C", new Integer(9), Boolean.TRUE },
{ new Date(), "D", new Integer(4), Boolean.FALSE}
};and i want to cast it into an arraylist, what i have in mind (a bit troublesome is the following:)
ArrayList dataArray = new ArrayList();
dataArray.add(data[0]);
dataArray.add(data[1]);
dataArray.add(data[2]);
dataArray.add(data[3]);
System.out.println(dataArray);when come upon the last System.out.println, i got some seemly useless addresses:
[[Ljava.lang.Object;@f73c1, [Ljava.lang.Object;@789144, [Ljava.lang.Object;@1893efe, [Ljava.lang.Object;@186c6b2]
how do you accomplish casting a two dimension array into an arraylist, but the second dimension of the arraylist is kept as Array of Objects? thanks alot!First, the strings that are printed out are the value of the hashcode for the specific object. That is the default value that is printed out for any object reference in a class that inherits the toString() method from the Object class. This is true for arrays. Your ArrayList contains array references in it..
So, you are printing the object hashcodes for the arrays in your ArrayList, instead of the contents of those arrays. It would be better if you created ArrayLists, or even designed an object that stores your data, and stored those inside your ArrayList. ArrayList has an overwritten toString() method that will print the contents instead of the object hashcode, so an ArrayList containing ArrayLists would print your data the way you want. If you define your own class, you will need to provide a toString() method that prints the contents the way you want.
PS, look at http://java.sun.com/j2se/1.5.0/docs/api/java/util/AbstractCollection.html#toString() for more information on the toString() method used by ArrayList.
� {� -
Show me the code for two dimension array in JSP!
Thanks in advance!Hi,
I am new in Java but maybe I can help you:
Two-dimnsional arrays you can declare in following way:
String[][] someArray;
When you want to allocate space for new array you can do something like this:
someArray = new String[5][5];
All Arrays have a data variable called length, which you can inspect to find out how many elements there are in the array.
For multi-dimensional arrays, each dimension has a length property.
int[] [] a1 = {{ 0, 1, 2 },{ 3, 4, 5 }};
for (int i=0; i < a1.length; i++) {
for (int j=0; j < a1.length; j++) {
prt(i + "," + j + "=" + a1[i][j]);
Hope this is of help to you.
Mirkos -
Matrix in java using two dimension array
hi!
Everybody here's a problem I have cpould any body out there give nice piece of sourcr code for "matrix in java using two dimension array"I have to give a presentation how it works.Yes I'd appreciate as many example as possible
If anybody can??
Please help
regards
ardentnice piece of sourcr
code for "matrix in java using two dimension
n arraySure,
int[][] matrix = new int[5][5];
That declares a two-dimensional 5 by 5 array with integer elements. All elements are initially 0.
For further information check you favourite Java textbook. -
How to use two dimensional array in custom.pll
HI
How to use two dimensional arrays in custom.pll
I tried by the following way .
type ship_array is table of number index by binary_integer;
type vc_array is table of ship_array index by binary_integer;
But I am getting the error as that
A plsql table may not contain a table or a record with composite fields.
Please tell me the way how to use themwhich forms version are you using? two dimensional arrays are available in >= 9i if memory serves.
regards -
How can i find the size and contents of playlist created by genius?
How can i find the size and contents of i-tunes playlist created by genius?
Have a look at this article written by the CEO of our company (MoviMED):
http://www.qualitymag.com/articles/91010--d-imaging-enters-the-machine-vision-world?v=preview
What is the object you are going to be making with the CNC? Is it a cube? Is it an intricate statue?
Are you making an object with a CNC, or just mounting a camera to a CNC to image the object?
www.movimed.com - Custom Imaging Solutions -
My windows laptop suffered a serious crash. How can I transfer all music and content from iPhone to iTunes on new windows 8 laptop?
See Recover your iTunes library from your iPod or iOS device.
tt2 -
How to contact two dimension change to one dimension form bw query
I had two dimension: Index and Company, Now ,I think to unite one dimension Index_Company.
I use bw query.
Index Company
1 1000
2 3000
3 6000
4 2000
Return value:
Index Company Index_Company
1 1000 1_1000
2 3000 2_3000
3 6000 3_6000
4 2000 4_2000
I use:
<EXPRESSION>[DEFECT1].[LEVEL01]&'_' &[ZINDEX].[LEVEL01])</EXPRESSION>
or <EXPRESSION>[DEFECT1].[LEVEL01]+'_' +[ZINDEX].[LEVEL01])</EXPRESSION>
Can't ok.
I use MDXTEST tcode for BW to test. I can't find contact function.
Thank you.
Regards,
Howard.For the time being there no support for string concatenation directly at MDX level. I would suggest to try this in the WebI report itself.
Regards,
Stratos -
Read two different arrays and display
I have a text file, which has 1000 of entries in the way mentioned below:
Kozos customer
sabze employee
I am reading the content of text file and saving as an arrays.
$global:Content = get-content info.txt
$global:Name=$Content | foreach {
$hashTab=@{Name="" ; Info=""}
$hashTab.Name, $hashTab.Info=$_.Trim() -split '\s+'
New-Object PSObject -Property $hashTab
$global:Names=$ServerList | select -ExpandProperty Name
$global:Infos=$ServerList | select -ExpandProperty Info
How do I read two arrays, I mean read the values of two arrays one by one and display the result as:
Names Infos
Kozos Customer
sabze employeeWe get that you are unable to do this, but it is still not clear precisely what it is that you want, a two-dimensional array, or a structure such as SeanQuinlan suggested? Also:
there seems no reason for any of the variables to be global in scope.
Where is the $serverlist variable defined?
what relationship is there between the file you mention and the data in the $serverlist variable?
Your code has three arrays, $name, $names, and $infos; which two of these do you want to combine into a single array? If $names and $infos, would this work for you:
$namesNinfos = $serverlist | select name,info
I suggest that you describe your situation without trying to state it in powershell (as that is partly where your problem lies). You could, for example, show sample content of the file and each of the two arrays, and show what this would look like in your
desired two-dimensional array, perhaps like this:
file info.txt
Kozos customer
sabze employee
array 1:
Kozos
sabze
array 2:
customer
employee
resultant 2D array
column 1 2
row
1 Kozos customer
2 sabze employee
As an aside, it could be that we are getting confused by the term "array". languages such as fortran and basic support multidimensional arrays in which each element is addressed by a set of integer indices, the most common form being row and column, as in
a spreadsheet.
In Powershell, arrays are generally one dimensional, with a single numerical index being used to select a single element ($row3 = $array[2]). That element can optionally have multiple values if it is defined as an array or a hash. This is referred to as
a "jagged array" as each element of the array may not all have the same number of sub-elements as each other.
Powershell also supports true multidimensional arrays, however, these seem fairly rarely used, I suspect because jagged arrays generally provide more easily used functionality.
You can get more details on this from
here and
here.
This, then, leads to my final question:
what type of two-dimensional array are you looking for, and how will your script be processing it?
Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate. -
How to ask for an array and how to save the values
I'm supposed to be learning the differences between a linear search and a binary search, and the assignment is to have a user input an array and search through the array for a given number using both searches. My problem is that I know how to ask them how long they want their array to be, but I don't know how to call the getArray() method to actually ask for the contents of the array.
My code is as follows:
import java.util.Scanner;
import java.util.ArrayList;
public class Main
private static Scanner input = new Scanner(System.in);
public static void main (String args[])
//creates ArrayList
int List[];
System.out.println("How long would you like the array to be?");
int arrayLength = input.nextInt();
//Initializes array list
List = new int [arrayLength];
System.out.println("Please enter the first value of the array");
public static void getArray(int List[], int arrayLength)
for(int i=0; i < arrayLength; i++) {
System.out.println("Enter the next value for array");
List[i] = input.nextInt();
public static void printArray(int List[])
for(int i=0; i < List.length; i++)
System.out.print(List[i] + " ");
public class search
public static int binarySearch(int anArray[], int first, int last, int value)
int index;
if(first > last) {
index = -1;
else {
int mid = (first + last)/2;
if(value == anArray[mid]) {
index = mid; //value found at anArray[mid]
else if(value < anArray[mid]) {
//point X
index = binarySearch(anArray, first, mid-1, value);
else {
//point Y
index = binarySearch(anArray, mid+1, last, value);
} //end if
} //end if
return index;
//Iterative linear search
public int linearSearch(int a[], int valueToFind)
//valueToFind is the number that will be found
//The function returns the position of the value if found
//The function returns -1 if valueToFind was not found
for (int i=0; i<a.length; i++) {
if (valueToFind == a) {
return i;
return -1;I made the changes. Two more questions.
1.) Just for curiosity, how would I have referenced those methods (called them)?
2.) How do I call the searches?
import java.util.Scanner;
import java.util.ArrayList;
public class Main
private static Scanner input = new Scanner(System.in);
public static void main (String args[])
//creates ArrayList
int List[];
System.out.println("How many values would you like the array to have?");
int arrayLength = input.nextInt();
//Initializes array list
List = new int [arrayLength];
//Collects the array information
for(int i=0; i < arrayLength; i++) {
System.out.println("Enter a value for array");
List[i] = input.nextInt();
//Prints the array
System.out.print("Array: ");
for(int i=0; i < List.length; i++)
System.out.print(List[i] + " ");
//Asks for the value to be searched for
System.out.println("What value would you like to search for?");
int temp = input.nextInt();
System.out.println(search.binarySearch()); //not working
} -
APEX V4.2.3
DB 11.2
I have a classic report on page 1. I have a region button called "Export" (defined by a submit dynamic action with "show processing=Yes") that submits the page and then via a branch directs me to page 2 which has a slightly different version of the report on page 1 (i.e. no breaks) which I want to capture as a CSV export. Therefore I've set the report template on page 2 to " Export:CSV".
Now when I click on the page 1 export button the grey screen and loading gif appears indicating that the report is executing and then as expected, page 2 doesn't appear but instead the standard open/save window's dialog box appears asking to open or save the generated CSV file. All good..but the grey loading screen remains. How do I clear this loading screen and get back to the context of page 1 ?
thanks in advance
PaulPHi PPlatt,
We would love to help but you left out one crucial part of the puzzle: namely how does your CSV report get exported. With the way it is setup (a redirect to another page), I'm going to assume you do that because you have some PL/SQL on that page that prints the CSV.
Now there are two questions that are crucial here:
- How do we stop the icon from bugging us on the screen
- How do we communicate with the browser that it should no longer display the loading icon
The first question is rather easy, two simply lines of codes can do that:
$('#apex_wait_popup').hide();
$('#apex_wait_overlay').hide();
But when do we use this code? Quite simple when the document is downloaded. When is it downloaded? At the end of the PL/SQL code that prints the document to the browser.
What you could do is at the end of that code give an application item a certain value. For example :AI_PRINTED := 'Y';
Then all you need to do is let the browser ask for the value. You could do this by using JavaScript to continuously fire AJAX to the server using a JS timing event:
http://www.w3schools.com/js/js_timing.asp
Better would be a Server send event, but since you left out another crucial piece of information: your browser, I will not go deeper into this.
Start this timing event when someone asks for the document, and end it as soon as the process returns that :AI_PRINTED equals 'Y'.
Despite the lack of information, I hope I have given, or at least inspired you to get to the solution.
Regards,
Joni -
How to combine two dimension in dashboard??
Dear experts,
I have a requirement that i need two combine two dimension in dashboard.
Ex:-
- I have two different providers (Query1 and Query2) and both is having common dimension called Plant.
- The plant from both query is having different values (for example, Query1 Plant = A,B,C and Query2 Plant = D,E,F,G)
- Now I want the total list of plants from both query and list of plants will be used as filter on combo box in dashboard.
Note: List of values for Plant (dimension) may increase or decrease from both query.
Thanks and regards
Vijay MunirajHi Vijay,
How can you combine the 2 queries as a single query in dashboard?If i understood the query,use a Multiprovider for your requirement and get the combined results in single query and use Plant as single prompt in the dashboard(If you are getting data from BI).You cannot merge this behaviour in the dashboard.(In Web Intelligence you can merge it based on common dimension values only).
Regards,
Venkat -
How to enter two different arrays into two columns of a multi column listbox
Hi All,
I have two different arrays of values suppose 1 array A(1,2,3,4,5) and another array B(3,4,5,6,7). I want to write these to arrays into a multicolumn listbox such that 1st column would be array A and 2nd column would be array B.
Thnx in advance
Solved!
Go to Solution.I still couldnt understand how to do it...
I am posting here my VI. here the 1, 2, 3, 4 are some controls. If i enter any value, the calculated Voltage and current are continously pushed in the array. Now i have display these arrays in the multi column listbox as 1st column be the voltage and second column being the current.
Attachments:
manual_graph.vi 643 KB -
How to get two audio voice and how to identify its frequencies
hello,,
i am new to javax.sound .. here anybody help me in my mini project
1.. i hv to get to audio voice from two different person same time...
2 next i hv to visualize their audio frequency.... so sure that both the audio voice vary in frequency..
3.. i hv to seggregate this two audio voice and store it in different file and hv to play it separately
is here any body to help me
i will be greatly thanxful 4 ur info1. How are you getting the voices at the same time? Are these signals
coming from the same line, e.g. microphone? Or are you just reading
two audio files from disk?
2. To get the frequency of a audio signal, you'll need to do Fast Fourier
Transform to that signal. You'll propably need a third party library for this,
search for this with google.
3. If your signals are coming from the same source, it's going to be very
hard to filter out one of these voices. If you don't know anything about the
voices in forehand, I don't think this will be possible.
Give some more information about what you're trying to achieve.
kari-matti -
How to clear the open items and parked items for customer
Hi Experts,
I need to clear the open items and parked items for customer.
So any one could let me know the transaction code and procedure for clearing the items for customer.
Best regards,
Kesava balaji.Hello,
Parked items will have NO RELEVANCE, unless you post it.
You CANNOT clear parked items.
You can clear the posted items using F.13 or F-32
Regards,
Ravi
Maybe you are looking for
-
Connecting to a database coldfusion
Following instructions in Getting Started Experiance Tutorial page 18 of 47 Item 7 figure 28 shows Databases Tab with + - butons I do not have these buttons and can not select Microsoft Access with Unicode Connection as shown in fig 29 page 19 any su
-
How do I remove facebook birthdays from my calendar in ios 7?
I have been unable to remove facebook birthdays from my iphone 5 calendar. My contacts haven't been synchronised, only my calendar? I have deleted the app, signed out from it, nothing seems to work. Can anyone help?
-
All of a sudden my app update page keeps coming up blank
-
FR 11.1.1.3 "export to query ready mode" option not working
Hi All, We have a scenario where few users are not able to use the "export to query ready mode" option after running an FR report. For some reason the save dialog box doesnt open or doesnt pop up when this option is ticked. Note that this issue comes
-
Export photos with original metadata
I have original photos that states the time taken and all other datas of my camera but once I edited and export from aperture, the new photos do not have the original metadata in it anymore. Is it possible to export photos with the original/master me