3,927 Posted Topics
Re: In calculating the average, you sum the elements and then divide by the number of elements. That would imply that division does not occur within the loop. | |
Re: I'm sure that jhoop would have appreciated this information two years ago. | |
Re: Once you have a selected File object, you can create an ImageIcon and display it in a JLabel on your frame. Take a look through this tutorial for more information and some sample code: [url]http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html[/url] | |
![]() | Re: What is to go in the rectangles? You can place JLabels in a GridLayout and give them a line border if you want a grid of actual components. Or you can simply override paintComponent() and draw lines on your JPanel. The Oracle tutorials offer more information about both of those … ![]() |
Re: Have you looked into the error [iCODE]Invalid object name 'tCandidate'.[/iCODE] Is it a valid object? | |
Re: Perhaps you should read the following rule from our forum rules and revise your post accordingly: [B][I]Do provide evidence of having done some work yourself if posting questions from assignments.[/I][/B] | |
Re: As is often the case, the Oracle tutorials have you covered: [url]http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html[/url] | |
Re: Both of your returns are in conditional statements. The compiler requires a guaranteed return value for all possible conditions. Add a default return value at the end to cover the case of your other conditions not being satisfied. | |
Re: To use composition in Cylinder, you would add a Circle instance variable instead of extending Circle. When you need any circle info, you make the calls on your circle reference instead of inherited methods. So for example, where are calling [ICODE]findArea()[/ICODE] in the findVolumne() method, you would instead call [ICODE]circle.findArea()[/ICODE]. … | |
Re: "=<" is not a valid operator. Also, all for() loops must have three sections ( ; ; ) even if one is not used | |
Re: In your listener, you can get a reference to the clicked object with[ICODE]e.getSource()[/ICODE], which you can then cast to [ICODE]JCheckBox[/ICODE]. You can toggle your variable values based on [ICODE]JCheckBox.isSelected()[/ICODE]. | |
Re: You were already advised in [URL="http://www.daniweb.com/software-development/java/threads/395899/1698414#post1698414"]your other thread about this[/URL] to look at regex. I don't see any regex or mention of it here. | |
Re: Post your code and specific questions. The forum rules state that you must show some effort if you wish to get help with homework. | |
Re: If the path of the filename cannot be found relative to the directory in which the program is executing, you'll need to provide a more complete path to the file. You didn't post the error message, but it sounds like a FileNotFoundException? | |
Re: GridLayout maintains equally sized grid cells along the horizontal and vertical. If you need to vary the size of the cells, you'll need to subdivide your layout into multiple panels with their own groups of controls or use a [URL="http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html"]GridBagLayout[/URL]. GridBagLayout is a lot more flexible, but it's also much … | |
Re: Then start a thread of your own with an actual question instead of hijacking someone else's old thread. Closed. | |
Re: I would imagine you'd need to [URL="http://wordpress.org/download/"]install Wordpress[/URL] locally on your Apache server? | |
Re: Looks to me like you just want to set the text of your text fields back to zero or empty. You can just call setText(String) on each of them. | |
Re: You'll need to use a JTextPane if you want to mix text and pictures in the same component: [url]http://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html[/url] You can use a JLabel and ImageIcon if you just want to display the picture by itself: [url]http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html[/url] | |
Re: Regex. Edit: Sorry, cross-posted. ^^ What he said. | |
Re: It might help if you noted which line was 75 in your file, since you only posted 38 lines of code. | |
Re: You could make your own PaintShape class that contains a Shape reference and those two properties. You can pass all of the info through the constructor and access it as you loop through your shapes in the paintComponent() method. | |
Re: Look at lines 24 and 25, then consider what will happen with those values in your loop condition on line 27. | |
Re: You can add a repaint() call right after you update your path. | |
Re: Posting code from attachment for others' convenience: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.text.*; class ExampleJComboBoxSample extends JFrame implements ActionListener, ItemListener { private static final int FRAME_WIDTH =1000; private static final int FRAME_HEIGHT =1000; private JComboBox comboBox1, comboBox2; private JTextField parentinput, emailinput; public static void … | |
Re: Ask this guy what he found with Google: [url]http://www.daniweb.com/software-development/java/threads/395869/1698277#post1698277[/url] After that, post your code and ask specific questions about what you are having difficulties with. | |
Re: No. If you're too lazy to Google such a basic concept, why should someone else put forth the time to spoonfeed it to you? If you have [I]acutal questions[/I], after putting in the slightest effort yourself, post them here with whatever code you have started with. | |
![]() | Re: Oh, you got the hard one. The easier one asks what color his brown horse was... |
Re: Check the scope of your 'listener' variable where you are initializing it. Your listener is not being called at all. After that is corrected, you need to figure out how to specify the color, because there is no Color constructor for the name of the color. | |
Re: Both download and open just fine for me. | |
Re: Add [iCODE]e.printStackTrace();[/iCODE] in your catch block, so you can see more details of the error. | |
Re: Use an ActionListener instead of ChangeListener for your buttons. You can pass the color you wish to change to as a parameter to your setSampleColor() method. Set the panel background to that color before repaint. | |
Re: It depends on the database that you are using. Different databases have different ways of dealing with auto-incremented keys like that. | |
Re: 3 separate threads for this single question merged. Apologies for some slight discontinuity, but if ERINY hadn't decided to string this out so much it would be more linear. | |
Re: Which part is confusing you? What have you tried? What have you thought about trying? From the [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]forum rules[/URL]: [I]Do provide evidence of having done some work yourself if posting questions from school or work assignments[/I] Simply dumping your assignment here is not evidence of effort. | |
Re: You need to have a guaranteed return value. Currently all of your returns are dependent on one of the if() clauses being true. If none of them end up true, there is no final return. If you put a default return at the end of the method, you will make … | |
Re: Look at where your while() condition is located. Now trace through what your program will do if input is 1-6. | |
Re: MySql is a database, not a user interface. A drop-down box is an interface component. | |
Re: Use [icode]( ! "hello".equals(someString) )[/icode] edit: Yes, same thing striker just posted :) | |
Re: You're going to have to show more effort than that if you expect any help. Ask specific questions about the parts you are struggling with. | |
Re: You could use the [URL="http://download.oracle.com/javase/6/docs/api/java/awt/Graphics2D.html#scale(double,%20double)"]Graphics2D.scale()[/URL] method, which scales the entire graphics transform or you can just add a scale multiplier to all of the dimensions of your drawn objects. You'll probably want to use a float for the scaling factor. I'd also recommend using a JPanel and overriding paintComponent() for … | |
Re: Neither one. I don't write console applications. :P | |
Re: You could take a look at [url]http://java.freehep.org/demo/LegoPlot/[/url] which is a demo of the 3D plotting package in [URL="http://java.freehep.org/"]FreeHEP[/URL]. | |
Re: Make sure the name of your file is "NestedNumber.java". | |
Re: You can use a lock file in your base directory as well. We use that here at work for one particular app that should only be running a single instance. I hadn't thought about a socket binding though. Interesting alternative. | |
Re: Well, the only relevant part you have is [CODE]import java.io.*; in = new BufferedReader(new FileReader(new File(filename))); [/CODE] These may help: [url=http://www.exampledepot.com/egs/java.io/ReadLinesFromFile.html]ReadLinesFromFile[/url] [URL="http://www.regular-expressions.info/java.html"]Regex tutorial[/URL] | |
Re: Please be aware of the following forum rule: [B][I]Do provide evidence of having done some work yourself if posting questions from school or work assignments[/I][/B] Post your code and specific questions about what is troubling you and what you have tried. | |
Re: Yes, the method will operate on whatever data array you have passed it. | |
Re: This forum is for helping those who have questions. It's not a code-on-demand service. If you have specific questions or a css you need help with, post them. | |
Re: Nope. Re-read your notes. You've been told exactly what data the class will hold. It's trivial to at least start a skeletal attempt with that. |
The End.