- Strength to Increase Rep
- +10
- Strength to Decrease Rep
- -2
- Upvotes Received
- 51
- Posts with Upvotes
- 49
- Upvoting Members
- 33
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
- Interests
- algorithms, music
- PC Specs
- E5200,Eizo FlexScan T57S,NetBeans IDE Win.XP
388 Posted Topics
Re: Write new class ie. ImageRectangle extends Rectangle and in single constructor put your BuferredImage and Rectangle parameters[CODE] public ImageRectangle(int x, int y, int w, int h, BufferedImage bi) { super(x, y, w, h); this.bi = bi; }[/CODE] Override Rectangle method[CODE]public boolean contains(Point p)[/CODE] write own method[CODE]public void drawImage(Graphics2D g2)[/CODE] Image … | |
Re: You have 4 possible directions: N,E,S,W. Implement them as boolean values. In your code N=true, E=S=W=false. Inside method check this N,E,S,W values. [CODE=java]public void run() { while (true) { this.requestFocus(); i++; if (N) { sLeftY -= 5; car.changePositionY(sLeftY); // same as your current method car.changePosition } else if (E) { … | |
Re: line 201-209 you lose the consistency between the content of the array "numbers" and the values of variables "a,b,c,d". | |
Re: [CODE] public static void main(String[] args) { Polynomial polyAdd = new Polynomial(); System.out.println(polyAdd.toString()); }[/CODE] [QUOTE]run: Exception in thread "main" java.lang.NullPointerException at Hanyouslayer.Polynomial.toString(Polynomial.java:162) at Hanyouslayer.Polynomial.main(Polynomial.java:213) Java Result: 1 [/QUOTE] Why it gives error, where are defaults... | |
Re: [CODE] private class BallPanel extends JPanel { private Paddle paddle; /** Creates a new instance of BallPanel */ public BallPanel() { paddle = new Paddle(FRAME_WIDTH, FRAME_HEIGHT); } public void paintComponent(Graphics g) { super.paintComponent(g); paddle.draw(g); System.out.println( "BallPanel:" + new Dimension(this.getWidth(),this.getHeight())); System.out.println( "paddle:" + paddle.area()); } /* public Dimension getPreferredSize() { return … | |
Re: Read line from file. String line="My name is abc.I am fbvnfdl.I am a girl."; There are three dots. Write method tokenize, using new StringTokenizer(".") Dot as delimiter. Result: 1. "My name is abc" 2. "I am fbvnfdl" 3. "I am a girl" Write 3. to file with dot at end. … | |
Re: Use class [B]java.lang.Integer[/B]. There are 3 static methods with [B]radix[/B] word. (radix can be [2,...,36]) ...or better yet, write a program that reflects the manual methods carried out on paper. | |
Re: A little help put the 57 line in place of 54 line Look at results. | |
| |
Re: for [I]input[/I] apply [I]CaretListener[/I] [CODE] // input.addActionListener(this); input.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { System.out.println(e); // TODO } });[/CODE] | |
Re: Set the names for sliders [B]jSlider1.setName("waveSlider1"); ...[/B] and inside [B]stateChanged[/B] method simply write [B]if ("waveSlider1".equals(source.getName())){[/B] | |
Re: When I do not have a file [U]account.txt[/U] program gives me stack overflow. The first use of your program should give the possibility to create new accounts. | |
Re: ScubaSam, ensure that all the set-methods inside Appointment.java are correctly written. ![]() | |
Re: If the system showed errors, show them. possible cases: -Your text file contains only single row (check this in line 34) [CODE]//34. System.out.println(row * 5 + column);[/CODE] - line 47 introduces an unwanted side effect (comment this line). | |
Re: You can use [I]while (true) {...}[/I] condition. And itself modify the condition out of the loop. | |
Re: Adding a Table to a Container [URL="http://download.oracle.com/javase/tutorial/uiswing/components/table.html"]http://download.oracle.com/javase/tutorial/uiswing/components/table.html[/URL] SimpleTableDemo.java as example | |
Re: Inside `public void addComponentToPane(Container pane) {` method, initialize `cl` variable, same way as in the first line of `public void actionPerformed(ActionEvent e){` method. Look at the runtime exceptions, base info for you: run: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at WeatherDelegator$1.actionPerformed(WeatherDelegator.java:60) at javax.swing.Timer.fireActionPerformed(Timer.java:292) | |
Re: [B]CoMIRVA[/B]: Collection of Music Information Retrieval and Visualization Applications -developed and maintained by Markus Schedl [URL="http://www.cp.jku.at/people/schedl/Research/Development/CoMIRVA/webpage/CoMIRVA.html"]http://www.cp.jku.at/people/schedl/Research/Development/CoMIRVA/webpage/CoMIRVA.html[/URL] | |
Re: Method [I]getPointsOf[/I] modifies your [I]origin[/I] instance of Point class (lines 32,33) If it is unnecessary use a local "clone". [CODE] public static ArrayList<Point> getPointsOf(int x, int y, Point orig) { Point origin = new Point(orig);/////////////////// ArrayList<Point> options = new ArrayList<Point>(); //System.out.println("=== " + origin.x + " " + origin.y); while … | |
Re: "vertical retrace artifacts come from rendering to the screen at the same time as the screen is being refreshed from video memory" [URL="http://today.java.net/pub/a/today/2006/02/23/smooth-moves-solutions.html"]http://today.java.net/pub/a/today/2006/02/23/smooth-moves-solutions.html[/URL] [URL="http://www.filthyrichclients.org/"]http://www.filthyrichclients.org/[/URL]-Chapter 13, Smooth Moves | |
Re: LexicalAnalyzer: method [B]public TokenType nextToken()[/B] line 26 [I]while (true)//there is a token[/I] method [B]public char nextChar()[/B] line 250-254 [I]else // end of file[/I] 1. first solution: change constant "true" to the variable, and set to false when "end of file" was detected, 2. second: change the [I]state[/I] variable to for … | |
Re: I recommend examples from the book:[URL="http://filthyrichclients.org/"]http://filthyrichclients.org/[/URL] download Examples Chapter 8, Image Processing go to CustomImageOp and GraphicsUtilities - very useful methods [CODE] public final float[] FILTER_3x3 = { 0.1f, 0.1f, 0.1f, 0.1f, 0.4f, 0.1f, 0.1f, 0.1f, 0.1f };[/CODE] | |
Re: Your code should like this: [CODE]package macey; /** * @author Mike */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class NormCalcDev implements ActionListener { private JTextField calcDisplayF; public NormCalcDev() { // Content Pane ... calcDisplayF = new JTextField(); // calcDisplayF.setEnabled(false); ... } public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("1") != … | |
Re: [CODE] boolean all() { //&& int counter = 0; for (int j = 0; j < errorList.length; j++) { if (errorList[j] == 0) { counter++; } } return counter == errorList.length; } boolean oneOf() { //|| for (int j = 0; j < errorList.length; j++) { if (errorList[j] != 0) … | |
Re: Look at previous post [URL="http://www.daniweb.com/forums/thread350550.html"]http://www.daniweb.com/forums/thread350550.html[/URL] | |
Re: [CODE] static int test2(int T, int[] M, int LIMIT) { System.out.println("LIMIT " + LIMIT); System.out.println("T " + T); System.out.println("===="); int B = 2; int H = B / 2; while (LIMIT > B) { System.out.println("B " + B); int counter = 0; if (T >= B) { for (int i … | |
Re: [URL="http://www.realapplets.com/tutorial/ActionExample.html"]http://www.realapplets.com/tutorial/ActionExample.html[/URL] | |
Re: simply check inside [B]hit[/B] method [CODE] System.out.println(mousePoint); System.out.println(myPicture.area());[/CODE] | |
Re: [CODE]import java.util.*; public class testHomework { public static void main(String[] args) { // common list for Homework type objects // used List as interface type List<Homework> al = new ArrayList<Homework>(); // MyMath math = new MyMath(); al.add(math); // MyScience science = new MyScience(); al.add(science); // MyEnglish english = new MyEnglish(); … | |
Re: Look at the example inside java jdk package [B]jdk1.7.0/demo/applets/GraphLayout/example4.html[/B] Earlier versions also include this example. | |
| |
Re: Line 6. [I]numForMem[/I] should be declared outside an [I]actionPerformed[/I] method. Now [I]numForMem[/I] is a local. | |
Re: Lines 14,15 and 20,21. LocalVariableHidesMemberVariable ! result totally counterproductive | |
Re: L24-29 this is initialization When you creates (in main method) new instance of ExitJoke the first executed code is L24-29. L26 here is "new ExitJoke", this executes code in L24. Then your program work in loop L26-L24-L26.... Move code L24-29 to end of main constructor | |
Re: I like posts like this. It is like checking to Newton's law of the apple falling to head from a tree. Graph is also needed to compare the results with a certain amount of starts. First look, very cursory: [B]mutChance[/B] is absence in calculations. Why? (my English reflects the degree … | |
Re: I do not know eclipse. look at compile flag `-Xlint:deprecation` or change deprecated constructor `@Deprecatedpublic StreamTokenizer(InputStream is)` to other: Line 25 replace withFileInputStream is = new FileInputStream(file); Reader r = new BufferedReader(new InputStreamReader(is)); ReadFile rt = new ReadFile(r); where ReadFile(Reader in) { super(in); } ![]() | |
Re: recycled GUI: Your original version need only one change in line 98 Replace [B]new Help();[/B] with [B]Help.main(null);[/B] (Change name [B]main[/B] to any other) | |
Re: used equals on incompatible types (JButton vs. String) use Plan[0][1].getText().equals("O") | |
![]() | Re: use SITE SEARCH: [URL="http://www.daniweb.com/forums/search.php"]http://www.daniweb.com/forums/search.php[/URL] keywords: [B]infix postfix[/B] read a book: [URL="http://www.brpreiss.com/books/opus5/"]http://www.brpreiss.com/books/opus5/[/URL] |
Re: OOP requires elevation to a higher level of abstraction, while maintaining the natural rules of everyday life. [CODE]package frog; /* * InputPosition.java * * Created on 2011-01-16, 22:22:41 */ /** * * @author j3c */ public class InputPositions { private static final int START = 1; private static final int … | |
Re: wrong type [B]TYPE_3BYTE_BGR[/B], ask sourceImage for type, use it, or comment line [B]destImage= new BufferedImage(sourceImage.getWidth(),sourceImage.getHeight(),BufferedImage.TYPE_3BYTE_BGR);[/B] more info ImageProcessing\ImageOps example [URL="http://filthyrichclients.org/"]http://filthyrichclients.org/[/URL] or [URL="ftp://ftp.helion.pl/przyklady/efgran.zip"]ftp://ftp.helion.pl/przyklady/efgran.zip[/URL] | |
Re: RB_Consumer is not waiting for message (from method [B]public synchronized void put(Element item)[/B]). Prints immediately null value of item. Try set as default field [B]private Element item = new Element("too fast");[/B] to see. To simply trace the flow, put before all [B]put[/B] methods line for example [CODE] public synchronized void … | |
Re: Use The Reflection API [CODE]http://download.oracle.com/javase/tutorial/reflect/class/classMembers.html[/CODE] | |
Re: Write first separate specialized class [B]SinglePlan [/B]with constructor [CODE]SinglePlan(HSSFCell[] allCells, HSSFSheet tempSheet, HSSFRow row) { setOnePlan(allCells, tempSheet, row); } // and method private void setOnePlan(HSSFCell[] allCells, HSSFSheet tempSheet, HSSFRow row) { ///... }[/CODE] parametrize method [B]setOnePlan[/B] you know size of HSSFCell[] allCells ! your base method should looks like [CODE] … | |
Re: NewClass: set same Dimension for minimum/maximum/preferred size of JPanel MainForm: no need extends JPanel, no need setSize for testFrame use GridLayout and pack() method | |
Re: suspected for(int i = 0; i <= transactions.length-1; i++) |
The End.