3,978 Topics
![]() | |
Hi, I'm making a snake game and I got a timer to check everything and repaint the component. How can I achieve a 60 fps without affecting the movement of the snake. I need help to come up with an equation for the speed of the snake. Need to change … | |
Write a java project (applet) that has two classes. The driver class (has the init() method) should allow the user to enter into an Input Dialog Box, the mail type ("P" for Priority or "F" for First Class), a blank space, and the weight in ounces of the piece of … | |
Xuggle can handle many different video formats. What I am thinking about is to wrap the Xuggle into Swing component, and make a start/pause button and a progress bar on the top of it. Any suggestions? Sample codes would be great. MyDreamGirl | |
Hello, I'm trying to make a chatting app just for educational purposes, to improve my skills and I got a question, or maybe a problem. Look at the Code first: [CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* … | |
hi there i am working on a memory game project and my main problem is when i start the game user must not see the icons of buttons, when he/she press on a button then the i con should reveal, but some methods like [CODE].setPressedIcon()[/CODE], [CODE].setRollOverIcon()[/CODE] dont work if i … | |
Hey guys, I am making A Vending Machine Program and seem to be getting error's when trying to do things outside a class and stops the Program. (Vending machine should keep looping until Quit is typed, and it will display a summary of money and cans left. [CODE] ******SODA MACHINE … | |
the problem im faceing here in my code is The events that i want to happen are not occuring after i select an item from the combobox,and also all other components are showing the same faulty behaviour. the faulty behaviour that they are showing is they are not firing the … | |
I have this code i compile it and it ran but nothing came up can someone help with this? [code]import java.util.Arrays; import java.util.Comparator; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DecimalFormat; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import … | |
Im new to java and trying to get buttons to work. My next button works as intended however the first and last do not and the previous one only takes me back one space if i'm on the second item. I need the prev button to rotate backwards through the … | |
Hey there. I'm planning to develop a software for my father's business. The software is very simple, it has two tables. 1. Stock 2. Sale Whenever stock arrives, the quantity and content will be added to Stock table.. Structure is something like 1. Stock Table | Brand | Quantity | … | |
I have a problem with getting an input from class A to class B. I already created a method which gets the value but when I call it in class b it returns empty. These are my codes: [B]CLASS A[/B] [CODE] public class log extends javax.swing.JFrame { public String name; … | |
Hello, I have a weird problem while running my project. I use netbeans and here's my code and the problem is explained after the code. [CODE]/* * NetworkingView.java */ package networking; import org.jdesktop.application.Action; import org.jdesktop.application.ResourceMap; import org.jdesktop.application.SingleFrameApplication; import org.jdesktop.application.FrameView; import org.jdesktop.application.TaskMonitor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import javax.swing.Icon; import … | |
I got this error, when the bullet collides with the enemy. [CODE] 341, 458 null 341, 458 null 341, 458 null 341, 456 java.awt.Rectangle[x=340,y=75,width=50,height=50] 341, 456 java.awt.Rectangle[x=325,y=45,width=50,height=50] 341, 456 java.awt.Rectangle[x=479,y=15,width=50,height=50] 341, 454 java.awt.Rectangle[x=340,y=76,width=50,height=50] <CUT THIS OUT. ABOUT 1000 LINES LIKE THE ONES ABOVE> 305, 352 java.awt.Rectangle[x=222,y=36,width=50,height=50] 305, 352 java.awt.Rectangle[x=299,y=6,width=50,height=50] 341, … | |
Hello I was working through a Netbeans tutorial : [URL="http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/"]http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/[/URL] I am having a problem understanding adding my properties and xml dependencies contained in an xml dir in my project (Please find screen print of dir) I jar my app and it can not find these files or dir. java … | |
I am building a Circuit Editor using Java. I'm now at very first stage. Now I'm building a simple editor like Paint. I've implemented a drawing-pad where you can draw straight line and continue the line until you click an right click, by a "WIRE" Button click in the frame. … | |
I'm new to Java and while trying to add a text area to the applet, found the textarea uneditable, and while trying to add the scrollbar to the textarea, found the applet will not be started. Code as below: [code=java] import java.awt.*; import javax.swing.*; import java.applet.Applet; public class AppletEditor extends … | |
Ok, I've done everything I can think of and I've looked around and haven't found anyone else that has run into this kind of problem. Maybe I'm just missing something really simple but I am at my wit's end. Umm... actually, just had an idea, but I'll put this here … | |
![]() | I have my program all working but whenever a user clicks cancel or exit I want the program to close, not throw my catch. Whenever a user throws a catch they have to input their answer twice before it will go back to normal operations. [CODE] import java.util.*; import javax.swing.*; … |
basically, instead of the "(N1 + N2 + N3)" which is in the average method we need to call the sum method to the average method as the sum method returns a value = (N1 + N2 + N3). does anyone know how to call the sum method to the … | |
![]() | I'm working on a random number guessing game with 5 tries that uses standard JOptionPane GUI and 3 methods, the requirements have each method doing a specific task. The main method starts a game is supposed to handle the 'you won' or 'you lost' dialogue and play again if the … ![]() |
Hey everyone, I have been looking for video tutorials on SWING class and pretty much of GUI side in Java .. I found tutorials on Oracle site but they require lots and lots of reading.. if anyone knows a good site that has videos on GUI, please share it.. Time … | |
I am new to GUI Java programming and I am attempting to find the best way of creating a frame to contain a series of menus. I am first adding logic to have the date and time appear in the frame, but the way I am doing it they are … | |
Hello all. In my Apache derby db I set up Decimal data types like this: [code] admin_pay_rate DECIMAL(5,2), [/code] I use JFormattedTextFields to filter decimal usage in text fields concerning money Like admin pay rate would be 150.00: this is good. In the JFormattedTextField it will allow 1,000.00 but the … | |
[CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class controlBall extends JFrame { private JButton jbtRight = new JButton("Right"); private JButton jbtLeft = new JButton("Left"); private BallCanvas canvas = new BallCanvas(); public controlBall(){ JPanel panel = new JPanel();//use the panel to group buttons panel.add(jbtLeft); panel.add(jbtRight); this.add(canvas, BorderLayout.CENTER);//add canvas to the center … | |
Can any one explain what is the usage of creating a contentpane in swing... | |
Hello! I've written some swing components for which I use timing framework to make some simple animations that hopefully are going to enchance usability. What I am doing is essentially setting the bounds of JPanels for each timing event to animate something that moves and resizes. I also change transparency … | |
[code]package rolldice; import java.awt.*; import javax.swing.*; public class Die extends JComponent { private static final int SPOT_DIAM = 9; private int _faceValue; public Die() { setPreferredSize(new Dimension(60,60)); roll(); } public int roll() { int val = (int)(6*Math.random() + 1); setValue(val); return val; } public int getValue() { return _faceValue; } … | |
This program is supposed to output some shapes using the GUI. I can't get it to actually output the shapes, but the panel shows up fine. Could someone show me what I am doing wrong? This one does the Panel and all that other stuff. [CODE]package pregui; import java.awt.Color; import … | |
Hello daniweb! Yes, I'm another amateur coder who needs a little assistance getting some code to work, I hope it's alright :?: A little background is necessary I suppose, so the deal is I'm a self taught noob who's working on a pet project of crafting a little program that … | |
when i am trying to use delete button on my frame it is showing such exception and stack trace is here java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at MyFrame.actionPerformed(AcctHld.java:225) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:253) at java.awt.Component.processMouseEvent(Component.java:6099) at javax.swing.JComponent.processMouseEvent(JComponent.java:3287) at java.awt.Component.processEvent(Component.java:5864) at java.awt.Container.processEvent(Container.java:2109) at java.awt.Component.dispatchEventImpl(Component.java:4460) … | |
I am trying to load a background in full screen mode, but when i run my program the screen is just white. Can someone point me to the reason why? [CODE]import java.awt.*; import javax.swing.*; public class DrawComponents { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice device = env.getDefaultScreenDevice(); GraphicsConfiguration gc = device.getDefaultConfiguration(); … | |
How to Align This Perfectly Blueberry Muffin 1.45 Strawberry Bagel 0.80 Lite Yogurt 0.75 Vanilla Ice Cream 2.75 Hash Browns 2.50 Toast 2.00 French Fries 1.50 Onion Soup 3.00 Coffee 0.90 Iced Tea 1.00 Hot Chocolate 1.75 Here is my code. [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.event.ActionListener.*; … ![]() | |
i keep getting this: Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:205) at Pinopoly.diceRoll.<init>(diceRoll.java:17) at Pinopoly.board.<init>(board.java:26) at Pinopoly.board.main(board.java:38) Java Result: 1 i used: dice1.setIcon(new ImageIcon(getClass().getResource("/new/dice1.jpg"))); the image is in the same folder as the java files. what could be wrong? oh and i tried changing the image and it worked. | |
Hi, I find classes sources on the web that import import org.dyno.visual.swing.layouts.Constraints; import org.dyno.visual.swing.layouts.GroupLayout; import org.dyno.visual.swing.layouts.Leading; But I cannot find this package with google searches. Where is it? Many thanks for your help. | |
hi.. uuhhmm.. i have a problem in how to put an String Buffer method here in my code.. uuhhmm.. i just want to know the easiest way of putting a String buffer .. please help . . thanks.. [code="java"]import java.awt.Graphics; import java.util.Random; import javax.swing.*; public class Change { public static … | |
i have created an app which reads lines from a .txt file, splits the line at a " " and then stores them in a ArrayList which then gets put in a JTable. i created 27 columns and named them... now i want to add an extra column on the … | |
I need to build a gui application for Nim. I started writing the code and need help. Will you help me write the Nim game? import javax.swing.JOptionPane; public class Nim { public static void main( String args[] ) { String firstNumber; String secondNumber; int number1; int number2; int sum; firstNumber … | |
After compiling this code, I am getting a "cannot find symbol constructor Timer(int,Morning)" on line 17. [CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Morning extends JFrame { private EasySound rooster; private int time; /** * Constructor */ public Morning (int time) { time = 0; Timer clock = new … | |
Hello I need to create a graphic simulator for MIPS CPU, something that will show the structure of the CPU, and when getting a text file with MIPS code- it will show how does each command executed through all the CPU parts. However, i have never worked with grpahics, i … | |
public class Employee { private String Name; private String SIN; private Integer Salary; public Employee(String string, String string2, int i) { // TODO Auto-generated constructor stub } public Employee() { } public Employee(String N, String sin, Integer Sal) { Name = N; SIN = sin; Salary = Sal; } public … | |
The following code works: [CODE] public class Main { public static void main (String args[]){ final JWindow f = new JWindow(); JLabel l = new JLabel(new ImageIcon(Main.class.getResource("images/logo.png"))); f.getContentPane().add(l, BorderLayout.CENTER); f.pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension labelSize = l.getPreferredSize(); f.setLocation(screenSize.width/2 - (labelSize.width/2), screenSize.height/2 - (labelSize.height/2)); f.setVisible(true); f.setAlwaysOnTop(true); } }[/CODE] When I … | |
Hello, I was asked to write a program that starts with a JFileChooser, the user is asked to choose a file. If at anytime during any part of this program, the user hits "cancel" or "yes" when the dialog shows "do you want to continue?" the program will return back … | |
Hello I have a small problem with JList in external class file_tree. What should I add, write to show this JList in panel controlArea ? My application have a few files Core and two external classes. Code below This is Core File [CODE] import javax.swing.*; import javax.swing.JFrame.*; import java.awt.event.*; import … | |
i get no GUI when i run! import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Calculator { private JTextField resultTF; private JButton calculateB, numbersB[] = new JButton[11]; public void driver() { //Create Window JFrame calc = new JFrame("Calculator version 1.0"); calc.setSize(500, 500); calc.setDefaultCloseOperation(calc.EXIT_ON_CLOSE); //Get the content pane (object of type … | |
I have to make a bank GUI and I have a Jlist that populates with the customer objects (viewable by name) and I can view their individual info... but when I select the customer, I also want to be able to pull their account info and put it in a … | |
I dont know how to add a next button that will continue to a next page. The next page will have: Prelim Exam Grade Midterm Exam Grade Final Exam Grade Compute Button Exit Button Here is the code i have done. HELP ME PLEASE. THANKS. [CODE]import javax.swing.*; import javax.swing.event.*; import … | |
Hi All, The GUI works as intended to. But I was wondering if some of you java gurus could look over my code and maybe give me some tips on how I could have written this code better. Thanks! [B]GUI CLASS: [/B] [CODE]import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; … ![]() | |
Hi, I'm trying to make a program which reads a text as an input and counts the letters as an output. For example, if my input is: "Hello, my name is Alan", I want my output to be: A = 3, B = 0, C = 0, D = 0, … | |
In my final year project I have to build an Algorithm animator. It would be done to show how the algo works using nodes(PCs) and edges(connections). For example, how the leader ellection ring algo works. Anyway, I haven't started implementing yet. My supervisor wants me to do it as a … | |
I cannot get past this error. I had taken out the dataSort method which allowed it to compile, however I need the data to sort for my assignment. When it compiled the data was not passing through my constructors, I got no data output. Any assistance is greatly appreciated . … |
The End.