3,978 Topics
![]() | |
[I]This exercise will explore the queue and stack data structure implemented with linked lists. The Koch snowflake can be implemented without recursion by using a queue or a stack. Assume that L is either a queue or a stack, L.add( seg ) adds a segment, and L.remove() removes the segment. … | |
Hi everyone... i am currently doing a java system concerning file transfers between server and client... file transfer starts from the server.. So far, i have done one file transfer. However, i would like to program my code in such a way that the client actively still listens to the … | |
Hi, I've got an error message on "public static void save_data" and "public static void retrieve_data". Please help, thanks [CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class face1 extends JFrame implements ActionListener { JPanel pm,menup,fp,f1p,f2p,f3p,f4p,f5p,pf_1,pf_2,pf_3,pf_4,pf_5; static String f1[] = new String[2]; static String f2[] = new String[2]; … | |
Hello, I havr created a program in which there are two classes. One ship, and shooter. However it is not working. Any idea? [CODE] package shooter; import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.event.KeyEvent; public class Ship implements Runnable { int x, y, xDirection; boolean shoot = false; boolean ready … | |
Hi everybody, Tryed to make this program: Simple browser: you type the URL at the top and then get a new window with this web page. But my output is just JFrame(Even color did not get changed) help me please to find the problem. [CODE]import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; … | |
Hello, I'm trying to make a JPanel with JFrame capabilities, such as resizing, and moving, Everything seems to work fine, altough there are minor flickering inside the JPanel, I have numeral repaints and I have a method called update(), which uses absolute position to arrange Containers and Components. Whenever the … | |
Hi i need to add crosshairs to my code, like draw 2 lines across the screen on a JPanel, i also need to be able to turn them on and off with a checkbox which is on a JPanel. the other panel needs to be drawable on like a paint … | |
I was told to use a while loop and call the nextNumber method until the input matches the corresponding fibonacci number, i.e. an input of 4 would give fib(4)=3. I'm getting fib(4)=1. Here is my code: [CODE] /** Class used to generate a Fibonacci number with a given input */ … | |
Hi everybody. I'm trying to display web page that located in my computer or just (google web page). But everytime I'mgetting nullpointer exception. Please help me to figure out the problem. here is the absolute path that I'm using: [CODE]serg@serg-PORTEGE-Z835:~$ find $PWD -type f -name test1.html /home/serg/Projects/java/GUI/src/its/TestData/test1.html [/CODE] But the … | |
I'm getting this error variable might not have been initialized on ch2 and ch3: [CODE]import javax.swing.JOptionPane; public class calculatorJava { public static void main(String[] args) { String ch, ch2, ch3, add1, add2, sub1, sub2, mul1, mul2, div1, div2, choice1, exp; int chans, chans2, chans3, addo1, addo2, subO1, subO2, mulo1, mulo2, … | |
I'm trying to get my JPanel (JFrame?) to resize itself to fit randomly drawn shapes. I have a shape superclass and right now I'm working with my line subclass. Everything is working fine except I can't figure out how to make the shapes fit the size of the JPanel. Should … | |
Hey guys I got a problem, my program is suppose to take 10 numbers or grade scores and output the max, min and avg. score. My program writes out the max and the avg, although the avg dosent come out correctly because i am not getting a min for a … | |
![]() | Hello All! I am making a simple four-in-a-row style game where 2 players can play against eachother. This is part of an AI course I'm taking where we should demonstrate the machine (the AI) playing against the player. The game part of the game and the gui are completely separated. … |
**hi ... i am new in java swing. i am using netbeans. i've two frame named jFrame1 & jFrame2. jFrame2 contains a jTable. jFrame1 contains a jTextField & a jButton. while user input a value in jTextField and press JButton, jFrame2 will appear and output (from mySQL database) will be … | |
hey here is what i got.... i get an error after my while statement that i need a ; after my while but that dosent make any since, cause there shouldnt be any ideas???? suppose to be an easy loop statement if the string does not contain @ then keep … | |
Hey there, I am trying to build an application that listens to my mouse. once I click on my panel, it reads the x, y coordinates of the point I clicked on. Second time I click the panel, it reads the x, y coordinates of this other point and draws … | |
Hello everyone! My idea is like this: Class MainWindow is a JFrame object, on which there is a JButton object (named button1). When I hit that button, the second window (this window is a JFrame object that is instance of class SecondWindow) will appear with a JTextField object (named textField) … | |
using the java swing how can i put a background image to my application in a way that the image will cover the frame . [B]ps [/B]: I'm new to the java so maybe my question is a silly one but i will appreciate any help . | |
![]() | I've been working on a search engine that users manually add files to, build and inversed index, and can search some text and the program will saw which files have that text in them, you can choose and, or, or phrase search (just working on and & or search at … |
I am writing a game in which I need to draw text onto the screen. As I understand it there are two main ways to do this using Graphics2D - using GlyphVector and using drawString(). Of the two I prefer the previous because it allows me to define text as … | |
Below is an address book program I am working on. The way it stands now, when the data is entered and writes to a text file it writes the line of data like, John Doe 1234 Help Me Avenue Dallas Texas 98956 Johnathan Doe 2345 Derby Lane Omaha Nebraska 45678 … | |
Hey everyone I have created an application interface using Java swing on a mac, which looks exactly how I want it. However on windows and Linux the positioning of the components and what seems to be the dimensions look of place. I have tried to make the sizes of everything … | |
Below is an address book program I am working on. The way it stands now, when the data is entered and writes to a text file it writes the line of data like, John Doe 1234 Help Me Avenue Dallas Texas 98956 Johnathan Doe 2345 Derby Lane Omaha Nebraska 45678 … | |
Hi everybody I have a little question. I am using JFileChooser to open file and then process it.But the thing is its only works for txt file. What are the other ways to open all ither text files. Plus if would be really helpful if you would tell me how … | |
Hey Everyone, I'm new to JCreator and trying to compile this program, however I keep getting "missing return statement"...please help. import javax.swing.JOptionPane; public class DoCount { public static void main(String[] args) { String nString=JOptionPane.showInputDialog("Enter n:"); int n = Integer.parseInt(nString); factorial(n); } public static int factorial(int n){ int count = n; … ![]() | |
Hello I added a jpanel form on top of my game. I would like to implement a timer. How can I do that? I already imported the timer in the class but I don't know how to proceed. | |
![]() | Here is my assignment: > Here is your assignment: You work for a Landscape architect. They have asked you to be a part of their team as they need a computer programmer, analyst, and designer to aid them in calculating engineering specification. Specifically, you have been assigned to the Pools, … |
Hi, I'm trying to make a menu and when you click on one of the JButtons, it'll go from my first class's GUI to my second class's GUI. But when I run the program, and I press the button algorithm, it changes to a blank screen, and not to the … | |
*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 need help on drawing numbers on top of a rectangle matrix, and have them move together with the rectangle they are on. I tried doing this [code]public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; for(int row = 0; row < tiles.length; row++) { for(int col = … | |
*Edit* Just so you know, we are on the chapter in the book introducing ArrayLists *Edit* I am having trouble with this problem. The problem is stated: Implement a class Polygon that contains an array list of Point2D.Double objects. Support methods public void add(Point2D.Double aPoint) public void draw(Graphics2D g2) Draw … | |
[CODE] <script type='text/javascript' src='http://code.jquery.com/jquery-1.4.4.min.js'></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.js"> </script> <script type='text/javascript'> $(document).ready(function(){ if($("#navlist li").height() > 7){ $("#navlist li").hover( function() { $(this).stop().animate({ top: '15px' }, 200, 'swing'); }, function() { $(this).stop().animate({ top: '0px' }, 200, 'swing'); } ); } else{} $('#navlist li').click(function(){ $('#navcontainer').animate({opacity: 1,"marginTop": 0,duration: "slow",easing: "easein"}, 1000 ); $('#navlist li').animate({ height: … | |
hello this is my first time posting so sorry if I make any errors, im currently trying to ad a sliding movement to a tile game im trying to do, the tiles currently move but they move in a jumping motion, ive been trying to use the coordintes of the … | |
Im creating a calculator that allows users to enter their own Loan Amount, then choose whether to input their own Loan Interest and Monthly Loan Terms, or to choose between a set of predefined loan terms and interest rate in a GUI. So far I have been successful in creating … | |
Here is my code:- [CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Administrator */ import javax.swing.*; import java.awt.event.*; import java.awt.event.*; import java.awt.*; public class MyQuiz { int score; JFrame frame; String[] questions = {"Who invented … | |
[CODE]package PAyroll; import javax.swing.JOptionPane; import javax.swing.UIManager; import java.awt.Color; import java.text.DecimalFormat; import java.text.NumberFormat; import javax.swing.UIManager; public class EmployeeProfile { public static void main(String[] args){ JOptionPane.showMessageDialog(null,"Welcome to Payroll System"); payroll(); } public static void payroll(){ int conf=0; // do{ String name=""; String add= ""; String contact= ""; String email= ""; String word=""; … | |
The program has no errors and when ran will show the logo, buttons but not the inventory data. I have been working on figuring out why it will not display the cd information with no luck. Could use some fresh eyes to look at this and help me figure out … | |
Hello, I need assistance with this java program I am writing, Im trying to make two buttons and when you click the button, it has a counter, and everytime you click it it prints a message saying I was clicked n times. This is what I have so far and … | |
[CODE]import sun.audio.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; public class Sample { public static void main(String s[]) { JFrame frame = new JFrame (); frame.setSize(200,200); JButton justin = new JButton ("Click Here for Welcoming"); frame.add(justin); justin.addActionListener(new AL()); } public static class AL implements ActionListener{ public final void actionPerformed(ActionEvent … | |
Hello All, I have a java assignment thats supposed to create a memory game, with 10 rows and 10 columns.50 images have been supplied. The part i'm stuck is the the window with the actual images on the grid.The images are supposed to be generated randomly each time the application … | |
Hi everyone, In my simple GUI, I have a part where I use JFileChooser to let user browse for a file. The problem is that when browsing for that file, in order to open a sub folder, user has always to double click that the main folder to open the … | |
Hi everyone, I want to create a simple GUI that prompts user to browse for a text file, read in that file and display them in the GUI as a list. Then it should allow user to select from that list. Once an element is selected, there should be a … | |
i got problem when i clicl the checkbox 0r radiobutton..when i compile there is no error..and also how can i put the background image at my gui??hope you guys can help me.. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.text.*; import java.text.DecimalFormat; import javax.swing.border.*; import java.awt.GridLayout; import java.awt.FlowLayout; import java.awt.BorderLayout; … | |
[QUOTE]The below code runs fine the only problem is when I run this code there is a value of "3" in the input textbox which should be null, I have no idea why its doing this any help will be appreciated. THANKS[/QUOTE] [CODE]import javax.swing.JOptionPane; //inherits from Monument class---> public class … | |
hello everyone, help me in centering the frame which i developed using swing. Here is the code: [CODE] import javax.swing.*; public class RSAInterface extends JFrame { public RSAInterface() { setTitle("RSA by adil"); setBounds(200,200,300,300); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new RSAPanel(); this.add(panel); } } [/CODE] [CODE] import javax.swing.*; public class RSAInterfaceTest … | |
Hi frnds!!!!!! Am trying to crop an image using java.. If I draw a rectangle on the image it ll crop the image in the given level.. My code does it but the fact is, it is not cropping the actual part which we selected..This is my code.. [CODE] import … | |
I have been given a project to create the interface and code for a ticket seat calculator I have to produce the quantity and price which is from a text box on the main frame pass them into the seat class to create the totals then pass it into a … | |
Hello, I am trying to work through an example from a Deitel book. I keep getting a "source not found" error on line 27 of the LabelFrame class. I have put the "bug1.png" in every single directory associated with this project. I am stumped... [CODE] import java.awt.FlowLayout; import javax.swing.JFrame; import … | |
Hello, I'm writing a small game for a class. The problem is when i run it it starts consuming the computers resources, i bet i've done something very wrong but i just can't find it (haven't even added bouncing back from the paddle to the code, or game over for … | |
Greetings Everyone. I'm working on a program that will take the number of calories and grams of fat, and give the user the percent of calories from fat. The problem arises when I use the Calculate button. [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; public class FatGramsPanel extends JPanel { … |
The End.