7,985 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for Shawne

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null. The error is from this line of code: home.addItem(new ModelItem(ID++, "Original Nuggets Meal", "", 90, "KFC", new ImageIcon(getClass().getResource("icon/img2.png")))); i use the correct folder as it is in a package in the same source of the file. please help!

Member Avatar for Shawne
0
96
Member Avatar for abhishek_s_n
Member Avatar for Sofiia
0
1K
Member Avatar for Read a Book

Hello everyone, i am in some kind of testing stage where i want to test some security flaws on websites/browsers with the cookies. I want to generate google cookies with a different time period. (older than 2 months). Firstly I will try to integrate into the browser via JS Secondly …

Member Avatar for AndreRet
1
295
Member Avatar for olong tea

This questions contains probability and I dont know how to work with it in Java import numpy import random def cup_game(): cashprice = [0.5, 1.0 , 2.0 , 5.0] n_turn = numpy.random.randint(5,11) n_mult = numpy.random.randint(3,6) cups = list(range(0,15)) x = numpy.random.choice(cashprice, 15, p=[0.3, 0.4, 0.2, 0.1]) x = list(x) turn …

Member Avatar for JamesCherrill
0
90
Member Avatar for olong tea

Hi, I am new to Java but familiar with python, I need to convert my code from python to Java can anyone help me? Much appreciated! import random suits = ['C', 'S', 'H', 'D'] val = list(range(1,14)) class Card: def __init__(self, suits, val): self.suit = suits self.value = val def …

Member Avatar for JamesCherrill
0
185
Member Avatar for mihailbog245

I don't get what's the problem with this Dictionary created using Arraylist and Socket . I get SocketException error I don't know why also I tried to created a method to read.... ClientCode: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.util.Scanner; import java.net.SocketException; public class Client …

Member Avatar for JamesCherrill
0
144
Member Avatar for LevelSix

I'm trying to create two car objects, that move across the frame, in opposite directions, at different heights so they don't collide. This type of programming is new to me, and after following the only example I'm provided with, I still can't get this to work. All the code I …

Member Avatar for Rosayu
0
3K
Member Avatar for mikewyatt

I have a very complex java program written with net beans 7.1. It consists of 1 .java file that has a main(), and over 25 supporting .java files (most used for routines inside of tabs). In addition there are 15 different databases (embedded) associated with it. The program is virtually …

Member Avatar for Charls_1
1
850
Member Avatar for jspence29

I am writing a program that makes hands of five cards, and tests them against poker combinations. Wikipedia says you have a 1/254 chance in getting a straight, but I get an abysmally small mount of straights in each run. (around 50 in one million hands). Can anyone tell me …

Member Avatar for Prasanna_9
1
1K
Member Avatar for dsmush

[SIZE=4][FONT=Arial]Hi, I'm creating an application that makes use of the GridBagLayout as it is the most useful layout manager for what I need. I made a JPanel and added it to the frame. The result I'm currently getting during run-time is a JFrame with a JPanel placed in the center. …

Member Avatar for Toby_6
1
3K
Member Avatar for priyamtheone

I'm broadcasting an intent in my app and receiving it with a broadcast receiver. I can handle the broadcasting and receiving. No problem with that. However, I want to register the receiver completely programmatically instead of doing it in the manifest file. Notice, that in the manifest file, there are …

Member Avatar for priyamtheone
0
55
Member Avatar for Nicole_18

How to draw this cat with: Rendering fill Suitable primitives Aligned texture ![Screenshot_20220402-020429_Office.jpg](https://static.daniweb.com/attachments/4/e9a4f2eda3f42e689b0de42dcd9465ba.jpg)

1
270
Member Avatar for LianaN

Hi! I'm trying to improve a code shown below. My idea is to add multiple images to JPanel. It sounds like an easy task, but all my attempts failed so far. I tried to create [ICODE]Image image2 = getToolkit().getImage(Drag1.class.getResource("cross_cursor.gif"));[/ICODE] and then [ICODE]bi2 = new BufferedImage(image2.getWidth(this), image2.getHeight(this)...);[/ICODE]. But I can see …

Member Avatar for ivy.inc.Hugh
1
2K
Member Avatar for moosh101

Hello everyone! I am writing a program for the birthday paradox that runs trials 10,000 times. I want to show that when N people are in a room, there is a 50% chance that there will be a duplicate birthday. I want to create an empty set, then add to …

Member Avatar for toneewa
3
537
Member Avatar for federerforehand

I do not know where to even start :'( can someone please write the code so I can see the process and I can do other problems that are similar to this... For this programming project, you will create a program that will both design and implement a class that …

Member Avatar for Jerry_23
-2
4K
Member Avatar for jeff79
Member Avatar for shak187

hi there i have some python coding which i need to convert to java can ne1 help me please email me back if you can help then i will show you the coding much appriciated

Member Avatar for eliasarximan
2
153K
Member Avatar for AbstractEden

I've been having a tough time trying to figure this one out. Wrote a couple of notes on my phone and ended up with this as a result: import java.io.*; import java.util.Scanner; public class Assignment1 { //Returning if a character is a vowel or not. public static boolean isVowel(char c) …

Member Avatar for alex205
0
3K
Member Avatar for Kurosaki

Hi. I'm new to java programming and I need help with this assignment. [quote]Giving change. Implement a program that directs a cashier how to give change. The program has two inputs: the amount due and the amount received from the customer. Compute the difference, and compute the dollars, quarters, dimes, …

Member Avatar for JamesCherrill
0
7K
Member Avatar for Sagar_9

Hi All, Good Day. Is there any sample code in JAVA for generating encrypted block PIN in the similar fashion as the Hardware Security Module Regards, Sagar

Member Avatar for Sagar_9
0
91
Member Avatar for redZERO

Hi guys I can't seem to get a new line in a [CODE]JOptionPane.showMessageDialog(null, " ");[/CODE] statement. I try the /n command, but it still doesn't seem to work. Is there any way I can get a paragraph in a dialog box like this? Thanks.

Member Avatar for Samukelo
0
18K
Member Avatar for Sagar_9

Hi Everyone, Is there a java code to convert SWIFT MT103 message to pacs 008 ISO20022 format? Thank you. Regards, Sagar

Member Avatar for Sagar_9
0
419
Member Avatar for ray.chappel

/*******************************************************************************************************************| | Assignment 2 | | Program is meant to extract a record from each file and create a new file for each record | | Programs creates a new directory and uses the directory for each new file | | | | written by Raymond Chappel | | | …

Member Avatar for LohithS
0
179
Member Avatar for Malik_32
Member Avatar for Xeros606

Not an ArrayList. An Array. For some reason, my teacher (or rather, the lesson plan we are using) requires that we make a program that takes an array of integers and removes all the zeroes. So far I have: [CODE] public void remove(int index) { for(int i = index; i …

Member Avatar for JamesCherrill
0
3K
Member Avatar for clementer

I have an ArrayList of 750 elements I would like to divide that ArrayList into 150 subarraylists so 5 elements to each subarraylist. I have this code but it not working while (scanner.hasNextLine()) { String t = scanner.nextLine(); String[] ar = t.split(","); for (int i = 0; i < ar.length; …

Member Avatar for rproffitt
0
106
Member Avatar for Debby0424

Hello All, I am submitting a inventory program that I need some help with. I had to create a product class that holds the item number, the name of the product, the number of units in stock, and the price of each unit. Then I needed to create a java …

Member Avatar for Batha
0
7K
Member Avatar for Gabriela_4

Hello! So I have this homework that i have no idea how to continue. this is an exemple of input,but i have to do it for a general one: **7 pencils car ball candy tshirt bike video_game Mike Andrew Inna** and the output must be like this: **Mike: pencils candy …

Member Avatar for rproffitt
0
165
Member Avatar for Archenemie

Im looking for the "best" GUI builder for java. I use Eclipse to write my scripts, and i would appreciate you guys telling me your favourite GUI Builder and the reasons why. Thanks

Member Avatar for dotxyteam
0
2K
Member Avatar for Rabana_1

def Count_Total_Words(str1): total = 1 for i in range(len(str1)): if(str1[i] == ' ' or str1 == '\n' or str1 == '\t'): total = total + 1 return total string = input("Please Enter your Own String : ") leng = Count_Total_Words(string) print("Total Number of Words in this String = ", leng)

Member Avatar for rproffitt
0
114

The End.