3,978 Topics
![]() | |
Hello, I am trying to get this code to work. I am getting an error code on line 38, that I don't understand why. Can anyone help me out. the error code that I am getting is identifier expected. Thanks, countrygirl1970 [code] // Displaying multiple strings import javax.swing.*; // To … | |
I am just learning Java. I am trying to do a GUI to calculate road trip data. My program compiles, and a window opens, but only the top title line shows. Nothing shows in the center or south areas. What do I need to change? Here is my file. [code=syntax] … | |
This is supposed to draw a line through the JButtons when square9 is clicked. It doesn't work but there are no errors and I don't see what the problem is. Ezzaral gave me the code to draw the line earlier. Obviously, the winning squares aren't always diagonal, so I will … | |
hello everyone. i have been trying to code an MP3 player, but Java does not support this, it only supports wav, thus wma, mp3 and other music or audio formats are denied. i thought of incoporating a converter, but still the converter is even failing to make the conversion: here … | |
I have the following GUI code but my JLabel for results doesn't work when either of the buttons are pushed [code] import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TempConverterPanel extends JPanel { private JLabel input, results; private JButton output_f, output_c; private JTextField temp, fahrenheit, celsius; public TempConverterPanel() { setLayout … | |
I need a little help converting my GUI panel into JButtons instead of text for some parts [code] //Davina Moore //TempConverterPanel //November 6, 2008 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TempConverterPanel extends JPanel { private JLabel input, results_f, results_c; private JButton output; private JTextField fahrenheit, celsius; public TempConverterPanel() … | |
Fig.2.7: Inventory.java [code=java] // Inventory program import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; import javax.swing.JOptionPane; public class Inventory { private static double totInventoryValue = 0; public static void main( String arg[] ){ product invProd[] = new product[3]; Scanner input = new Scanner( System.in ); for (int iter = 0; iter < … | |
[code=java] public class GameOfLife implements GameInterface { private boolean[][] originalMap, // The initial cell configuration map, // The current cell configuration newMap; // The next generation configuration private GameGUI gui; private int generation = 0; private FileIO fileIO; // GameOfLife constructor public GameOfLife() { originalMap = new boolean[MAX_ROWS][MAX_COLS]; map = … | |
im trying to time stamp this code to plot a graph base on different array size eg 100 0.454sec 1000 0.467sec etc but so far im only getting 0's no matter the array size and id also want to find out the amount of comparisons made before the search key … | |
can you guys help me how can I remove all those drawn rectangles if user click the mouse in the applet field? I am supposed to write a program that displays a rectangle and color it with green when user drag the mouse. But if user click the mouse anywhere … | |
Hi,Please i need some help in my java program,it's purpose is to enter 2 equations and it solves them graphically,the problem is that the graph has a glitch with the x and y axis,plz can someone help me so that all the equations are solved correctly.. here's my source code: … | |
I am trying to write a program that displays a rectangle when user drag the mouse and when user release mouse, it displays the rectangle with green color. I am terribly confused here is what I am thinking to do import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.net.*; public class … | |
Hello everyone, I am a student learning Java and need some help getting text to flash or blink. The text I want to do this with is "Which Way" in my drawstring method. Any help would be much appreciated. [code] import java.awt.*; import java.awt.event.*; import java.awt.geom.GeneralPath; import java.util.Random; import java.awt.Font; … | |
Hi all,i need help about JTable.I'm using netbeans..I got a table contains PLU,nama,harga,qty,total..I use TableModelListener to listen to valueschanged in column..What i need help is how to create a new row if the user press enter key,and set focus to the first column of the next row..Thanks a lot..Here are … | |
Hi all, I am learning java and have developed a very basic message app which entails having a serversocket on one pc and a socket on another. This is working fine but now i want to go further and have them both to have the abiliy to wake the other … | |
How do you to take user input for red, green and blue(a number between 0 and 255) and make the background of the center JPanel that color. Heres the code on what ive done so far: [code] import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; /** * Write a description … | |
What are the differences between both and which one should i consider for the different kinds of java-based apps? | |
Hi i am tryin to write a recording class in java which i have done but i have to convert the recording class into a GUI i have done the coding for it but i want buttons that allows you to cyle to the nex and previous record detail if … | |
So I am getting into the swing of python in my class, and am currently trying to take a program from an example, and making it much more condensed. The issue I am having, is there are many classes for a tkinter guessing game. [ICODE]def question5(): if entry5.get() in ["Samus", … | |
Hello everybody, I have various components that I want regroup in the same category. I found numerous screenshots on the internet using some sort of frame surrounding items. For instance : [url]http://www.vieartificielle.com/images_robot/e70d6615e7b9c9ecfacdc7e977425d6d/cache_500_wifi_robot_photo_gui.jpg[/url] (the frame surrounding "Joystick information" section) and [url]http://bp3.blogger.com/_45gEBj4xUTA/RwefQvOgIjI/AAAAAAAAACQ/pKezYz2qQCQ/s320/RobotUI.jpg[/url] (the frame surrounding "Current data" section). I dont know how … | |
I have a program for which I am designing a help menu. The program allows you to add squares, ovals, and other shapes, and move them, rotate them, etc. I'm setting up some HTML pages that explain how to do different tasks. So when the user pulls down the help … | |
Hi, I have developed an application using netbeans(Swing) on windows platform. It is working fine. But when I try to run the same application on macintosh platform. But the application window doesn't appear properly. Menus and other parts are not visible. Only when the mouse cursor is moved over the … | |
OK, this is a follow-up to this thread, which I have marked solved. [url]http://www.daniweb.com/forums/thread152797.html[/url] I changed things from GIF to PNG and that seems to solve the saving issue, but there is a new issue. I'm trying to create a semi-transparent circle as an image, which can be saved. The … | |
I just wanna test my event,but it doesnt work,anything wrong? Pls help...thanks.. [code=java] import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class Frame extends JFrame { private static final Font numFont = new Font("monspaced", Font.PLAIN, 14); private static final Font font = new Font("monspaced", Font.PLAIN, 14); private JTextField displayField; // … | |
I really am stuck as to what I am doing wrong with this program. Help would be much appreciated :D. [code] // DiscountPrices.java - This program calculates total cost for discounted items. // Input: Interactive. // Output: Original price, discount, discounted price, and total price for all items. import javax.swing.*; … | |
I want to draw a tree in Jframe, the tree view is available in the attachment, As you see there are nodes connecting to each other.I know that I have to find the midpoint of the nodes at the same level or things like that. What I want your help … | |
I am working on a project that requires the main system, EmployeeSystem to be able to open a file with JFileChooser, and then write to that file, run a payroll system on it, and search it for a particular employee using a directory system. I am struggling right now to … | |
:rolleyes: Hi, Could you please help?? I am tired and confused. I don't what to do any more! I am trying to write a traffic simulation and i wrote some interface and some classes but the main one that has a big chunk of code seems to me like nightmare. … | |
I have done up this cope to ask elementary students to solve the multiplication problems. The only problem I have is when the student gets the wrong answer, I don't know how to get the same problem back for them to answer the question again. Can someone point me to … | |
i'm using NetBeans and i keep getting an error in this code: [CODE=java]package desktopapplication7; import java.awt.*; import javax.swing.JFrame; import javax.swing.JPanel; public class Frame extends JFrame { Container c= getContentPane(); setLayout(new BorderLayout(5,10)); JPanel p= new JPanel(); p.add(new JButton("OK")); // ERROR HERE c.add(p,BorderLayout.Center); // ERROR HERE }[/CODE] on both lines above, it … | |
Heres the problem that was given to me. Write an application that inputs a String and Search a Character and uses a method String Method IndexOf to determine the number of Occurences of the character in the string. we were told to use this book for research. How To Program, … | |
Hi, Could anyone help me with this problem, the following code contains the GUI for a chargeback application which was handed on to me. I want to be able to test the components DC1 and DC2 to make sure information was entered when the btnGenChargeReport button is clicked... :?: I … | |
I'm trying to get a GUI application to display an image. So far I've got this bit of code: [CODE=java] import javax.swing.*; import java.awt.*; public class DemoImage extends JFrame { public void showImage() { // creates the actual frame with title 'My GUI' and dimensions JFrame frame = new JFrame("My … | |
hello guyz,,do you know best sites to recommend that has a tutorials on "swing" about: a.) sample writing a file on "text file" b.) the saved text file will be read by the main class in JOptionPane (java file) actually, i has on it on bufferedreader,,but i really like to … | |
here is my calculator. it works fine, but for the love of god i cant figure out how to get the screen at the top, centered while the rest of the buttons follow the gridlayout pattern. any way? [ICODE] package Calculator1; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.*; public … | |
Hello, I am trying to get my cost, salestax, totalamount to come out in the output dialogbox to have only two decimals places. I know how to do on the printf but not on the dialogbox. Please help. Here in my complete code. [code] // Displaying multiple strings import javax.swing.*; … | |
i have two classes one is MyForm and the other one is MySwingWorker, i get a null exception which is related to line 36, i'm not sure what i have to pass to MySwingWorker class. please help!!!! [CODE=java]public class MyForm extends JFrame { public static void main(String[] args) { new … | |
This program is suppose to allow the user to enter a student's name and (4) scores via GUI, instead of Scanner class. The class is to use a String array for 5 names, an array of 5 characters to hold letter grades, and 5 arrays of four doubles for each … | |
I need to finish this assignment by tonight. I have been working on it for the last five hours and I am completely stuck. Any help would be greatly appreciated! I have already talked to my teacher, but she is awful. No help at all. This is what I have … | |
Hi, My problem is that I need to tell class A to repaint, but from class B. Class B will be a thread that updates components of class A and will eventually tell A to repaint. The basic idea of my code is as follows: [CODE] class A extends JPanel{ … | |
I have 3 applets like this one that have walkers. What I need help with is adding an action listener to the buttons. I have tried several times and keep getting this error. I did have oneWalkerButton.addActionListener(this); [B]in java.awt.Button cannot be applied to walking[/B] What is supposed to happen is … | |
[code=JAVA] import java.io.*; import java.util.*; import javax.swing.*; public class Calculator { private static Stack operators = new Stack(); private static Stack operands = new Stack(); public static void main(String args[]) throws IOException { JOptionPane.showMessageDialog(null, "Hello user! I hope you have a great time using this. = ]", "Welcome", JOptionPane.PLAIN_MESSAGE); JOptionPane.showMessageDialog(null, … | |
I have written a browser in java but it is only able to display saved web pages on my computer or html files created by me. It is not able to display a page when i type any URL in the address bar. Please help me Here is the code … | |
This is what it is supposed to do. If this helps. This file should read the records from the Graduate file first, in sequential order as the “View Student” button is pressed. When the program reaches the end of the Graduate Students records, it should modify the JFrame to display … | |
Hey there! I was wondering if someone here could help me out a bit. I'm a beginner in Java and I'm struggling a bit with understanding if it is me who is doing something wrong or if something is just missing from my software to run the thing I'm trying … | |
I find it difficult in this java programming language that's why I need your help to defend this code in my class. I got this code from internet with comments and explanation. but there are some codes and explanation that I don't understand. [CODE= java] /* Read me: Note: As … | |
I'm practicing java language.. please help me out I got this error saying.. cannot find symbol symbol: constructor compAdd() location: class compAdd [code=java] compAdd c1 = new compAdd(); ///////////////compAdd.java import javax.swing.*; import java.awt.event.*; import java.awt.*; public class compAdd extends JFrame { public JButton button = new JButton("Add"); public JTextField txt1, … | |
Ok, so, for school, we have to write a program that calculates the value of Pi as accurately as possible. Earlier in the year, we worked with a "Turtle" program, it drew lines and circles, ect. it started in the center of the JFrame, and moved to where you told … | |
This is a simplified version of a larger project. I have three JPanels contained in a larger JSplitPane called [ICODE]wholePanel[/ICODE]. The top panel and left panel hold labels and buttons, which I have not included here. The lower right panel, called [ICODE]canvasPanel[/ICODE], is where I draw shapes. I'm trying to … | |
Hello, I am relatively new to Java. I would like to know how to add additional threads to this applet. Particularly adding additional balls that bounce at the same time. I think the problem lies in my mousePressed event. The program will start a new ball, but make the existing … |
The End.