LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Java Graphics in Linux (http://www.linuxquestions.org/questions/linux-software-2/java-graphics-in-linux-133324/)

hiteshmaisheri 01-10-2004 06:02 AM

Java Graphics in Linux
 
I am new to java so don't know how to do graphics in java using the swing packages... i have instaled java sdk for linux in my Red hat linux 9... but the graphical codes of java in windows don't work in linux... why does this happens can anyone tell me....

poison 01-10-2004 07:00 AM

they should work...
can you post some example code or post a link to let us know what exactly doesn't work ?

jcookeman 01-10-2004 08:09 AM

You shouldn't have any problems unless you're using deprecated MS stuff.

BTW...go over to www.netbeans.org and grab their IDE, it is beautiful!

hiteshmaisheri 01-11-2004 09:52 AM

Ok i will check the website and seee.....

Mega Man X 01-11-2004 12:17 PM

Are you trying to compile Java code with gcj? Because it compiles fine, but I've been trying to compile an imported class (javax.swing....) which has JOptionPane ( a graphical dialog box ) and it returns an error... no problems under Sun's j2sdk with javac compiler though...

dublinclontarf 02-07-2004 02:57 PM

difficulties using images
 
hey there, i have been having difficulty getting my java programs to use images such as gif or jpg.
Im using slackware9.1 j2sdk 1.4.2, & netbeans 3.5
ive been trying to get images to display in my GUI but no luck.whats even more strange is that it worked on windows. here is the example code.

Icon jim= new ImageIcon("PHOTO.JPEG");
JLabel jimLabel=new JLabel();

jimLabel.setIcon(jim);


jimLabel.setBounds(30,240,150,200);
contentPane.add(jimLabel);

the same sort of thing happened to me when i was using mandrake too.
another thing thats strange is the image will load up in the title bar using...
setIconImage(Toolkit.getDefaultToolkit().createImage
(Imigration.class.getResource("PHOTO.JPEG")));

whats happening here & how can i get around it?:scratch:

rmanocha 02-07-2004 03:05 PM

Quote:

Originally posted by jcookeman
You shouldn't have any problems unless you're using deprecated MS stuff.

BTW...go over to www.netbeans.org and grab their IDE, it is beautiful!

i have not used netbeans yet but i have use BlueJ and i think it is the best IDE ever....at least for school work.

Looking_Lost 02-07-2004 06:39 PM

Hold back,start again, what is the code you are trying to use exactly? (unusual to use jpeg extention rather than jpg but beyond that)

Mega Man X 02-07-2004 08:25 PM

Are you trying to run the application directly from the IDE? I mean, I use (or ratter saying, used, not anymore) DrJava (http://drjava.sourceforge.net/) it's the best IDE that I've ever used for Java. BUT, for some weird reason, all images would not run when executing the application directly from the IDE. But, If I've compiled (javac myProgram.java) and tried to run my application (java myProgram) at the console, it worked perfectly. I don't know the reason for this, but that could also be your case...

dublinclontarf 02-08-2004 08:42 AM

Yep thats it,your right.
When you run the app from the IDE it doesn't load the images but doing it from the console does.:)
Thanks for that MegaMan X.
I wonder why it does that?:scratch:
Ill have to ask sun that. :study:

Mega Man X 02-08-2004 11:39 AM

Cool dublinclontarf!!!

I've got tell you mate, I feel sorry that it does not work for you either. But it's kinda of a relief for me to know that there're no ghosts wandering my computer (unless there're some ghosts at your machine too):D lol.

I've tried to find an explanation for it on the net, but I was unsuccessful. If you ever find it, please let me know :D.

Thanks for the reply as well ;)

Cheers!


All times are GMT -5. The time now is 12:07 AM.