3,978 Topics
![]() | |
Develop a Screen, a Listener, and an Animator. The screen should have a panel in which a filled ball should be continuously moved. There should be four buttons on the screen. Two (2) buttons on the Screen for movement – labeled Left-Right and Up-Down. The movement of the ball should … | |
I can't figure out why my java applet is not displaying, I have all of the files in the same folder, and I have java enabled on my browser. Here is the code //java code import java.applet.*; import java.awt.*; import javax.swing.*; /** * The HelloWorld class implements an applet that … | |
Hi I have a datepicker: <input class="dmxCalendar2" name="dmxCalendar21" id="dmxCalendar21" /> <script type="text/javascript"> // <![CDATA[ jQuery(document).ready( function() { jQuery("#dmxCalendar21").dmxCalendar2( {"altFormat": "yy-mm-dd", "condDates": [], "firstDay": 1, "showOn": "both", "duration": "slow", "showOptions": {"direction": "up", "easing": "swing"}, "yearRange": "c-10:c+10", "onSelect": "MM_goToURL('parent','allactstest.html');"} ); } ); // ]]> </script> And also a script: <script> var chosenDate … ![]() | |
i have made one program,but it will give none of the port number. Following files i have made **SimpleRead.java** import java.io.*; import java.util.*; import javax.comm.*; import java.nio.ByteBuffer; public class SimpleRead extends SpeedometerExample implements Runnable, SerialPortEventListener { static CommPortIdentifier portId; static Enumeration portList; byte[] readBuffer=null; InputStream inputStream; SerialPort serialPort; Thread readThread; … | |
When I run the game and try to use the Arrow keys to control the movement of the selection box, nothing happens. I'm pretty sure the game is redrawing itself properly because the ticker text is updating. Aswell, I tried doing: selectVal++; in the update function in TankShooter.Java, which made … | |
Hi This code not run : it show this error: incompatible types-found java.lang.String but expected HuffmanCodingAnimation.Node This line of code ` root.left.code = root.code + "0";` Here is the code: import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.tree.*; /* * This program enables a user to enter text and displays … | |
Hey everyone, Im having trouble with the placement of GUI components and need you help getting the things in the right place. The problem is on the left side where the elements are all misplaced including: The JMenuBar - should be up against the left wall JLabel "content for..." - … | |
I am making a battleship game with 2 boards, each is on a JFrame, but I do not know how to get them to close when a button is pressed in order to show the new one. package battleship; import java.awt.Color; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.WindowEvent; import javax.swing.JButton; import … | |
I thought it would be really cool if JOptionPane could be extended to accept an array of strings that represent messages, and have the method return an array of strings that represent user answers to the messages which are entered into the dialog box. This would make getting GUI input … | |
This is my code : import java.awt.Button; import java.awt.Component; import java.awt.Container; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.*; import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SpringLayout; public class SpringSample extends Frame implements ActionListener { private static final long serialVersionUID = 1L; SpringSample() { … | |
Hey guys! I am working on a school project where I choose "The Evolution of Technology" as my topic. It'll be from making stone tools and fire to the modern information age. I choose a videogame to represent my research and outcome and I'll use Java. I already knew a … | |
Ok I am making a user interface for Battleship and want a Frame to appear on the side with the title and instructions of the game in a disabled JTextArea. With the code I have now I can get the JFrame to open blank. The JTextArea only appears if I … | |
Allright. It's me again. :D This time, I'm making an alarm clock program. I've already completed the bit that gets and displays the system time: Date vrijeme = new Date(); int sati = vrijeme.getHours(); int minuti = vrijeme.getMinutes(); int sekunde = vrijeme.getSeconds(); Also made a method that compares that time … | |
Hi every body, I am trying to parse an xml file with sax parser in java and then fulfill a Jtable with the XML elements. The parsing is well done, the Jtable is created but the problem is that all the elements are placed in the same row and the … | |
I just needed some assistance on formatting the output into a specific fashion. I satisfied all the requirements of the assignment, except the output. I apologize for the bad format of this post, any suggestions and help is greatly appreciated. I need the output to look like: Mr. Random - … | |
Hey guys! I have a project for school that involves changing the code I posted under this. One problem that I cannot figure out is how I would convert the mouse listener to a key listener. I believe the checkEmpty, moveTile, and exchangeTile methods will have to be coded differently … | |
Hello. I am trying to recreate manually a small celsius-to-fahrenheit converter that I created with Design view before that. I used its code for reference, but still doesn't work. When I run my code I don't get the components drawn on the screen, only an empty window. What am I … | |
Hello, Iv recently been having trouble with a java project im working on as i need a button to add a sentence to a Swing list box. The problem im having is it uses an observable class and an observer. Fundamentally the list adds the elements to an array in … | |
Hello, i'm trying to add some values in the database (ms access) but i am having the following error: Error:java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Can somebody help? Here is my code: package db_con; import java.sql.*; /* * To change this template, … | |
Hi I am trying to create a GUI game where you slide your player to obsticals in order to get to the middle. The basic assignment rules are as follows The world should be represented using a 5 x 5 grid. Empty spaces, obstacles, the destination, and the player should … | |
i am pretty new to java i wrote this code but setText doesnt work i mean i cant reset the contol after type a value .what is wrong friends [CODE] private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) { String gelen=jTextField1.getText(); Random rnd=new Random(); int secilen=new Integer(rnd.nextInt(3)); if(Integer.parseInt(gelen)>secilen){ jOptionPane2.setBackground(Color.GREEN); jOptionPane2.setMessage("Girdiğiniz sayı "+gelen +"\n Benim … | |
I've had enough. I just don't get what's wrong at all. I coded a basic calculator program, and it compiled correctly, no exceptions thingy, sooo... it's probably my mistake --- nothing appears on the calculator's GUI. It's a blank window with just the title. And when executing programs like this, … | |
Hey Guys, i was looking at the post linked below and been trying to solve the issue, however, i have been unable to solve it. [Click Here](http://www.daniweb.com/software-development/java/threads/384109/data-from-text-file-into-jtable) The post says i "MUST create a new Vector for each row" in order for it to work. as mentioned above, i have … | |
Hello! I am using for the first time the JTabbedPane. The problem that I have is that I want to apply the paint method only for the first tab, but it also paints the second one. How can I solve this problem? | |
Hey, I need some assistance with an assignment that deals with Jframes. The assignment says "For questions 27 to 31, consider the following class: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class A extends JFrame ( private Container c; private JButton b; private JTextField tf; ) Now for the questions: … | |
Hi to all, I'm making one application for video control in firm...what's the best way to make application which have to access to webcam? There should be option for watching videos from more cams in real time...I read something on google and I found that Swing framework has some options … | |
![]() | I have a problem with creating drag and drop in Swing. I have written class that represents the toolbar item here is the code shortened code for it: public class ToolbarItem extends javax.swing.JToggleButton implements IToolbarItem, Transferable, DragSourceListener, DragGestureListener { private ModelEquivalent _modelEquivalent; private DragSource _dragAndDropSource; private TransferHandler _itemTransferHandler; public ToolbarItem(ModelEquivalent … ![]() |
I am working on a java assignment where I have to get BMI with dialog boxes. I keep getting this error "error: illegal start of expression if (BMI = > 18.5 && BMI < 24.9) " Here is the code. Can someone please help!? import javax.swing.JOptionPane; public class BodyMassIndex { … | |
HI all, I was wondering if anybody can help me to understand this exercise: "A small airline has just purchased a computer for its new automated reservation system. Write an application to assign seas on each flight of the airline's only plane (capacity: 10 seats). Your application should display the … | |
Hello, does anyone know how i can draw a small handle (square) on the edge of the circle at each quadrant( for e.g at the north,east,west and south quadrants) I used general path to draw the circle, now I'm having difficulties to draw the handles. Here is my code: //class1 … | |
Hello Everyone, I understand this is a basic problem, with a simple solution, but I cannot find a way to fix it. I'm trying to add a Jpanel to a JFrame and when I do the following. g.drawString("HELLO", 500, 0); The string is not seen on screen now if I … | |
hi all, i am doing my java project (video player). This is the task : Enter a video number and click a button to add that video to a playlist. If the video number is valid, the video name should be added to the list and all the names in … | |
hello there, im having a problem with my code . .. . . so this is my class 1: package app.ui; import java.awt.EventQueue; import javax.naming.ldap.Rdn; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.ImageIcon; import javax.swing.JScrollBar; import java.awt.Color; import java.awt.Font; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import java.util.Calendar; import java.util.GregorianCalendar; import javax.swing.JScrollPane; import javax.swing.JTextField; import … | |
Hello, I have a button which on clicks display a frame, where i have 2 radio buttons. When i choose one of the radio button it draws an image on the panel, however when i click on the button again, the image drawn is disappeared and i am not able … | |
I have seen many questions on autocompeletion for *java text components* like `JTextField` `JTextArea` `JTextEditorPane` etc. There are not many options either: 1) 3rd party library (like SwingX) 2) DIY (i.e using `DocumentListener`, `JWindow` with `JLabel` etc and a few requestFocusInWindow calls) I chose number 2 and put the code … | |
I have the following code which is in a class called customerModel. How do I call this method to another method inside another class called customerController? I am abit new to this and have been trying for ages but have had no luck. Please help thank you. public class customerModel{ … | |
Hey Lads, I Have a problem involving my save method , basically i want it to actually save a file which is of type JTable UnFortunetly its not , a Push in the right direction would be great. save.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e){ JFileChooser fc = new JFileChooser(); int … | |
Hello, I'm having an issue with set and get method. When i clicked on a button, i set index as 1 however when i use the get method to get the index, the index is returned as 0. I want to call a method if the index is 1. here … | |
I am making an ABACUS MODEL program which adds counters to pegs. The program compiles fine but when i use the test that was issued to me (as pictured) it appears as though my program does not work as intended. I don't know if anyone will be able to help … | |
hello i want to stop the music after pressing other song i tryed much different ways of doing it but no results please anyone help me i have this code ... package passwordsaver1; import java.awt.Dimension; import java.awt.Toolkit; import java.net.URL; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.swing.JOptionPane; /** * * … | |
basically i am working on a project for uni, which is to create a form of an abacus model. - peg_array[] stores the number of counters/beads present in each of the pegs(lines) of the abacus. i am trying to use 2 boolean methods: "boolean removeCounter(int thisPeg)" "boolean removeCounter(int thisPeg)" thisPeg … | |
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Burger extends JFrame implements ActionListener { JLabel lblForAll, lblBelow, pic, pic1, pic2, pic3, pic4, pic5, pic6, pic7; JRadioButton rBtn, rBtn1, rBtn2, rBtn3; JCheckBox cBtn, cBtn1, cBtn2, cBtn3; JTextField txt, txt1, txt2, txt3, txt4, txt5; JButton btn1, btn2; ButtonGroup btnG; int ham=25, egg=15, … | |
Hi, i'm making a java program, and I started making the gui with a `JTextArea`, and tried to add a font (`Consolas`) and It crashes with a "divide by 0" error. It works fine on windows, and if you comment out the `setFont` line.. import javax.swing.*; import java.awt.Color; import java.awt.Font; … | |
I need to input a name in the JMenuItem(employee name) using JOptionPane, I used this statement (JOptionPane.showInputDialog(frame, "Enter Employee Name");) and I try using a string variable but nothings happen. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.FlowLayout; import java.text.MessageFormat; import javax.swing.table.AbstractTableModel; public class Cs extends JFrame implements ActionListener { … | |
The problem with my code is that the update method doesn't get invoked even after I notify the observers. Did I miss something in my code? package com.observer3; import java.awt.FlowLayout; import java.util.Observable; import java.util.Observer; import javax.swing.JLabel; import javax.swing.JPanel; public class A extends JPanel implements Observer{ JLabel lbl; public A(){ setLayout(new … | |
i need to make the Print JMenuItem to open a printdialog box when clicked but i dont know how to make it can u help me pls p.addActionListener(new ActionListener() heres the code can u add the printdialogbox i searched but i cant put it on the program import javax.swing.*; import … | |
//Hello(apologize for any formatting errors) //I am trying to finish this program that is supposed to act as a club bouncer. Only letting a max amount of people (125) in at one time. Naturally people leave throughout the night, so I was trying to //implement that with the random variable, … | |
hello guys i want to make progress bar in netbeans i trying with this code but the progres bar doesnt work property just showing 100% when finish and doesnt have animation of doing that progress: public final class Music extends javax.swing.JFrame { public static class Start implements Runnable { @Override … | |
Someone try my code. And help me with the txtQty TextField. import java.awt.*; import java.awt.event.*; import java.applet.*; import java.text.*; import javax.swing.*; public class Cashier extends Applet implements ActionListener, KeyListener { private final double applePrice = 15.75, orangePrice = 13.50, pomeloPrice = 95.25; Panel topPanel, eastPanel, westPanel; Label lblTitle, lblQty, lblTotal; … |
The End.