3,927 Posted Topics
Re: Well, what problems are you having? What errors if any? Posting several lines of abbreviated variables and equations and saying "it's not right" is a bit vague. | |
Re: Ok, 2 main problems with the method that creates your array - see comments in the code belowe[code] int[] Array1= new int[size]; // you are changing 'size' in this loop // use a new variable in the loop [B]for(size = 0;size <=(size-1);size++)[/B] { // casting Math.random() to an int will … | |
Re: And please include the code in post with [noparse][code] [/code][/noparse] tags. Many people, myself included, do not want to mess with attachments to glance at your code. | |
Re: [url]http://www.daniweb.com/forums/post621513-5.html[/url] | |
Re: You need to narrow that down a bit or highlight the additions that caused the problem and explain what you are trying to do, because I doubt many people are going to wade through that much GridBagLayout code based on what little you described. | |
Re: Alex is correct. Generics became available with 1.5. And 1.2 is way too old to be using for anything these days. | |
Re: Use regex to parse out the links and push them onto a stack, pop the stack, get that page and gather the text or whatever, continue through the stack. | |
Re: Place the mouse listener code in your custom tab component and add the listener to that component.[code]class ButtonTabComponent extends JPanel implements MouseListener { private final JTabbedPane pane; private final JButton button; public ButtonTabComponent(final JTabbedPane pane) { ... addMouseListener(this); ...[/code] | |
Re: Just call [code]whateverFrame.dispose();[/code] in the action listener. | |
Re: You simply reply to it. If you have changed the code, repost it in the reply. | |
Re: You cannot seriously think it's a good idea to take code written by others and submit it as your own for an interview. If you cannot complete the project then you should not get the job. | |
Re: And is there a particular reason you need a separate controller and don't want the view to serve that role? If you don't have the answer then you probably don't need to. Keep the model separate and let the view interact with it as needed. | |
Re: Why not use arrays instead? | |
Re: The code that Alex Edwards posted will work for that scenario, but the action listener code can become quite long, verbose, and repetitive for your button array. A cleaner way to handle that would be to create a small action class for those buttons, like[code=java]class ColorButtonAction extends AbstractAction{ Color buttonColor; … | |
Re: You might have better luck posting this (after searching a bit) over in the Sun Java forums that apply to installation issues: [url]http://forum.java.sun.com/forum.jspa?forumID=32[/url] [url]http://forum.java.sun.com/forum.jspa?forumID=14[/url] | |
Re: The default layout manager is FlowLayout, which is what your JPanel is currently using since you have not changed it. You can change the positions of those text fields all day but FlowLayout won't respect them. It wasn't designed for that. I would recommend using a BoxLayout or GridLayout if … | |
Re: Yeah, um, lol... or something. This really has nothing to do with feedback on DaniWeb. | |
Re: The Sun tutorial on Reflection is a pretty good place to start: [url]http://java.sun.com/docs/books/tutorial/reflect/index.html[/url] Keep in mind that using reflection to manipulate classes and methods is much slower than normal compile-time usage patterns (and the code is pretty long and unwieldy to boot) and should only be done when you need … | |
Re: Futbol10, you already have a thread for this question. Please don't posts requests for help into other posters' threads (especially not old posts). | |
Re: Check the doc for [URL="http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html"]SimpleDateFormat[/URL]. You want to use "HHmmss" instead of "hhmmss". | |
Re: You may want to use a [URL="http://java.sun.com/javase/6/docs/api/java/awt/geom/GeneralPath.html"]GeneralPath[/URL] or [URL="http://java.sun.com/javase/6/docs/api/java/awt/geom/Path2D.Float.html"]Path2D.Float[/URL] or [URL="http://java.sun.com/javase/6/docs/api/java/awt/Graphics.html#drawPolyline(int[],%20int[],%20int)"]Graphics.drawPolyline(int[],int[],int)[/URL] for this. All of those provide methods to draw a series of points connected by lines. | |
Re: There is no built in calendar UI. You will need to create your own or find one that someone else has written. | |
Re: [QUOTE=funtoosh;620539][B]Plzz solve my problem......... @JavaAddict-- look through it,plzzzzz[/B][/QUOTE] "Plzz" is not a word. Please have the consideration to use proper English (at least as much as possible if your English is limited) if you are requesting help. Demanding help in bold text with gibberish words is just plain rude and … | |
Re: After you create the "mainPane", you need to set it's layout to GridBagLayout like so[code]mainPane.setLayout(new GridBagLayout());[/code] | |
Re: [QUOTE=TheWhite;619925]Update Checking: Currently, my program connects to a URL and checks if a new version is available. If one is, it simply opens up a dialog saying a new version is out and to go download it... Is there a way to have it automatically open the path to the … | |
Re: What is the "length" variable? You should be looping to "a.length" over that array. If "length" is not the same as the array length, you are missing parts of your array in the loop. | |
Re: If you figured out delete, you can at least get a start on edit. If you run into problems with it, post the code and specific questions or errors that you have. This is your homework - not ours. | |
Re: I can't believe the degree to which people try to advertise crap on forums in the guise of being interested in the product. | |
Re: [quote=samsathish;423744]show me the link for Dictionary project[/quote] Her code is attached to the first post. Did you bother to read anything at all before posting this question on a thread that is years old? Additionally, your vocabulary could be improved with the addition of some terms of common courtesy such … | |
Re: At the most basic level, you override the equals() method and test whether the object properties meet the criteria that you consider them "equal". Here is a bit more information: [url]http://java.sun.com/docs/books/tutorial/java/IandI/objectclass.html[/url] In practical usage there are more considerations to overriding equals() than just comparing the objects' properties, such as also … | |
Re: Surely that is not all of the code? Post the rest and please place it within [noparse][code] [/code][/noparse] tags. Also, always use braces around for() blocks. Even though a single statement without braces is allowed after for() and if() statements, you are likely at some point to add additional code … | |
Re: You are replacing "chatText" with every line that gets read from the stream. I believe you probably want to append the new text to "chatText" instead of replacing it.[code]String response = ""; while ( (response = in.readLine()) != null) { chatText += response+"\n"; }[/code] | |
Re: In the mousePressed() method, use the following[code] int bothMask = MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK; if ((evt.getModifiersEx() & bothMask) == bothMask){ // do your thing System.out.println("Both down"); }[/code] | |
Re: You are just hitting a resource location problem. Your relative file path is not being found and because of the specifics of getImage() and drawImage(), the only visible symptom is no image being drawn. The MediaTracker that load the image is actually creating an image with no dimensions because it … | |
Re: Please note that Java and Javascript are [I]not[/I] the same thing. Flagging to see if this can be moved over to the Javascript forum. | |
Re: For one thing, override paintComponent() instead of paint() and be sure that you call super.paintComponent() before your custom code. As for the specific of your question, it's a bit unclear. Post the relevant sections or example code that demonstrates the problem behavior. | |
Re: Do not resurrect old threads to ask new questions. Start a new thread if you have a question. Do not use "text-speak" gibberish like "u" and "plzz" in your post. If you are too lazy to type full words then don't expect help. | |
Re: And... ? You haven't stated a question. Also, why would Movement be a class of it's own? A class encapsulates state and behavior. What state and behavior would be represented by Movement? Edit: It looks like your post got cut off initially and you have added more to it, so … | |
Re: I would think your game class would have a variable for number of cards in a hand. The deck class could contain a method deal(numberOfCards, numberOfHands) that returns a Set of Hand instances. This would keep your deck independent of the game and not tied to the specifics of your … | |
| |
Re: The error also tells you which symbol (name) cannot be found and the line on which it occurs. Please post the exact error text if you cannot locate it based on the compiler information. | |
Re: Issues that I see: 1) Logic is hard-coded to 3x3 board. Array positions, bounds checks, adjacency checks are using literals in many places. 2) Heavy repetition of if() blocks that are nearly identical, especially in the blocking() method. These could probably be replaced with a parameterized method or by adding … | |
Re: Sure, let me write them all up in Word with step-by-step explanations and I'll post them in a few days. Just keep checking back here. | |
Re: Um, you can 0 to a value all day and it won't change...[code]total = 5; newtotal = 0.0;[/code] | |
Re: Yes, focus issues can be a pain with key listeners. The InputMap and ActionMap make it easier to handle this. Try using this instead of the KeyListener.[code]private void launch() { getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put( KeyStroke.getKeyStroke("R"), "reset"); getRootPane().getActionMap().put("reset", new AbstractAction() { public void actionPerformed(java.awt.event.ActionEvent e) { System.out.println("reset"); } }); setBounds(100, 100, 300, 300); add(new … | |
Re: What exactly are you trying to do on that line of code? It doesn't appear to be a valid statement at all. | |
Re: [QUOTE=Sirikit Joshi;611684]The problem is I am not very educated in Qbasic and my teacher has given me a project of making a hangman game.[/QUOTE]Yes, that is a problem. The best way to get educated in it is to actually do the assignments you are given.[QUOTE=Sirikit Joshi;611684]If you help me I … | |
Re: None of that code is executed - it doesn't compile. You have missing concatenation operators, illegal calls to non-static members from a static context, etc. You need to fix those first. | |
Re: Not sure what your question is exactly, but maybe these will help: [url]http://exampledepot.com/egs/javax.swing.text/style_HiliteWords2.html[/url] [url]http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html[/url] | |
Re: I don't believe you can make the component not fill the cell, but you can add a border to the button in the custom renderer[code]class ButtonCellRenderer extends JButton implements TableCellRenderer { private Border MATTE_BORDER = BorderFactory.createMatteBorder(2, 3, 2, 3, UIManager.getColor("Table.background")); public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, … |
The End.