|
rahmat_20 wrote: I want to use Setactivewindow
Presumably NOT because you think this is necessarily going to work with a java component.
So your FIRST steps.
1. Learn C/C++
2. Learn how to create a windows window
3. Write C/C++ code to call SetActiveWindow()
4. Test it.
NONE of the above has anything to do with java.
DO NOT write java until you have the above working.
|
|
|
|
|
Torsten may be quite correct in his comments, but it may also be that you are thinking of the Java Native Interface[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
import java.util.Scanner;
public class ScannerTester{
public static void main (String args[]){
Scanner aScanner_input = new Scanner(System.in);
String aScanner;
aScanner= aScanner_input.nextLine();
if (aScanner == "s"){
System.out.println("A Scanner is s!");
}
if (aScanner == "Y"){
System.out.println("A scanner is Y!");
}
}
}
Hey, the code is above. I wager this is some kind of cast or data type problem. I tried aScanner_input.next() and aScanner_input.nextLine(). With both it doesnt' recognize Y as Y and s as s!?!! i.e. none of the if-blocks can get accessed regardless of input.
I can get scanner to work with other data types like int (and nextInt()).
Appreciate if anyone knows what's going on. Cheers. Thanks. (*I love this forum. Very helpful. And as said before, I go to this forum and I don't use stackoverflow). Thanks!
|
|
|
|
|
if (aScanner == "s"){
should be
if (aScanner.equals("s")){
See also here[^] for more information on Java String s.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
OMG I realized this is the exact same problem I had before when posting on my first post. I need to use a String.equals() comparison for strings in the if-conditional. I will try that. (thanks...to my recollection of solving that problem the first time! lol xD).
Marvelous. got it. Sweet. solved. nice code symmetry (start code and end fixed code, too)!
import java.util.Scanner;
public class ScannerTester{
public static void main (String args[]){
Scanner aScanner_input = new Scanner(System.in);
String aScanner;
aScanner= aScanner_input.next();
if (aScanner.equals("s")){
System.out.println("aScanner is s!");
}
if (aScanner.equals("Y")){
System.out.println("aScanner is Y!");
}
}
}
|
|
|
|
|
You can say:
import java.util.Scanner;
public class ScannerTester
{
public static void main ( String[] args )
{
Scanner aScanner_input = new Scanner( System.in );
String aScanner;
aScanner = aScanner_input.next();
if ( sScanner == "s" )
{
System.out.println("aScanner is s!");
}
if ( aScanner == "Y" )
{
System.out.println("aScanner is Y!");
}
}
}
|
|
|
|
|
Hello,
anyone can help me?
how to make a resistor color code with java?
please,source code about this project?
thank,
|
|
|
|
|
|
Just remember "Bad beer rots our young guts but vodka goes well – get some now"
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
I do not want to disturb anybody with my arrogance anymore, but I could not leave without compensating for that downvote. Whoever did that, he sure did not get the meaning of that sentence.
And now I'm going to log out and disappear again.
I'm invincible, I can't be vinced
|
|
|
|
|
Come and disturb us, it's always welcome.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
i have any problem about in java source code.
how to make the application resistor color code in java?
I ask for its support ......
|
|
|
|
|
And you have been given some suggestions, including this one[^] in the C# forum. Now it's up to you to go and do some studying, designing, coding and testing, and see what you can come up with. You may also like to make a decision as to which language you are going to use.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
- a grid layout with different cell backgrounds
- some spinnner in a row
- textfields with a explanation on the Panel how to fill them
- ...
imagine.
|
|
|
|
|
input: a folder with many files with diff formats
output: a text pad that contains all the file names in the input folder along with their corresponding formats
|
|
|
|
|
Show us the code for your homework.
|
|
|
|
|
1. Read the directory structure
a. look for files in it
b. Collect each file into a list along with path
2. Research methods to determine "format". This
might just be as simple as looking up file
extensions.
3. Span the list
a. Look at each file in list
b. Using 2 determine the 'format' of the file.
c. Write file name and format to file.
4. Open "text pad" (presumably the editor TextPad) using
the file from 3 as the input.
|
|
|
|
|
I need sample for this purpose. Help me please.
|
|
|
|
|
You need to use JNI[^] for that.
|
|
|
|
|
1. Write a wrapper for the C code, in C, to create an executable.
2. Add a communications layer to that executable: sockets, stdio or files.
3. Test the above.
4. Write code in jave to run the executable via Runtime.exec() or ProcessBuilder.
5. Implement the communications defined in 2 in java.
Note in the above that steps 1-3 have nothing to do with Java.
The advantage to this method over JNI is that bugs in 1/2 above will not cause your java app to blow up. And it is easier to debug.
|
|
|
|
|
How to access, delete, add element in arrayList??
I have a list of oficials of an Enterprise, I want to print the official member with category equal Developer.
Help me to solve this issue using the code below. Please
*/
package Enterprise;
public class oficial {
private String name;
private String category;
private double salary;
public AuxAdmin(String name, String category, double salary) {
this.name = name;
this.category = category;
this.salary = salary;
}
public String getCategory() {
return category;
}
public String getName() {
return name;
}
public double getSalarY() {
return salary;
}
public void setCategory(String category) {
this.category = category;
}
public void setName(String name) {
this.name = name;
}
public void setSalary(double salary) {
if (salary > 4000) {
this.salary = salary; }
else{
System.out.println("error");
} }
@Override
public String toString() {
return "Oficial Member: " + name + " - " + category+" - " +salary;
}
}
public class Enterprise {
public static void main(String[] args) {
ArrayList<oficial> member = new ArrayList<oficial>();
member.add(new oficial("Bill Gate","Manage", 75 000));
member.add(new oficial("Obama ","Developer", 40 020));
member.add(new oficial("Delfim Pereira","Director", 60 000));
member.add(new oficial("Dannis Rico","Secretary", 20 020));
member.add(new oficial("Diana Math","Developer", 62 000));
member.add(new oficial("Sondela Midell","Developer", 47 020));
for (oficial lis : member)
{
System.out.println(lis);
}
}
|
|
|
|
|
Where is the problem?
for (oficial lis : member) {
System.out.println(lis);
}
You already figured that it would need a loop to access all the objects in your ArrayList.
That's fine! You also have a toString() in there - even better!
And you can add(Object) things to the List - now try to remove(Object) something. Easy.
Sidenotes:
Your Object oficial starts with a small letter - that is no good, it should start with a capital letter.
The "constructor" is not really one as it is called different -> AuxAdmin(args) . It should be the same as the object.
Also are the numbers containing a space.
|
|
|
|
|
Thank u 4 ur answer, it was very important 4 me.
I also solved my issue in single line:
if(lis.getCategory().contains("Developer"))
Thanks
|
|
|
|
|
java
modified 26-Feb-12 12:53pm.
|
|
|
|