3,978 Topics
![]() | |
Hi I'm currently doing a connect 4 program and I need to write an apporpiate get and set methods so that the other classes can access this information. ('State of the autoplay' is simply whether red or yellow (or no-one) is set to have the computer make their move). I've … | |
I had to convert one of my programs into an applet. And most of it I copied and pasted, but the program is suppose to let the user input a number in the texfield and when they click one of the radio button options the calculate resuls are suppose to … | |
Hi, I am trying to create a graphical program that visually stimulates the path of the sun over a city skyline. I've created a Time button but I don't know how to move my sun to the right each time I click on "Time". The program should works like this: … | |
I'm trying to make a method that would create a new tab with a specified name and a white background. However, nothing I pass in (whether it's a JPanel, JButton, etc.) would show up in the final result. I can't tell what's wrong. [CODE]import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import … | |
Ok so I have been working on this for 12 hours straight and I cannot get it to work right to save my life. Attached is the word document of what the project is suppose to do and the file its suppose to read from. [B]ANY HELP IS GREATLY APPRECIATED … | |
Recently i needed to override dome default values of swing properties ... I got the answer currently needed.Details are located [URL="http://www.daniweb.com/forums/post1210384.html"]here[/URL] But after that i interested to find a way to have all these pairs (simply HashTable keys and values elements) to override them at the startup of applications to … | |
I'm working on the following assignment and could use some help: A teacher has five students who have taken four tests.The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores: Test Score Letter Grade … | |
[B]Moderator comment:[/B]This question was originally posted in [url]http://www.daniweb.com/forums/thread184423.html[/url] and moved as original thread is old Hi there, i need help with my assignment please help me. i want to put your code to my code, which is my code is; i tried but i couldn't solve it. [code]import java.awt.event.*; import … | |
About two weeks ago, I was given a simple project in Java II; code a program that displays an image, plays a sound, and has loop/play/stop buttons for the sound and zoom in/zoom out buttons for the image. I decided to go ahead in the book with this project to … | |
I'm having an issue with my code and after hours of time I can't figure out what I'm doing wrong. There are three classes (GUI, Judging, TestGUI). All programs compile correctly with no syntax errors. The GUI creates an interface that should compute (JButton) a total of 8 scores and … | |
I have done a lot of PHP but never JSP. I have checked tutorial but not gone too far. I see there are Java beans and some servlets which I'm zero brain at. So I have two questions: 1. Where to read a concise tutorial (Not too detailed I mean) … | |
hey there. I have been struggling with separating classes in java and figuring out what methods go in what classes. when i build my apps in one file, i do them right, but when i try to separate classes, i mess up. like for example: I have these two classes: … | |
Hi all, I had posted my code and updated it a few times in another thread and didn't get any response and since I have gotten some things figured out and had posted my long code a few times in the other thread, I thought I would put my last … | |
Hi all, I am doing some swing game programming and I am at a bit of a loss right now as the AWT Event 0 thread ( I have system.out.printed its name) seems to be calling the same code twice, any ideas on this? I am overriding the paintComponent() of … | |
I have a question. I need to write a program to display a button with an image on it using Swing. the Image on the button has to change when the button is clicked. I read somewhere about the image on button But is not sure how to change the … | |
Hi people, I am new to Java but have experience programming in C/C++/C#. I wanted to learn Java SE 6 first before moving to Java EE 6. After making some research online for appropriate Java SE 6 books, I found that these are appropriate for me to get an excellent … | |
[B]This is my code so far......[/B] [CODE] import java.applet.Applet; import java.awt.*; import javax.swing.JOptionPane; public class HelloWorld extends Applet { Font myFont = new Font ("Times Roman", Font.BOLD, 25); public void paint (Graphics g) { g.setFont (myFont); g.setColor (Color.BLUE); g.drawString ("My Name" , 20, 30); String first; first = JOptionPane.showInputDialog (null, … | |
I recently wrote some code from a code snippet from my java programming textbook as a way to pass the time, and since it works fine in console, I assumed that it will work fine in a GUI application. The code: [CODE] import java.net.*; import java.util.*; import java.io.*; import java.nio.*; … | |
I need help getting UI to work with my File System [CODE]import java.awt.*; import javax.swing.*; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JTextField; import java.awt.event.ActionEvent; import java.awt.event.*; class UI extends JFrame implements ActionListener { private JButton format = new JButton("Format Disk"); private JButton mount = new JButton("Mount Volume"); private JButton createDIR = … | |
Hi, I've gotten this program to work but I want to format it differently. I feel like I've tried everything to make the changes that I want but they just don't work. I think I may have the right idea on most of what I want to change but keep … | |
![]() | Basically When i click b1 in the Pincode method i want the Balance(); method to run and display a JButton "2" but i want to clear the frame and panel first, so it looks as if its a new frame... Any help is much appreciated thanks! :) [CODE]import java.awt.*; import … |
hello there u said if any body need help u can help them so plz i need ur help with this i did a program in java gui (temperature converter) and i just need the program to print the result in a text file so plz plz plz help me … | |
i'm having a few problem with my phone book program: 1. If the any of the buttons have empty fields, I need to display an error message. How would I do that? Some sort of try/catch statement or if/else statement? 2. I'm a bit clueless as how I would go … | |
[B]Connect4View[/B] [CODE]import java.awt.*; import java.awt.geom.*; import javax.swing.*; import java.awt.event.MouseListener; import java.awt.event.MouseEvent; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JButton; public class Connect4View extends JFrame { DrawPanel canvas; Connect4Model model; ControlPanel myControlPanel, JRadioButton; public static void main(String[] args) { Connect4View w = new Connect4View(); w.setVisible(true); } public Connect4View() { setTitle("Connect4 solution"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(500,220); … | |
[CODE]import java.awt.*; import java.awt.geom.*; import javax.swing.*; import java.awt.event.MouseListener; import java.awt.event.MouseEvent; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JButton; public class Connect4View extends JFrame { DrawPanel canvas; Connect4Model model; ControlPanel myControlPanel, JRadioButton; public static void main(String[] args) { Connect4View w = new Connect4View(); w.setVisible(true); } public Connect4View() { setTitle("Connect4 solution"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(500,220); setLocation(300,300); … | |
This is a MenuBar class which is supposed to assemble a Menu bar.. basically i have some JMenus which contains some JMenu items here... and add all the JMenus to this class which is the bar (sorry if this is confusing) i am trying to write a public method to … | |
Another day yet another assignment, which is why I am here. I come with 2 problems. 1. I cannot for the life of me figure out the printf function. I want to do be able to do this: Number Type Amount 1 type 2.00 2 type 12.00 Well right now, … | |
I need to make my popup class observable and the main frame class observer. When the user clicks the ok button on the popup, I need the string from the popup's textfield returned to my main program. Main fram class. [CODE] import javax.swing.*; import java.util.*; import java.awt.*; import java.awt.event.*; public … | |
Dear All, I would like to change the content pane of frame after pressing a button by the method: frame.setContentFrame(newContentFrame); However, after press the button, the Frame is frozen~~ How can I make it work? THANKS A LOT~~ [CODE]import javax.swing.*; import java.awt.event.*; public class Test{ JFrame main; JPanel panel1; JPanel … | |
Sorry for thee length but i have seven classes for this program. I took several functions and modified them to create a gui interface. I created a JFrame with 4 tabs that contain text only, then i have a 5th tab that has functional JButtons that when selected should prompt … | |
I'm having trouble with this code. I'm sure it's something stupid (I'm in a class for Java) so please forgive this Java Newbie. [code] package Student; import Entity.*; import ExceptionManagement.StudentException; import java.util.ArrayList; import java.util.List; import javax.swing.*; public class DataManagerBean implements DataManager { ArrayList<Student> students = new ArrayList<Student>(); ArrayList<Course> courses = … | |
[B]So basically, my JMenuBar has to appear everywhere in my applet (I have CardLayout, 3 cards/screens), in every screen and in the same location (looks nice, consistency). How would I go about doing this?[/B] So, I was making a menu for my applet. I followed the exact instructions at: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html[/url] … | |
This is my assignment Starting with last week's Property project, build an array of Properties in your main(). Add static methods to the Property class: void ArraySort(Property[] property_list, String key_field) This will sort the array, property_list, based on the argument, key_field, passed in. These are the legal choices for key_field: … | |
I want to put everything into one applet. How do I do that? Please HELP :( [CODE] import java.applet.Applet; import java.awt.*; import javax.swing.JOptionPane; public class HelloWorld extends Applet { public void paint (Graphics g) { g.drawString ("Name" , 50, 25); String first; first = JOptionPane.showInputDialog (null, "Enter first number: "); … | |
I have to write a JUnit test method for a short program that lets the user add/remove/browse images in a collection. (Adding an image is done with a JFileChooser) The test method that I wrote exhibits some really bizarre behavior; it passes every so often, but fails most of the … | |
I am having a couple of problems with my code. First, whenever I try to remove the JOptionPane from line 79 in my code, I get a NullPointerException from the line this.dbGraphics = this.dbImage.getGraphics(); a couple of lines down from the JOptionPane. Does anyone know why? Another problems is that … | |
I have to make an audio player in java applet so that it can be used on websites. It will browse files on the computer, make its playlist and will play them one by one. I have compiled the .jar file and done everything correctly in the <applet> tag in … | |
I'm doing my first year project at uni and have hit a stumbling block. I have to make a basic version of a media player that will allow a user to add tracks that are stored in a MS Access database to a playlist, and give them a rating. My … | |
/*None of the buttons except create and clear work can someone help please , can anyone help me with the parts i have missing , the account and date test class work fine i just need the bank account GUI to work properly , here is a detailed explanation of … | |
I'm putting together the basic layout for a contacts book, and I want to know how I can make the 3 test buttons span from edge to edge just as the arrow buttons do. [CODE]import java.awt.BorderLayout; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; … | |
Excuse me if it is a silly mistake but i am newbie to java and couldn't figure it out. Basically it searches if txtText (text area) contains the txtSearchParam (text field) and returns the number of txtSearchParam in txtText. Algorithm is working. simply i can't access variables defined in main … | |
import java.awt.*; import java.awt.event.*; import java.text.*; import javax.swing.*; import javax.swing.border.*; import java.util.Arrays; import java.io.*; public class BankAccount extends JFrame { // Make these variables publicly available String file = ("THUS.txt"); public static String acctNumber ; public static String custid , acctDateOpened; public static double balance ; private static final String … | |
Hi experts, I have done a very simple snake game but there are some error.. I would like to make it continue with 3 lifes before game over but I fail. Did any1 can help?? Here is the code: import java.awt.*; import java.awt.event.*; import java.applet.*; import javax.swing.*; import javax.swing.JOptionPane; import … | |
I am tring to draw a house & street & garden but i stop....? could plz someone help me and complete my job this is my code import java.awt.*; import javax.swing.*; public class Zzzzzzzzzzzzzz extends JApplet { public void paint(Graphics a) { house(a); door(a); roof(a); rode(a); } void house(Graphics b){ … | |
Hi all, I am a beginner in java.I have written a code to design a layout of a traffic signal.The lights are working fine.The problem i am facing is to randomly generate cars from all directions and to stop them at the junction.I am not understanding how to use repaint.Here … | |
import java.awt.*; import java.awt.event.*; import javax.swing.JApplet; public class CarApplet { private Image carLeft = null; private Image carRight = null; private Image carUp = null; private Image carDown = null; private Image carImage = null; private int direction = -1; privte Point carLocation = new Point(25,25); ? /*Over here this … | |
i am trying to create a tic tac toe GUI but i am having trouble...here is my code: [CODE]import javax.swing.JFrame; public class TtTDemo { public static void main(String[] args) { JFrame frame = new JFrame ("TicTacToe"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.getContentPane().add (new Main()); frame.pack(); frame.setVisible(true); } } [/CODE] [CODE]import java.io.BufferedReader; import java.io.IOException; … | |
[B][I]Write a program that allows the user to display 1, 2, or 4 images in a grid of panels. At program startup, the user is prompted ofr the number of images. If the input number is not 1, 2, or 4, the program quits with an error message. Otherwise, the … | |
I have a table that outputs certain rows.But they are from different groups and the different groups are stored in different vectors.At present i am adding all the rows using the following code : [CODE] m_vector.addAll(match1); m_vector.addAll(match2); .. m_vector.addAll(matchn); [/CODE] Here match 1 to match n are the different sections.I … | |
Basically, I have a price quoter that I am working on. The way it should work is: The user selects the quantity of cards from the combo box. In the textfield a price displays once selected. (i.e. 100 = $8.95). (I have this segment working already.) Next the user selects … |
The End.