3,927 Posted Topics
Re: I can't say for certain what's blocking your UI update, but you could try executing the two statements that update the text fields in a task on the event queue like so[code]SwingUtilities.invokeLater(new Runnable() { public void run() { chatLog.append(forLog); messageField.setText("AWDAW"); } });[/code]That will make sure the GUI update is invoked … | |
Re: Try [CODE]jScrollPane1.setViewportView(new JLabel("Connecting to the database. Please wait...")[/CODE]and when the table is ready[CODE]jScrollPane1.setViewportView(table);[/CODE] | |
Re: I don't think you should have to do anything special with it since Java uses unicode by default. Perhaps the file itself is using some other encodiing? Maybe this link could be helpful: [url]http://www.exampledepot.com/egs/java.nio.charset/ConvertChar.html[/url] | |
Re: BoxLayout, GridLayout, or GridBagLayout would all work. [url]http://download.oracle.com/javase/tutorial/uiswing/layout/index.html[/url] | |
Re: Take a look through [URL="http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html"]this tutorial on concurrency in Swing[/URL] SwingWorker invokes a worker thread in the background that does not tie up the event queue. SwingWorker may publish results for updates on the event queue, but it does not have to. SwingUtilities.invokeLater() schedules a task to run on the … | |
Re: Your class outline already has pretty straightforward instructions. Ask specific questions about the parts which confuse you. | |
Re: Then I guess you are out of luck. Seriously, you haven't said why getSource() won't work (it will by the way) and you haven't given any good reason not to define separate listeners. You can define separate listeners as inner classes, anonymous or named. | |
Re: Judging from all of the people I see staring at them with blank faces, I thought they already were stun devices. | |
Re: Try this as a starting point: [url]http://download.oracle.com/javase/tutorial/uiswing/components/icon.html[/url] | |
Re: Yes, as Kramerd suggested, you'll need to create the Thread object, setDaemon(), and then start it. The setDaemon() method is a void return, so you cannot chain it as you tried above. If setDaemon() returned a reference to itself then chaining would be possible. | |
Re: Take a look at this section on using JList with a mutable model: [url]http://download.oracle.com/javase/tutorial/uiswing/components/list.html#mutable[/url] | |
Re: No one is going to answer quiz questions for you. Formulate your own answers and if you have uncertainties, ask specific questions. Explain your reasoning or thoughts on the areas you doubt, Demonstrate some effort in the process if you want others to take their own time to help you. | |
Re: [URL="http://www.javaconcurrencyinpractice.com/"]Java Concurreny In Practice[/URL] is a good one. | |
Re: Another option would be to create a small ChipStack class that extends JComponent and overrides paintComponent() to render both the stack of chips and the text count as a single graphical unit. It would make positioning on your table a tad easier. | |
Re: >open=fun.java // my program name You cannot run ".java" files. You can run classes or jars. | |
Re: Not only a shame - it's a violation of the rules. Of course, so is begging for homework help without showing any effort. I really don't see why anyone should help him find a program to copy and turn in as his own work. | |
Re: Yes, as pritaeas mentions, this is answered in your other posting: [url]http://www.daniweb.com/forums/post1384110.html#post1384110[/url] Please do not post the same question in multiple forums. Closing this one. | |
Re: [B]> Recently i offered them to send them a couple of notes, and they never got back to me[/B] Well, there is your answer then. If they ask, just don't get back to them. | |
Re: Move genRandomTime() outside of main(). You can't declare methods inside methods. You will also need to move the declaration of 'ranGen' out of main() so your function can access it. You can read a bit about sorting a collection here: [url]http://download.oracle.com/javase/tutorial/collections/algorithms/index.html#sorting[/url] | |
Re: This is not a homework completion service. Post the code that you have done so far and post specific questions or error messages that you are having trouble with. | |
Re: That's your own message. Print the stack trace instead. | |
| |
Re: Arrays do not have a "pop()" method - they are fixed storage. You can null out elements or shift them out of existence. | |
![]() | Re: Use an array and a loop. Next time start a new thread if you have a question. Don't hijack someone else's. |
Re: I think many posts about that end up in Game Development as well. | |
Re: The default FlowLayout gives you very little control over component sizing/resizing behavior. Try a different layout manager to achieve the behavior that you want: [url]http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html[/url] | |
Re: [QUOTE=ana12] me i lways eating vegetables..[/QUOTE]You could stir-fry them with spam. | |
Re: Hey, if you can't pasta the pasta, then pasta you should just pasta pasta. | |
Re: You're parsing it as a double as soon as you read it. "Q" isn't a double. | |
Re: I think that is probably only a part of his statement, because without any context of the discussion that doesn't make any sense. | |
Re: Post the exact error message it gives you and perhaps someone can point out the problem. | |
Re: As you have been advised, you must demonstrate that you have made some effort if you want help with homework assignments. | |
Re: [B]> Whenever I run this code, there's no input box for the user to input text.[/B] It's a console application - you type in the console. Working as intended. [B]> If I change the "String text = console.nextLine();" to "String text = console.next();" then only the first word is taken … | |
Re: You can control that easily by creating a small inner class for your timer action like so[code=java]private class TimerAction extends AbstractAction{ boolean wait=false; public void actionPerformed(ActionEvent e) { if (!wait) { System.out.println("moving stuff"); } } public void wait(boolean wait){ this.wait = wait; } }[/code]You'll need to keep a reference to … | |
Re: Well, from the API doc, it looks like you need to call Keyboard.create() after the display is initialized and before you poll any keyboard state. I've never used that API though. | |
| |
Re: The answer has been posted 10+ times in this thread. Have you bothered to read it? ![]() | |
Re: Use it for what? It doesn't look useful for anything to me. | |
Re: There is no need to keep the "distance to" values in your "store" class. Those can be computed on the fly from your mouse locations. You can create a separate method distanceFrom() that computes the distance from a point to a store. It could be on the store class as … | |
Re: 1) You're only reading two ints before you start trying to read and parse strings - how does that match up with your input file? 2) After you've correctly parsed the passenger entry, you know which row and seat to put him in because it is stated as the first … | |
Re: If you have a question, post it along with the code. If you're wanting to pay someone to do it, create a thread over in the Looking To Hire section. | |
Re: Is that code inside a method? Post the entire code in [noparse][CODE][/CODE][/noparse] tags. | |
Re: Yes, you would initialize based on the number of rows. | |
![]() | Re: Re-read that for() line. You have two unnecessary characters in it. ![]() |
Re: [B]> However, it doesn't work - the error message is generated for the empty set.[/B] I assume you meant the error is [I]not[/I] generated. An empty result doesn't throw an exception because it's a completely valid result - there simply are no records that match the query. If your code … | |
Re: Closing this thread since the poster has not returned in a month to clarify what he needs help with and this is not the place to solicit business offers. | |
Re: You could code a static method for it in a utility class[CODE]public class Functions{ public static float f(float x){ return x*x*x+6*x; } }[/CODE] Anything you do is going to be a method call. You don't need to create any references to use the above, but then again you give up … | |
Re: You can use those methods to set your component locations if you set your layout to null. If you move the component, you won't need to use the graphics methods. If you want to use the graphics methods instead, you could make a small banner component that paints the moving … | |
Re: There are no macros in Java. You would define a class or interface constant for that purpose. |
The End.