35,618 Topics

Member Avatar for
Member Avatar for chdboy

Here is the error I'm getting Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input == null! And here is the code try { //myPicture = ImageIO.read(new File("Companylogo_FINAL.jpg")); myPicture = ImageIO.read(getClass().getResource("/resources/Companylogo_FINAL.jpg")); ImageIcon img = new ImageIcon(myPicture); frame.setIconImage(img.getImage()); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } JLabel lbl = new …

Member Avatar for chdboy
0
2K
Member Avatar for johnson_2

1. I created three JLabels(one,two,three) and add a mouselistener to it. 2. For every even turns, the program will allow me to click any of the JLabels **once** and print out the JLabel I have clicked. My program is throwing me the following errors Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java …

Member Avatar for johnson_2
0
285
Member Avatar for moaz.amin.37

if a program throw 2 exceptions can we handled it by user defined exception.for example import java.util.*; class WrongException extends Exception{ public WrongException(String s){ super(s); } } public class UserDefinedException2{ public static void main(String s[]){ int a,b; a=b=0; Scanner ob=new Scanner(System.in); System.out.print("Enter your age = "); a=ob.nextInt(); try { if(a<=0) …

Member Avatar for JamesCherrill
0
256
Member Avatar for didi1111

i have a jframe JFrame f = new JFrame(); f.setvisible(true); I want when I open this frame it play a sound what can I do in java?

Member Avatar for Hiroshe
0
53
Member Avatar for moaz.amin.37

Following exceptions are `Checked Exception` or `Unchecked Exception` ArrayStoreException IllegalArgumentException

Member Avatar for JamesCherrill
0
291
Member Avatar for moaz.amin.37

exception is a run time error,then why exceptions are again classified into compile time exception and run time exception,in that case it should be run time exceptions only.please give explanation with suitable real time example

Member Avatar for moaz.amin.37
-1
331
Member Avatar for Slavi

So, basically I tried to do everything i found to fix this but nothing really worked .. (It works fine on my 32 bit pc using elementary os(Luna linux). However my laptop has Kali Linux 64 bit. I have chromium installed. Some of the things that I tried which worked …

Member Avatar for Slavi
0
175
Member Avatar for chdboy

import java.awt.Frame; import java.awt.SplashScreen; import javax.swing.JOptionPane; public class NewFrame extends Frame { public NewFrame() { // TODO Auto-generated constructor stub SplashScreen splash = new SplashScreen(1000); System.out.println("This is working"); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub //SplashScreen splash = new SplashScreen(2000); …

Member Avatar for JamesCherrill
0
304
Member Avatar for screenedcreamy

I've been programming in java for almost 5 years now. I'm self-taught, so while I know how to program, I don't know some of the more formal aspects of computer science. So if i were to brush up my knowlegde on algorithms and data structures using java which books can …

Member Avatar for screenedcreamy
0
234
Member Avatar for brittney_2

I don't have a code that needs solving, but merely a simple explanation if possible from an example in a book. There isn't much explaining and I just need to know how this line of code checks to make sure the date entered does not occur in April. The [0-35-9] …

Member Avatar for brittney_2
0
213
Member Avatar for moaz.amin.37

i am confuse about `paint()` method in applet .The confusion is that paint method is getting object as parameter of Graphics class like this `public void paint(Graphics g)` and i read that the Graphics class is an abstract class then how we create object of Graphics class and now you …

Member Avatar for JamesCherrill
0
381
Member Avatar for samuel.tenderfeet

I recently submitted an assignment to my instructor, and i got a less than desirable grade and the jist of the marks were that iw as using hard coded variables so can someone explain to me how to use the getter method a little better? (i assume thats what i …

Member Avatar for stultuske
0
147
Member Avatar for abeer araji

thanks all for help im new in the website and i dont even know how to use it well im not a cheater or any thing else and i will not copy past any thing !! Im here just to learn

Member Avatar for JeffGrigg
0
135
Member Avatar for Violet_82

Hi guys, I run into a problem. I am trying to write a small program. There should be 4 radio buttons and each of them controls the colour of the Content Pane. The problem I have is with the anonymous inner class (I hear JamesCherrill muttering "why do you bother?", …

Member Avatar for JamesCherrill
0
298
Member Avatar for Jack_9

In my opinion, c# is better then java. Espicially because it runs upon the .NET framework. But java can run on virtually any device. They re both alot alike, so which one would be better to learn?

Member Avatar for ChrisHunter
-1
240
Member Avatar for asaidi

Hi i m using my host to save mysql database.. when i fill the fields the data is saved ..but i m keeping getting this error ..and really the data input is saved i dont understand why.. the error i get thank you in advance com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The …

Member Avatar for asaidi
0
300
Member Avatar for monkeybut

I am creating an AlertDialog that I can enter a new value into a SQLite database. The Insert method works if I call it by itself in the onCreate() method, but when I try to call the method in the setPositiveButton onclick listener it doesn't work, it gives me a …

Member Avatar for monkeybut
0
1K
Member Avatar for rowen_1

Requirements 1. the user clicks the button(Go to animation page) at page one 2. the user will be directed to page two whereby an animation is played for 5 seconds 3. after 5 seconds, the user will be directed to page three. I am trying to delay a page for …

Member Avatar for JamesCherrill
0
183
Member Avatar for Steven_9

I am currently taking java and learning how to create GUI. I am trying to create a GUI whereby 1) Upon executing the application,the user will need to key in his username and password. 2) the user will be brought to second page which displays "Welcome to Page Two!" if …

Member Avatar for Steven_9
0
2K
Member Avatar for soujanya.bhat.184

Hi Guys, How to write the contents of JList into a text file. i have a JList and i want to add the list elements to a text file. How to do this?

Member Avatar for stultuske
0
285
Member Avatar for abeer araji

1. Write a program that asks the user to enter five integers and then adds and outputs the sum of odd integers, and adds and outputs the sum of even integers. For example, if the user enters the integers 7, 4, 2, 1, and 3 then the program should output …

Member Avatar for stultuske
-1
175
Member Avatar for mgold

I love the idea of dependency injection. I started doing psuedo dependency injection on my own before I knew about DI because I was frustrated programming without it. I then discovered Guice. From a program design point of view, I like it a lot. Everything is much more decoupled and …

Member Avatar for JeffGrigg
1
294
Member Avatar for prakash2813

There is a String object called detailMessage in java.lang.Throwable class, which says the reason of any exception thrown in java code. This object is initialized through a constructor using super(string message) statement or setter or whatever from subclasses like Exception and again from its subclasses like SQLException. When SQLException is …

Member Avatar for JeffGrigg
0
193
Member Avatar for moaz.amin.37

first se these methods setForeground(Color.cyan); setBackground(Color.red); these methods are defined in Component class like this java.awt.Component and we pass parameters of an other class this is very confusable for me that we pass class members as parameters to method of a different class, i mean `setForeground(Color.cyan)` i defined in Component …

Member Avatar for stultuske
0
217
Member Avatar for quontra123
Member Avatar for gagun

I am trying to write a output for my log in file on the desktop but for somereason, it is not doing that.It says the file cant be instantiated. I have the code and console output below. Any help would be much appreciated. thanks in advance. ### direct log messages …

Member Avatar for ~s.o.s~
0
2K
Member Avatar for justinelinz.sonenclar

THis is my question and I have no idea how to do it. Write a GrowSquarePrinter program that constructs a Rectangle object square representing a square with top-left corner (100, 100) and side length 50, prints its location by calling System.out.println(square), applies the translate and grow methods, and calls System.out.println(square) …

Member Avatar for iamthwee
0
319
Member Avatar for moaz.amin.37

i am very confuse about java applets so please solve my questions my question is that when we write applet then we write only methods defination not method calling so i am confuse about this that who call the methods of applets.and second is that we call the methods of …

Member Avatar for JamesCherrill
0
260
Member Avatar for mikewyatt

Hey everyone...... Sorry I havent been around for a while... had a heart-attack and havent been here for a while. Doing much better now! I am needing research material for networking multiple computers together that allow data transfer/updating in both directions. Note this is not for databases, even though there …

Member Avatar for JamesCherrill
0
193
Member Avatar for asaidi

Hi i m trying to get selected from jradiobutton..i m using eclipse and windowbuilder for java please check my code JRadioButton btn1 = new JRadioButton("By Trading Name",true); btn1.setBounds(22, 48, 149, 23); contentPane.add(btn1); JRadioButton btn2 = new JRadioButton("By Overshop",false); btn2.setBounds(22, 75, 149, 23); contentPane.add(btn2); JRadioButton btn3 = new JRadioButton("By Address",false); btn3.setBounds(22, …

Member Avatar for JamesCherrill
0
226

The End.