202 Posted Topics

Member Avatar for rayden150

You can also use html format with a JLabel like this: [code] String text = "<html><pre>"; text += "*********<br>"; text += "* *<br>"; text += "* *<br>"; text += "* *<br>"; text += "* *<br>"; text += "* *<br>"; text += "*********<br>"; JLabel label = new JLabel(text); [/code] Note that …

Member Avatar for kramerd
0
226
Member Avatar for sciprog1

1. Create a panel for the buttons: [CODE] JPanel buttonPanel = new JPanel(); [/CODE] 2. Add your buttons to the buttonPanel 3. Give the frame a border layout: [CODE] m.setLayout(new BorderLayout()); [/CODE] 4. Add the label to the center of the frame: [CODE] m.add(r, BorderLayout.CENTER); [/CODE] 5. Add the buttons …

Member Avatar for sciprog1
0
187
Member Avatar for sirlink99

You can create a Timer object (from the swing package, not the util package). You give it a delay (in milliseconds) and an ActionListener, and then you start the timer. After that, every time the timer goes off, the actionPerformed method in the ActionListener is called. So to make your …

Member Avatar for kramerd
0
152
Member Avatar for rayden150

There are many ways to do this. For example: 1. Serialize the class that stores the data 2. Write out a text file with your data 3. Write out an XML file with your data 4. Write out a properties file 5. Save data as preferences (OS specific) If you …

Member Avatar for kramerd
0
110
Member Avatar for Zibo

This doesn't answer your question directly, but as an alternative, you can have the JVM load the classes from your jar file using [CODE] java -Djava.ext.dirs=lib\swing.jar; <your class here> [/CODE]

Member Avatar for Zibo
0
183
Member Avatar for divyakprabh

I don't know if it applies, but [URL="http://wiki.apache.org/tomcat/HowTo#I.27m_encountering_classloader_problems_when_using_JNI_under_Tomcat"]this link[/URL] might help you.

Member Avatar for divyakprabh
0
126
Member Avatar for sirlink99

Not sure this is what you are looking for, but here are a couple links that might help. [URL="http://www.exampledepot.com/egs/java.applet/LoadImageApplet.html"]http://www.exampledepot.com/egs/java.applet/LoadImageApplet.html[/URL] [URL="http://www.realapplets.com/tutorial/ImageExample.html"]http://www.realapplets.com/tutorial/ImageExample.html[/URL]

Member Avatar for kramerd
0
216
Member Avatar for akinfemi

You need to look up the documentation for GImage. Where does this class come from?

Member Avatar for kramerd
0
106
Member Avatar for BLUEC0RE
Member Avatar for BLUEC0RE
0
140
Member Avatar for hwalsh

The problem is in printA, you declare the grade array list, which hides the member variable of the same name. Remove this line: [CODE] ArrayList<Integer> grade = new ArrayList<Integer>(); [/CODE]

Member Avatar for Overbooked
0
2K
Member Avatar for shakssage

You can do simple animation in Java by using a [URL="http://download.oracle.com/javase/6/docs/api/javax/swing/Timer.html"]Timer[/URL] object (from the swing package, not the util package). You give it a delay (in milliseconds) and an ActionListener, and then you start the timer. After that, every time the timer goes off, the actionPerformed method in the ActionListener …

Member Avatar for shakssage
0
1K
Member Avatar for lee.j.baxter

Here are some links. [URL="http://download.oracle.com/javase/tutorial/uiswing/dnd/intro.html"]http://download.oracle.com/javase/tutorial/uiswing/dnd/intro.html[/URL] [URL="http://download.oracle.com/javase/tutorial/uiswing/examples/dnd/index.html"]http://download.oracle.com/javase/tutorial/uiswing/examples/dnd/index.html[/URL] [URL="http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html"]http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html[/URL] By the way, I used the following search terms in Google to find these. java drag and drop tutorial

Member Avatar for kramerd
0
225
Member Avatar for hiks

I don't think anyone here knows what that string of words means. Can you describe what you are trying to do?

Member Avatar for kramerd
0
120
Member Avatar for orkuncanbay

[URL="http://quizstar.4teachers.org/"]This site[/URL] might be what you are looking for?

Member Avatar for orkuncanbay
0
180
Member Avatar for flyingcurry

You have a misplaced semicolon at the end of line 21. That means the loop body does nothing, and then after the loop executes, you print the last element of the array and the value of i (which is 5 after the loop executes). I'm guessing that's why your loops …

Member Avatar for apines
0
176
Member Avatar for amit.hak50

Datatype "int" in Java uses 4 bytes, range -2,147,483,648 to 2,147,483,647, Datatype "long" uses 8, range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. [URL="http://download.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html"](source)[/URL]

Member Avatar for apines
0
200
Member Avatar for rational_
Member Avatar for minimi
Member Avatar for apines
0
142
Member Avatar for intes77

First, if you need more than one char (e.g. "05"), you cannot store this in a char variable because char can only store a single character (e.g. '0'). So your Month, Day and Year variables should be String instead. Second, char in Java can be interpreted as a number, since …

Member Avatar for intes77
0
441
Member Avatar for jemimaloh

The problem is you are doing integer division, which will truncate rather than round as you expect. In Java, [icode]5/2 = 2[/icode] and [icode]2/5 = 0[/icode]. To fix this problem, you need to make one of the operands in the division a floating point type (either float or double). Again, …

Member Avatar for jemimaloh
0
97
Member Avatar for 080346

Try [icode]setVisible(false);[/icode] to hide and [icode]setVisible(true);[/icode] to show.

Member Avatar for kramerd
0
86
Member Avatar for Iamthecheese

I'm not positive about all the intricacies of templates in Java, but I believe since you have [icode]<T extends Comparable<T>>[/icode] in your class declaration, you can assume that the class for item implements the Comparable interface. That means you can call compareTo, which returns an int, which can be compared …

Member Avatar for kramerd
0
182
Member Avatar for BboyRodimus

Line 35 in main says [CODE] double min = findMin(NumArray, 0, NumArray.length); [/CODE] Then in [icode]findMin[/icode], line 54 says [CODE] else if ... < NumArray[endIndex]) [/CODE] Remember in Java that array indices go from 0 to length-1. So you can't access [icode]NumArray[[B]endIndex[/B]])[/icode]. You are beyond the bounds of the array.

Member Avatar for kramerd
0
499
Member Avatar for Roy1287
Member Avatar for Chalandria

The instructions seem pretty clear to me, so I'm not sure what you're having problems with. Reread the part about what your action listeners need to do and try to do those steps in each of your action listeners. Also note the instructions are very explicit about what belongs in …

Member Avatar for Chalandria
0
164
Member Avatar for seekdestroy

There's a for loop in Java that lets you go over each element in a collection. It looks something like this: [code] for (<datatype> <variable> : <collection>) { // do something here with <variable> } [/code] A more concrete example. Say you have an ArrayList called myList, and it stores …

Member Avatar for apines
0
13K
Member Avatar for CompSci_Guy

You are being asked to generate an array of strings. The input variable times tells you how many strings to generate using the grammar. Assuming the generate method you wrote correctly generates a single string using the grammar, then keep that method as a helper, and implement the method asked …

Member Avatar for Taywin
-1
1K
Member Avatar for Donnovan

If you want to insert a node into the middle of a linked list, you need a loop that moves through the list and a counter that increments at each move. When you have moved through the correct number of nodes, then you need to insert the new node in …

Member Avatar for Donnovan
0
99
Member Avatar for Awesomeness

I don't think Math.max is what you need to solve this problem. It seems to me that at each level you just want to add 1 to maxDepth.

Member Avatar for Awesomeness
0
111
Member Avatar for SomeNewGuy

1. You can use a do...while loop, rather than a while loop so you check the condition at the end of the loop instead of at the beginning. 2. You should put everything from the prompt to enter the website on inside the loop. 3. Think about what the condition …

Member Avatar for kramerd
0
111

The End.