Search Results

Search found 9 results on 1 pages for 'stdnoit'.

Page 1/1 | 1 

  • adding jpanel into a jframe. netbeans

    - by stdnoit
    i am particularly using netbeans gui editor and i am new to gui i have a jframe created and I added jtabbedpanel. inside the jtabbedpanel i have 2 panels that i call standard and compact i have set standardPanel = new ImagePanel(); which ImagePanel.java is located on different java file how am I suppose to put a panel on different file for reusability ? i obviously dont want all the codes in a single file. is this the right way to design a gui ? thanks

    Read the article

  • override the operator overloading in C++ ?

    - by stdnoit
    helo guys i have class call Complex I did operator overloading like such Complex c = a + b; // where a and b are object of Complex class which basically is operator+(Complex& that); but I dont know how to say for example double c = a + 10; //where a is object of Complex class but 10 is integer / double I did define typecasting for a to be double get my IDE says that there are too many operands + and it somehow complains for not being able to "understand" the + it has to be in this format though double c = a + 10; thanks

    Read the article

  • How to compare two arrays of integers order-insensitively

    - by stdnoit
    I want Java code that can compare in this way (for example): <1 2 3 4> = <3 1 2 4> <1 2 3 4> != <3 4 1 1> I can't use hashmap table or anything; just pure code without library. I know there are two ways. sort them and compare the array index by index use two for loops and compare the outer index with the inner index. I have been trying with this but still not working: for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(a[i] != a[j] && j == n) return false; } } return true; anything wrong with the code ? thanks

    Read the article

  • java array pass by reference does not work?

    - by stdnoit
    guys i thought almost all language including java pass array into function as reference (modifiable) but somehow it does not work here. and the testArray is still 1,2,3 with size of 3 strange enough, when if i change result[i] = 2 to a[1] =2; it work . it did pass by reference what is wrong with this code? at the end, i had a = result; (which update the a). did result get removed from stack. that is why a still get to the original a ? i am confused. thanks class Test { public static void main(String[] args) { int[] testArray = {1,2,3}; equalize(testArray, 6); System.out.println("test Array size :" + testArray.length); for(int i = 0; i < testArray.length; i++) System.out.println(testArray[i]); } public static void equalize(int[] a, int biggerSize) { if(a.length > biggerSize) throw new Error("Array size bigger than biggerSize"); int[] result = new int[biggerSize]; // System.arraycopy(a, 0, result, 0, a.length); // int array default value should be 0 for(int i = 0; i < biggerSize; i++) result[i] = 2; a = result; } }

    Read the article

  • ask. help me to compare two array of integers and the order does not matter.

    - by stdnoit
    [Example] <1 2 3 4 = <3 1 2 4 <1 2 3 4 != <3 4 1 1 and ummm it is in java. cant use hashmap table or anything just pure without library. I know there are two ways. 1. sort them and compare the array index by index 2. use two for loops and compare the outer index with the inner index. ( i have been trying with this but still not working) for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(a[i] != a[j] && j == n) return false; } } return true; anything wrong with the code ? thanks

    Read the article

  • how to represent negative number to array of integers ?

    - by stdnoit
    I must convert string of 1324312321 to array of integers in java this is fine. I could use integer parseint and string substring method but how do I repesent -12312312 to my original array of integer.. the fact that - is a char / string and convert to array of integer would alter the value ( even though I convert - to integer-equivalent , it would change the rest of 12312312) it must be an array of integers and how should I convert negative numbers and still keeep the same value somehow reminding me of two complements trick but i dont think i need to go down to binary level in my program.. any other trick for doing this? thanks!

    Read the article

1