- 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
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] |