32,199 Topics

Member Avatar for
Member Avatar for desup

Hi, I am new to java and I need to work with arrays. I have found some tutorials, but everywhere was something like [CODE] int[] anArray; // allocates memory for 10 integers anArray = new int[10]; [/CODE] But what if I dont know how long the array will be? When …

Member Avatar for desup
0
152
Member Avatar for carolinatech

hey everyone, I'm trying to perform a program that will perform a leap year method and also have it to loop. here's what i have so far: import java.util.Scanner; public class LeapYear { //Create a Scanner object for keyboard input. static Scanner keyboard = new Scanner(System.in); //Set variables public static …

Member Avatar for zeroliken
0
283
Member Avatar for jinneebhat

I have a requirement to copy files from a temporary file directory to a unix file system using scp. Please provide me a sample code for this

Member Avatar for ejosiah
0
79
Member Avatar for techyworld

Can someone help me on how to draw a dynamic pie chart in java? I don't want to use jfreechart. I want to use jtable or other methods if available(but simple one) I have one but it is static.i need to write it upon user input.how can i do it? …

Member Avatar for JamesCherrill
0
359
Member Avatar for mehnihma

I am trying to cast combo box to string but I have problems with it. I get NullPointerException? [CODE] fontStyle = (String)combo.getSelectedItem(); size = (String)comboSize.getSelectedItem(); if (fontStyle.equals("Regular") && size.equals("10")) { Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 10); text.setFont(font); } [/CODE]

Member Avatar for stultuske
0
140
Member Avatar for sharvil_maniyar

run: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.sun.java.swing.plaf.nimbus.NimbusStyle.init(NimbusStyle.java:418) at com.sun.java.swing.plaf.nimbus.NimbusStyle.validate(NimbusStyle.java:359) at com.sun.java.swing.plaf.nimbus.NimbusStyle.getValues(NimbusStyle.java:927) at com.sun.java.swing.plaf.nimbus.NimbusStyle.getInsets(NimbusStyle.java:605) at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:896) at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:275) at javax.swing.plaf.synth.SynthLabelUI.updateStyle(SynthLabelUI.java:53) at javax.swing.plaf.synth.SynthLabelUI.propertyChange(SynthLabelUI.java:232) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339) at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276) at java.awt.Component.firePropertyChange(Component.java:8128) at java.awt.Component.setName(Component.java:935) at javax.swing.plaf.synth.SynthComboBoxUI$SynthComboBoxRenderer.getListCellRendererComponent(SynthComboBoxUI.java:409) at javax.swing.plaf.basic.BasicComboBoxUI.getDisplaySize(BasicComboBoxUI.java:1334) at javax.swing.plaf.basic.BasicComboBoxUI.getMinimumSize(BasicComboBoxUI.java:903) at javax.swing.plaf.basic.BasicComboBoxUI.getPreferredSize(BasicComboBoxUI.java:892) at javax.swing.JComponent.getPreferredSize(JComponent.java:1634) at javax.swing.GroupLayout$ComponentSpring.calculateNonlinkedPreferredSize(GroupLayout.java:2944) at javax.swing.GroupLayout$ComponentSpring.calculateNonlinkedMinimumSize(GroupLayout.java:2930) at javax.swing.GroupLayout$ComponentSpring.calculateMinimumSize(GroupLayout.java:2897) at javax.swing.GroupLayout$Spring.getMinimumSize(GroupLayout.java:1315) at javax.swing.GroupLayout$ComponentSpring.calculatePreferredSize(GroupLayout.java:2904) …

Member Avatar for JamesCherrill
0
801
Member Avatar for ringo_tech

hi i have another network problem! when i close the socket in server side or the client side i get connection reset exception and then i'm not able to reconnect without resetting the server then start the client again, so how can i close a socket and reconnect without resetting …

Member Avatar for RicardoE
0
83
Member Avatar for ujjwale
Member Avatar for stultuske
0
124
Member Avatar for MozammilK

Hi, i have the following code in Java as you can see there are a lot of code repetition. I want to know how i can loop this part of code instead of writing it each time? [CODE] g.setColor( Color.black ); g.fillArc( 110, 80, 300, 300, 0, valint[0] ); g.drawString("BMW", …

Member Avatar for stultuske
0
115
Member Avatar for riahc3

What is the best way to start/stop/restart Apache Tomcat using Java code? If it cant be platform dependent (or complicated or I have to do a "IF" for each), then only for Windows. Thanks

Member Avatar for RicardoE
0
250
Member Avatar for Gnawk

Hi the project i have is Write a program that displays diamonds as text using a character provided by the user. For example, a diamond of height 6 constructed from asterisks will display as follows: __* _*** ***** ***** _*** __* (I cant make it line up perfectly... ) after …

Member Avatar for Gnawk
0
332
Member Avatar for vuquanghoang

I do the program to practice what I have learned in a class at my university(convert input of infix form to post fix one), but my program doesn't run correctly. Please help my to find out my bug. == IntoPost class /* * To change this template, choose Tools | …

Member Avatar for vuquanghoang
0
199
Member Avatar for nickecarlo

I have the following piece of code. I do not understand why its not working. I'd really appreciate help on this. [CODE]import java.util.Scanner; import java.io.*; class ReadFiles { String [] codes = new String[99]; int i = 0; private Scanner readCodes; public void openCodesFile() { try { readCodes = new …

Member Avatar for nickecarlo
0
10K
Member Avatar for Gnawk

This is just a part of a program When my code asks me Enter diamond size ("short", "average", or "tall"): how do i make it so that if i don't put anything and press enter it asks me exactly same questions again?? i tried putting input.length() == 0 or input.equals("") …

Member Avatar for Gnawk
0
77
Member Avatar for mjacqu4

Hey, I'm trying to store data in a record store then sort it, but I'm getting weird results when I try to add anything to the recordstore object... I was using a for loop to add records, and I noticed that the recordStore contained way more records than I added. …

Member Avatar for mjacqu4
0
93
Member Avatar for herious89

please help me with my codes, it doesnt work somehow [CODE]import java.util.Scanner; public class calculateE { public static long factorial( int n ) { if( n <= 1 ) // base case return 1; else return n * factorial( n - 1 ); } public static void main( String [ …

Member Avatar for ejosiah
-2
95
Member Avatar for darsha

[QUOTE]i am trying to implement a fitness function for GA. i got a code written in python. i don't have any idea about python. can someone help me to convert it into java the code is here [/QUOTE] [CODE]# there are many ways to do an eigenvalue decomp, this is …

Member Avatar for FALL3N
0
568
Member Avatar for Hussam Alahmadi

i Write a program to check whether a matrix is an identity matrix but i do not know how to find it plz help me this my code [CODE]package javaapplication162; import java.util.Scanner; public class JavaApplication162 { public static void main(String[] args) { Scanner input = new Scanner (System.in) ; int …

Member Avatar for JamesCherrill
0
2K
Member Avatar for M.Waqas Aslam

hello ! basically i am working on .net , but now i want to learn java , is there any software like visual studio for .net .if yes then please can any one tell me or provide me any helpful link. Best Regards M.Waqas Aslam

Member Avatar for M.Waqas Aslam
0
174
Member Avatar for JamesCherrill

What (if anything) is the difference between these two? [CODE]String[] sa = {"ABC"}; String[] sa = new String [] {"ABC"};[/CODE]

Member Avatar for JamesCherrill
0
179
Member Avatar for nickliutw

I'm creating a program which has data in the linklist. I'm trying to print out the element in the linklist from head to tail and tail to end, but for some reason, I run into some compiler error. I don't know why it won't let me call the hasPrevious and …

Member Avatar for dantinkakkar
0
150
Member Avatar for EddieC

GUIdancer 3.2, the latest version of flagship automated GUI testing tool from Bredex, now "officially" supports Windows 7 and Vista, and includes additional enhancements to its library of pre-built test actions. It began shipping on Nov. 3. Before you decide that US$5785 is too much to pay for an automated …

Member Avatar for amilyjoe
-2
359
Member Avatar for xcrypted1

Hi everyone, I am working on a problem as follows: Write a program that draws a circle with radius 100 and center (200, 200). Ask the user to specify the x- and y-coordinates of a point. Draw the point as a small circle. If the point lies inside the circle, …

Member Avatar for xcrypted1
0
2K
Member Avatar for dcalladi

Hi Guys, I'm looking the syntax for a input mask that will allow me to input 1.23, 12.34, 123.45 into the JFormattedTextField i found something like ###.## but that doesn't work but something like ###-## wud work. just wondering if anyone knows how to do this with a mask or …

Member Avatar for mKorbel
0
351
Member Avatar for lassy85

Can anyone assist me with the GUI for this program. I have tried several times will little luck. Here is the source code. Any help would be greatly appreciated. [CODE]import java.text.DecimalFormat; import javax.swing.JFrame; public class Inventory1 { public static void main(String[] args) { // Information on the Cds used Cd …

Member Avatar for lassy85
0
173
Member Avatar for jeffrey o

when i compiple this using rmiregistry, javac for HelloServer2 and HelloClient it says: I've attached all files as well java.rmi.NotBoundException: ReceiveMessageInterface <<No stacktrace available>> [CODE] import java.rmi.*; import java.rmi.registry.*; import java.rmi.server.*; import java.net.*; import java.util.Random; public class HelloServer2 extends java.rmi.server.UnicastRemoteObject implements ReceiveMessageInterface { String address; Registry registry; int a[]=new int[6]; …

0
137
Member Avatar for Syrne

Hi there, so I'm currently studying Java at my University and as of right now we're working on Linked Lists, Array lists, Array Deques, etc. As part of this lesson, we're being told to write our own versions, both recursive and iterative, of the predefined java functions for its corresponding …

Member Avatar for hfx642
0
222
Member Avatar for Murphyv10

Hello all. Can i get some help with my homework please. Im quite literally staring at a blan screen with very little done. Ive been quite sick recently and lost ground with the class. Ive watched You Tube videos and read oop books but to avail. I have to make …

Member Avatar for hfx642
0
80
Member Avatar for AbdullahJava

I don't know why it doesn't compile ! ! [CODE] import java.util.Scanner; public class Beach { public static void main (String [] args) { Scanner input = new Scanner (System.in); System.out.println("Enter the weather Hot or Cold"); String A; A = input.next(); System.out.println("Enter the type of day Sunny or Windy or …

Member Avatar for Philippe.Lahaie
0
84
Member Avatar for manoj_93

I am trying to calculate the number of code points that are present in a file, but it always showing me the number of characters being used. I am using string buffer to read the file, so I come to this part f d code [code]while ((sCurrentLine = br.readLine()) != …

Member Avatar for ~s.o.s~
0
119

The End.