Java Queries Here..

srbharadwaj

Broken In
Java Queries Here.. Regular expression

String str0 = "ABC def: xyz12-1/2,2/1,1/3"
String str1 = "AAA def: xyz12-1/2,2/1,1/3"
String str2 = "ABC def: xyz12-,2/1,1/3"
String str3 = "ABC def: xyz12-,1/0,2/1,1/3"

Now i need to check if the String contains "ABC def:<anything>2/1<anything>"
Only str0,str2,str3 satisfies this condition

What should be the regular expression for this?
 

c2tarun

N3CrO..NiNj@**
i just studied the chapter on streams and buffer but not able to visualize them correctly.....

plz help me

either explain it here (that will be beneficial for all new comers)
or give me a link for it
thanx in advance
 

Plasma_Snake

Indidiot
Hi, my first post here after a long time and more will come as I've started J2ME recently, so watch out, coz some of my questions will be pure mindphuck coz of their stupidity! :D
For starters, what all tools will I need for J2ME development, gimme a detailed lowdown.:cool:
 

Adam Cruge1

Broken In
I want to change the coffee cup java icon from Frame....I want my own icon over there....
How can I do that?
Plz help me....
After a lot of search in google I got the followimg code...But it is not changing the icon at the titlebar of the frame. The samr icon is still there...Plz make necessary correction to have desired output.

import javax.swing.JFrame;
import javax.swing.ImageIcon;
import java.awt.Image;
public class Test
{
public static void main(String[] args) throws Exception
{
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("D:/icon")));
frame.pack();
frame.setVisible(true);
}
}
-----------------------------------------
Posted again:
-----------------------------------------
I am using Java 6.
I want to access the build-in Class and Packages of Java. But going to this path
(C:\Program Files\Java\jdk1.6.0\javax\swing ) I saw only some text file and that is written in some other font. I can not understand those.
Please help me out.
 
Last edited:

vamsi360

Always confused
i just studied the chapter on streams and buffer but not able to visualize them correctly.....

plz help me

either explain it here (that will be beneficial for all new comers)
or give me a link for it
thanx in advance

read Complete Reference or Thinking in Java man. read completely and see whether you understand or not..
 

Bandu

Journeyman
I want to change the coffee cup java icon from Frame....I want my own icon over there....
How can I do that?
Plz help me....
After a lot of search in google I got the followimg code...But it is not changing the icon at the titlebar of the frame. The samr icon is still there...Plz make necessary correction to have desired output.

You cannot have absolute path in your code (ex. D:\xyz). Add the desired directory in the classpath and use the resource (your image in this case) directly without any path references; or have your image file in the same directory (or a sub-directory) as your programs directory and access it accordingly. Moreover, you have to specify the correct resource name including the file extension.

I could make your program work with slight modifications as follows:
Code:
import javax.swing.JFrame;
import javax.swing.ImageIcon;
import java.awt.Image;

public class Test
{
    public static void main(String[] args) throws Exception
    {
        Test tt = new Test();
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        try
        {
            frame.setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage(tt.getClass().getResource("icon-mercedes.png")));
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        frame.pack();
        frame.setVisible(true);
    }
}

I had the icon-mercedes.png file in the same directory where the Test.class was.
Hope this helps.
 

Saroja Jim

Right off the assembly line
I am facing a problem, when i have created 4 objects with the same name then tried it to use in other class then it will not accessible there. So it is possible to set object null?

MLM Leads
 
Last edited:

vamsi360

Always confused
can anyone please give me the link to netbeans IDE 6.5 book so that I could easily develop my swing apps rather than coding in Notepad++
 

Nawab

Broken In
i dont think direct link will be allowed here
btw
alternatively search "Netbeans 6.5" @ Google and 1st link will have sub-links including 1 for download and install Netbeans & install
you could also try Eclipse's Java IDE its lightweight n better :razz:
 

adatapost

Broken In
I face a lot of issues while i m running java when i started to learn it... And i think the same issues will still alive.. If anyone find such kinda issue then please post it here instead of creating a new thread..

Yes this thread is dedicatedto Java(if u like J2EE toooo....:D)

So please drop ur queries here...

I think you have different views or misconception on java & jJ2EE.
 

pravesh250

Right off the assembly line
Pls help
I have a java code as follows i would like to embed it in an HTML file can u pls explain how to do.
JAVA code


import java.io.*;
public class angle{
public static void main(String [] args) throws IOException{
BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
float a;
double s;
int c;
System.out.println("Hai welcome to the trignometric calculator");
System.out.println("Select from the following options");
System.out.println("1: Sine");
System.out.println("2: Cosine");
System.out.println("3: Tan");
System.out.println("4: Cosine");
System.out.println("5: Cosec");
System.out.println("6: Cot");
System.out.println("Enter an option: ");
System.out.flush();
c=Integer.parseInt (stdin.readLine());

switch ( c ){
case 1 : {
System.out.println("Enter an angle in degrees : ");
a = Float.parseFloat(stdin.readLine());
s = Math.toRadians(a);
System.out.println("Sine "+a+" = " +(Math.sin(s)));
break;
}
case 2 : {
System.out.println("Enter an angle in degrees : ");
a = Float.parseFloat(stdin.readLine());
s = Math.toRadians(a);
System.out.println("Cosine "+a+" = " +(Math.cos(s)));
break;
}
case 3 : {
System.out.println("Enter an angle in degrees : ");
a = Float.parseFloat(stdin.readLine());
s = Math.toRadians(a);
System.out.println("Tan "+a+" = " +(Math.tan(s)));
break;
}
case 4: {
System.out.println("Enter an angle in degrees : ");
a = Float.parseFloat(stdin.readLine());
s = Math.toRadians(a);
System.out.println("Cosec "+a+" = " +(1/(Math.sin(s))));
break;
}
case 5 : {
System.out.println("Enter an angle in degrees : ");
a = Float.parseFloat(stdin.readLine());
s = Math.toRadians(a);
System.out.println("Sec "+a+" = " +(1/(Math.cos(s))));
break;
}
case 6 : {
System.out.println("Enter an angle in degrees : ");
a = Float.parseFloat(stdin.readLine());
s = Math.toRadians(a);
System.out.println("Cot "+a+" = " +(1/(Math.tan(s))));
break;
}
default : System.out.println("Ok good bye..............");
break;
}
}
}



Please help me in this matter
 

nithinks

True Techie
Can you explain what exactly you are planning to do?
I have developed a similar application using JavaBeans / JSP

May be I can give some inputs
 
Top Bottom