Posts
 
Reputation
Joined
Last Seen
Ranked #782
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
89% Quality Score
Upvotes Received
53
Posts with Upvotes
51
Upvoting Members
29
Downvotes Received
5
Posts with Downvotes
5
Downvoting Members
5
6 Commented Posts
1 Endorsement
Ranked #858
Ranked #425
~79.8K People Reached
Favorite Tags
Member Avatar for m.a.x

Below is some code I took from a recent project with a JFileChooser. I hope this is what you mean. The class this was in extended JFrame. [CODE] private JFileChooser chooser = new JFileChooser (); //....// chooser.setDialogTitle ("myTitle"); chooser.setFileSelectionMode (JFileChooser.FILES_ONLY); chooser.setAcceptAllFileFilterUsed (true); chooser.setFileFilter (new ExtensionFileFilter (".txt", new String[] {"text" })); …

Member Avatar for JamesCherrill
0
1K
Member Avatar for Timlince55
Member Avatar for RaigaX9

What I can see from the picture, is that you need to clear your screen on a repaint(). Two ideas: - Call super.paint(g); in the first line of your paint method. This is the paint method of the super class, it might help. - Call a clearRect(0,0,getWidth(), getHeight());. This clears …

Member Avatar for mic0280
0
575
Member Avatar for rahulrulez

Add this in the method you want to launch your JFrame in. [CODE]JFrame frame = new JFrame("Title"); frame.setDefaultClose(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.add(new JLabel("new window!"));[/CODE]

Member Avatar for stultuske
0
1K
Member Avatar for hallepalle
Member Avatar for NormR1
0
15K
Member Avatar for sugir1987

What have you tried? Show some code, and what you need. We will NOT do any of your homework, just help you with the problems with it.

Member Avatar for NormR1
0
163
Member Avatar for shean1488
Member Avatar for shean1488
0
96
Member Avatar for Sanna.1

Please use code tags to display code on this forum, to make it more readable for the people that have to answer you. Also, please try to construct normal sentences, so we will be able to understand you. Ontopic: You can do exactly what you already showed. [CODE]boolean bool1 = …

Member Avatar for JamesCherrill
0
294
Member Avatar for y0ge5h

This sounds like a homework assignment, rather than a question. Post the following in this thread before anyone here will help you: - Your code - Your problem - What you have tried so far Thanks, we are not a homework factory here

Member Avatar for hiddepolen
0
75
Member Avatar for jmace

See the screenshot, I get a value of 147! No change in your code... PS, What do you mean by 'sometimes'? Usually programs give the same output, whether you run them once or 100 million times...

Member Avatar for JamesCherrill
0
3K
Member Avatar for Goldfinch

[CODE] public class TestProg2{ public static void main(String args[]){ String filler1="Rank"; String filler2="Suit"; Card card = new Card(); System.out.println(card); } } class Card{ public String Card(){ String test="of"; return test; } public String toString () { return "This is the toString() method in the Card Class"; } }[/CODE]

Member Avatar for DavidKroukamp
0
130
Member Avatar for ThaiAmL

That is NOT an error of Java, you cannot instantiate an abstract class, because it is abstract! You shoul override it with another class, override the abstract methods in that class, and now you can create objects from that class!

Member Avatar for stultuske
0
717
Member Avatar for christian03
Member Avatar for 3nrichedd

I think you need to remove the extension of the ArrayList<>. [CODE] public class GroceryList { ArrayList<GroceryItemOrder> list = new ArrayList<GroceryItemOrder>(); public GroceryList(String name, int quantity, double unitPrice){ // do something nice with the parameters } public void add() { GroceryItemOrder tempGIO = new GroceryItemOrder(); // do init... list.add(tempGIO); } …

Member Avatar for hiddepolen
0
251
Member Avatar for jackbauer24

Ah, overloaded constructors. A question from my side, how much does your child know about overloading? I'll try to explain: We have a class, Box, and we want to have three constructors for it, one for each possible way to make class. The first possibility is a box of which …

Member Avatar for jackbauer24
0
171
Member Avatar for furqanishaq
Re: JAVA

Please use the CODE tags, to make the code readable. Your code looks OK, what's actually wrong with it? A tip for any future Java coding: Use Java naming conventions: Classes start with a capital letter (MyClassIsThis), and variables and methods start with a lowercase letter (myMethodIsHere, myVariablesName).

Member Avatar for DavidKroukamp
0
115
Member Avatar for macdunk11
Member Avatar for clerisy

What is the OP asking: books or YouTube? Please! OT: Check this thread on SO: [url]http://stackoverflow.com/questions/477748/what-are-the-best-c-sharp-net-books[/url]. It should help you out.

Member Avatar for mani-hellboy
0
208
Member Avatar for vijay496
Member Avatar for behemothdave

Please, use the following for your labels: [CODE] JLabel [] labels = new JLabel[20]; MyClass() { setLayout(new FlowLayout()); for (int i=0; i<labels.length; i++) { labels[i] = new JLabel (String.valueOf (i+1)); add(labels[i]); } }[/CODE]

Member Avatar for stultuske
0
1K
Member Avatar for scheppy

Try new Boolean(false). Notice the capital letter. boolean is a primitive type, while Boolean is an object.

Member Avatar for scheppy
0
275
Member Avatar for webdragon89

I'll give some steps (you are really going in the right direction): - loop from 2 to the user-entered number - within the loop, loop from the current number to the square root (what you are doing) - if the number is a prime: - print the prime using System.out.print(prime). …

Member Avatar for hiddepolen
0
638
Member Avatar for freakybeavis

This is JavaScript, not Java. Please remove this thread, and move it to a JavaScript sub forum.

Member Avatar for javaAddict
0
157
Member Avatar for LogicalOutlier

You are using condensed for loops with your int arrays, which can be tricky. Ints are not objects but primitive types, so if you change it within the loop, the value in the array will NOT be changed. If you use [CODE]for(int j=0; j<students; j++)[/CODE] you can access and change …

Member Avatar for hiddepolen
0
2K
Member Avatar for rotten69

If you give an object in stead of a String in a method, the object's toString() method is called. In your example, this is happening in the line [CODE]System.out.println(b); // You pass an object instead of a String[/CODE]. What really is executed: [CODE]System.out.println(b.toString());[/CODE]

Member Avatar for rotten69
0
311
Member Avatar for janfritz

I think the best solution is to: - make a class with: - four variables: x1, x2, y1 and y2. - keep a ArrayList<LineClass> of your generated lines - draw each line in the ArrayList on your JPanel using g.drawline(line.x1, line.y1, line.x2, line.y2) where line is the element of the …

Member Avatar for hiddepolen
0
231
Member Avatar for connect2abhi

In class A: [CODE]void myMethod () { B b = new B(); b.theMethodOfB(); }[/CODE] This also works when B has overridden a method from A. See [URL="http://docs.oracle.com/javase/tutorial/java/IandI/override.html"]http://docs.oracle.com/javase/tutorial/java/IandI/override.html[/URL] for more info

Member Avatar for DavidKroukamp
0
12K
Member Avatar for Bladtman242

Why are you not using JPanels as tabs? You can just add those to the JTabbedPane, and add any components to each tab you want!

Member Avatar for Bladtman242
0
199
Member Avatar for rotten69

@rotten: I think the best way to improve logic is doing it a lot. Keep making problems and solving problems, and you will find that the things you had problems with before, will be very easy. In my opinion books won't help, unless you don't understand a basic concept of …

Member Avatar for bibiki
0
212
Member Avatar for rotten69

Why do you have the inner loop with c? You don't do anything with b, and all you will get Loop terminated 0-5 printed 6 times. What exactly do you want?

Member Avatar for rotten69
0
182