35,618 Topics

Member Avatar for
Member Avatar for firepower

how do i change the background to a custom one. code JButton button = new JButton(); JButton quit = new JButton(); public Mainmenu() { Icon b = new ImageIcon(getClass().getResource("play.jpg")); play = new JButton(playb); add(button,BorderLayout.CENTER); Icon quitb = new ImageIcon(getClass().getResource("quit.jpg")); quit = new JButton(quitb); add(quit,BorderLayout.SOUTH); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent …

Member Avatar for JamesCherrill
0
209
Member Avatar for V3N0M

I just started learning Java and I have been playing around with it. I am trying to make this program return a double value like 1000/3 = 333.33333..... but it returns 333.000 what am I doing wrong in Java. It works in C though :P. Thanks in Advance! //Exercise : …

Member Avatar for JamesCherrill
0
210
Member Avatar for gyno

public class arraChange { public static void main(String []args){ int arr [] = {2,3,4,5,6,7,8}; public class arrayCounter { public static void main(String args []){ Random rand = new Random(); int freq[] = new int [7]; considering the above two seperate lines of codes, i just want people to explain to …

Member Avatar for JamesCherrill
0
142
Member Avatar for firepower

please help me how to close the window. code: JButton quit = new JButton(); public Mainmenu() { setLayout(new FlowLayout()); Icon quitb = new ImageIcon(getClass().getResource("quit.jpg")); quit = new JButton(quitb); add(quit); quit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } });

Member Avatar for mKorbel
0
166
Member Avatar for sankubha

I need to get printed documents name and from which ip it is printed using java.

Member Avatar for sankubha
0
219
Member Avatar for Pavan_5

I am trying to develop the genetic algorithm to solve Traveling Saleman problem and part of my challenge is to generate random tours long enough and write a fitness function to evaluate the cost incurred for each of the random tour. I have attempted to write the following. My objective …

Member Avatar for JamesCherrill
0
428
Member Avatar for Nimalshi

For example, How do I use this custom print method to display something in the main method? public static void print(Stack<String> myStack ) { int count = 1, sizeOfStack = myStack.size(); System.out.println("\nYour stack has size: " + myStack.size()); for (String myString : myStack) {System.out.print(count + ". " + myString); if(count!=sizeOfStack) …

Member Avatar for JamesCherrill
0
226
Member Avatar for Mr.M

Hi Dw I've recently created an application in java on this post:www.daniweb.com/software-development/java/threads/458306/how-to-work-with-jpos and now I just want to improve this by enabling a feature of mixing the cash notes when dispensing the required amount. The machine has these bills notes: 10, 20, 50, 100, and 200 so now what I …

Member Avatar for JamesCherrill
0
143
Member Avatar for Nimalshi

I'm writing this code for one of my projects. can you please help me with line #6,#7 and #10? I'm not sure if I am writing the code for those correctly. package waffles; import java.util.Scanner; import java.util.Stack; /** * */ public class Waffles { /** * @param args the command …

Member Avatar for Schol-R-LEA
0
161
Member Avatar for MatthewYeend

package die.java; import java.util.Random; class DieGame2 { private final int sides; private final Random generator = new Random(); public DieGame2(int s) { sides = s; } public boolean throwDie() { int faceValue = generator.nextInt(sides) + 1; System.out.print(faceValue); return faceValue == 6; } public static void main(String[] args) { DieGame die1 …

Member Avatar for stultuske
0
345
Member Avatar for essuku

Hi, Is there any java functions are availble to find mostly repeated characters in string ? Thanks

Member Avatar for C-Money
0
211
Member Avatar for woomar

Hi. I am very new to hashtable concept. Here is a skeleton of the methods I need to implement; BUT, my biggest question is the inner Entry class. Am I implementing the entry class correctly?Is my constructor correct? Thanks public class HashTable<K, V> { /** define an inner class to …

Member Avatar for JamesCherrill
0
213
Member Avatar for Stefce

Hello everybody i have a little problem with making a java command for program i have some code but i do not know how to continue i stuck in one place BTW the command i want to make is > /sendcash [username] [money] // how it looks like I have …

Member Avatar for stultuske
0
229
Member Avatar for LyingInAHammock

Basically I've created an **app drawer** and placed a **seekbar** within it. This app drawer is made up from **app_drawer.xml** whilst my fragment below is made up from **main_activity.xml**. The issue I'm having is, although the seekbar shows up perfectly and the app drawer pulls in and out as it …

0
163
Member Avatar for Xabush

I a software engineering student who took a Java course last semseter.But currenlty I'm self-studying Java for expanding my Java knowledge.The problem is that Java is a very vast programming language and I'm confused where to head next. I would say I'm on the intermediate level with regards to Java; …

Member Avatar for C-Money
0
233
Member Avatar for garyndeborah.kuhre

Trtying to figure out how to add 5 different methods into this class when the program already does all that is required but my prof will knock me if I dont put them in here, do thet need to be put in as private?

Member Avatar for C-Money
0
285
Member Avatar for firepower

i need good java eclipse tutorial iv'e watched theCherno,Thenewboston etc.i learned GUI,anonymousclass etc.i just need a good beginner tutorial on java eclipse.

Member Avatar for C-Money
0
217
Member Avatar for ZaneDarklace

Hello. I am working on this project and it asks me to make two columns of words that are ascending in one column and descending in the other. This is the Project: Call both your project and class AscendDescend. The first column should be in ascending order and the second …

Member Avatar for C-Money
0
237
Member Avatar for AhmadHasanSahi

i want code of Sorting techniques like insertion sort , merge sort , bubble sort , quick sort. i want their output in gui or in any animation form in any language like c , c# or java. can any one help me plz ?Any one sorting technique is ok.

Member Avatar for C-Money
-3
150
Member Avatar for polpulpol
Member Avatar for C-Money
0
91
Member Avatar for anisha.silva

Hi, I am trying to read a html page and convert into xml and copy the content into a txt file in the local drive. The code below is to read the html page: def cleaner = new HtmlCleaner() def node = cleaner.clean(address) // Convert from HTML to XML def …

0
94
Member Avatar for zsman19

Hi Im new to learning java so far ive picked up the basics of it but now im trying to create a first and best fit algorithm for the purpose of memory managment now my question is what to i specifcally need to learn to be able to to this …

Member Avatar for Tarek_2
0
148
Member Avatar for mr.sweetchuck

Hi, I'm trying to use the replace() method to take out all instances of " " , (space) with an underscore, ("_"). I'm doing this because I'm using URLs to connect to a servlet. I keep getting this error: [code] replace(char,char) in java.lang.String cannot be applied to (java.lang.String,java.lang.String) url.replace(" ", …

Member Avatar for stultuske
0
6K
Member Avatar for msolomon.ashish
Member Avatar for mukulnimker7751

Hi All, i am here with a problem in file handling in java. i need to search all the files on system with extention *.fdr. which are not less den one day old. then i need to convert the selected file to csv which is perfomed by a command in …

Member Avatar for JamesCherrill
0
368
Member Avatar for obscurecoder

I recently started coding in Java and have been trying to use the native methods to link code from other languages like C and C++. My code for the file is: [code=java] public class NativeDemo { int i; public static void main(String args[]) { NativeDemo ob = new NativeDemo(); ob.i …

Member Avatar for stultuske
0
191
Member Avatar for Varunkrishna

Hi everyone I need a suggestion on detecting the faults/bugs in a java program. To say I should check whether my program is faultless. Thanks, Varun Krishna. P

Member Avatar for stultuske
0
238
Member Avatar for Aya Safi

import java.util.Scanner; import java.lang.Math; public class Exercise1 { public static void main(String[] args){ double x,sum = 0.0 ; Scanner scan = new Scanner(System.in); System.out.print("Enter the number : "); x = scan.nextInt(); for(double i=0;i<=(x+1);i++){ Math.pow(x, i); fact(i); double y = (Math.pow(x, i)/fact(i)); sum += y; } System.out.println("The e^"+x+" for "+x+" is …

Member Avatar for jwenting
0
213
Member Avatar for PawelK

I have problem with Java session. I have a TplanServlet where I request values from html form and I am going to create Monday object with createMonday(). So I pass my form to this sevlet if (option.equalsIgnoreCase("createMonday")) { String title = request.getParameter("tpName"); String g1 = request.getParameter("g1"); String a1 = request.getParameter("a1"); …

0
92
Member Avatar for newbie14

I have UDP socket as below. I need to send back data to the client. I tried to capture both the ip and port but it shows me as Port is : -1 and InetAddress : null. What can I do to rectify on this? class ReceiverThread implements Runnable { …

Member Avatar for JamesCherrill
0
313

The End.