3,978 Topics
![]() | |
I have a class which extends JFrame and this class is made singleton (private constructor, public static method to create instance if null). But still I get one more frame when already one is open. Can someone help? | |
Hi, I can't figure how to detect collision between Ellipse2D and Rectangle2D. I have tried intersects and contains methods with and without getBounds and getBounds2D methods but nothing works. Here is some code, ball and bat are overlapped. package net.viped; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.Toolkit; … | |
![]() | Hi all, I've got a code here, as the title says it is a sudoku puzzle. It can create only one puzzle which is there hard coded. Now, the problem is how to add another puzzle? Or maybe I can turn this into a random generated puzzle which is hard … |
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package Gui; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; /** * * @author K */ public class Genres extends JFrame implements ActionListener { Connection conn = null; private Statement stmt, … | |
Hello everyone... I have just a simple project where i have to draw a picture (Robot) and on a klick on a button, the Robot turns to the left. My problem is, the Robot turns correctly but the new Robot drawing (position showing the Robot from the left side, back … | |
Hi can anyone help me on this..I am tying to change the UIManager. UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); This gives me a lot of Exception. Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.plaf.synth.SynthLookAndFeel.paintRegion(SynthLookAndFeel.java:364) at javax.swing.plaf.synth.SynthLookAndFeel.update(SynthLookAndFeel.java:328) at javax.swing.plaf.synth.SynthRootPaneUI.update(SynthRootPaneUI.java:120) at javax.swing.JComponent.paintComponent(JComponent.java:778) at javax.swing.JComponent.paint(JComponent.java:1054) at javax.swing.JComponent.paintToOffscreen(JComponent.java:5221) at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:295) at javax.swing.RepaintManager.paint(RepaintManager.java:1206) at javax.swing.JComponent._paintImmediately(JComponent.java:5169) at javax.swing.JComponent.paintImmediately(JComponent.java:4980) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:770) at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:728) … | |
hello, hello! im probably being really dumb again, but i can't get java to run keyPressed() when i press a key. do i need to initialize the keylistener somewhere? any input is appreciated!(even if it's not help) import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JPanel; import … | |
hey people, I've been experimenting with some new (for me) java techniques, like keybindings. i've got a small app, where the bindings work fine, untill i press a JButton with actionListener. the actionListener doesn't do anything at all, but keybindings fail after i press one of them. here's my code … | |
Hi All, I am developing a Java Swing application where I am using MS Access database. The problem is when I want to move this project to another location or machine or workspace, I need to change the data source properties in "Administrative Tools". Is there any work-around for this … | |
I have been working on Java game development for a few years.Obviously questions are going to be raised during the development period.I have come to notice that simple programming questions do not get answered by simple programming answers which are emphasised in lowering the morale of the questionaire and it … | |
i am making a application using java swing drag and drop property how can i add a calender without coding | |
Hello. I want to make a File->Open menu functionality to this program. In JMenuBar I think I create everything correctly but it doesn't display when I run it. How do I display it and make the Open functionality work? package oimg; import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; import … | |
This is our longquiz from this morning. don't worry.. I am not cheating off a quiz.. it's already 22:00 o'clock where I am. this quiz was on 8am. I am studying for our final exam tomorrow. we weren't told the right answers.. and I don't have a book right now … | |
Hi all, thanks in advance for the help. I have placed an "X" on the first JButton and what I need it to do is this... Once the user has clicked the button with the "X" it needs to disappear and reappear on a different button. This process needs to … | |
am trying to load a csv file on my application which allows the action listener to call a readfile method and displays the 2d array on the file to the textarea. i am getting a compliation error of such. pls how do i rectify this setText(java.lang.string) in javax.swing.text.jtextcomponent cannot be … | |
And I want to show the different words in two text files and make them bold, show on the screen. my code compiles when entering a word show the common words in two txt files and underlined them. instead of entering the word, I want to read a txt file, … | |
So I have successfully implemented a search feature into my tiny program but when I click the button to sort, it works fine but the images don't display. In the columns called "A" and "B", images are supposed to show up but they don't. http://i46.tinypic.com/2mx3og8.jpg . import java.awt.Color; import java.awt.Component; … | |
Hi guys, I'm trying to create an array with the length according to the number of rows in my database. So here is my code. I getting "array out of bound". import java.sql.*; import javax.swing.*; public class prg extends javax.swing.JFrame(){ String nameC = "HDB"; String nameCC = ""; int count=0; … | |
I am in the process of learning how I could use a JListDataListener to change JList elements at runtime: I am goggling this right now to collect examples: I would like to see some code on the subject if anyone has some examples -thanks Here is some code to create … | |
So I have the code below. The whole program just reads from a text file and prints certain characters if it detects specific characters from the text file (in this case I just made it mimics what the text file has). My text file contains this: .........www... bbb..........ww ...bb....ww.... The … | |
in java we use import javax.swing when we want to use frame and panel we write like this class frame extends jframe but in c++ we use <iostream.h> and <conio.h> where we use cin and cout from these libraray functions but we dont inherit anything .we use normally we dont … | |
Hello, I am trying to make a simple movie-managing application that allows the user to log into a particular username out of a list of usernames in a text file, and simply view information about movies kept in a text file. This is my first project, from which I would … | |
Dear all, I am working on MDI window JDesktopPane and JFrame. I need to play video in fullscreen mode. I know fulscreen exclusive mode, but this is not the one I wanted. I am trying this by using setUndecorated ion JFrame to screen size, but this will leave uncover MAC … | |
Hi there, I have developed a pool game for a project but am required to do some JUnit testing to finish it off but I have not been shown any in my course and as a result I am totally confused with how to do this. My lecturer won't give … | |
I want to add squares onto a jpanel one at a time after a delay . My program works fine until I tried to change the background color with setBackgound(). It didn't change. I worked out I have to call super.paintComponent(gr) in my paintComponent method. But when I do this … | |
1. I have some question regarding inserting two panels from a class to a JFrame from another class, both having same package of GUI. How to do this? 2.And how to make JFrame to display different panels during application run? Example, I have a JButton in class A which after … | |
> > Quoted Text Here i am doing a snmp monitoring tool using java.. how can i insert a word rather that inserting the object indentifier value in the text box. it will be more user friendly if users only need to insert the word rather than inserting the long … | |
I have to make an applet that gives you 2 single digit integers and you have to multiply and then it will tell you if you are correct. I got it to work but how do I make it continue the same set of numbers until you provide the correct … | |
I created the GUI to display the monthly mortgage payment for any loan principle at a specific term and rate. The GUI works fine but I have some improvements I can't seem to figure out and I need to display an amortization table. Issue# 1: I am usure how to … | |
Acronis responds to DaniWeb questions regarding a leak of customer data which, [as we exclusively reported over the weekend](http://www.daniweb.com/hardware-and-software/microsoft-windows/viruses-spyware-and-other-nasties/news/427455/breaking-acronis-blames-technical-issue-for-customer-data-leak), resulted in some information being indexed by search engines and accessible to anyone on the Internet.  Although the leak itself was identified by Acronis on Friday 29th June, the … | |
I have the following problem: Write a Java Applet that will help an elementary school student learn multiplication. Use either Random class or Math.random() method to produce two positive one-digit integers. The applet should prompt the user with a question. The student then enters an answer. If the answer is … | |
I am writing a program with java and i am having trouble displaying my .txt in my JTextArea. it shows it as 1 appended line and i want it to display the way it is set out in my text file. Here is my code: import java.awt.*; import java.awt.event.*; import … | |
Hello! I want the java code for login+registration form using swing along with mysql connectivity. i do not want jsp or java script coding. just simple java code. please revert as soon as possible! | |
Hi, i get an NullPointerException in this line:if (let==currentLink.aLetter) in search method. This is node class public class Letter { char aLetter; int points; Letter next; public Letter(char aLetter,int points) { this.aLetter=aLetter; this.points=points; } public Letter() { } public String printLink() { // System.out.print("{" + aLetter + ", " + … | |
Main.java [CODE] package scrabble; import javax.swing.JOptionPane; import javax.swing.JDialog; public class Main { public static boolean isDoubloon (String word) { int count[] = LetterHist.letterHist (word); for (int i = 0; i < count.length; i++) if (count[i] == 2 || count[i] == 0) continue; else return false; return true; } public static … | |
here i've created the first applet but it is not working, [CODE] import java.applet.Applet; import java.awt.*; public class FirstApplet extends Applet { public void paint(Graphics g) { g.drawString("Look at me, I'm a Java Applet!",10,50); } } [/CODE] i am getting no errors but when i am opening the html file … | |
On my class side I cannot seem to get netPay to calculate and am also having problems with finding insDeduct. On the demo side I have you choose between S - Single and M - Married. Any help would be greatly appreciated. [CODE]public class ChapterFiveClass { // Declare some fields … | |
The following four classes are an attempt to set up three different JFrames and switch between them. The three frames are: MainView, DetailView, and FormView. The main class is MultipleFramesExample. The four source codes constitute a NetBeans project with a package called FrameViews. MainView, DetailView, and FormView are essentially identical … | |
I am trying to format my text firlds so that if the user inputs letters or somethings improper, it will display an error message and ask the user to retry entering the number. i am not quite sure where to start with this part. i have the calculator code working … | |
HI all in Daniweb. I have a problem here. I wanted to create a desktop database application using Java DB Embedded. What is the problem here i try creating a frame from scratch and want to connect to the database. I have create a connection to the database. it was … | |
so basically for my uni work i have to create an applet that gives a word pattern for a particular sentence, ie '1 am a man' would give 2, 1, 1, because there are 2 1 letter words, 1 2 letter word and 1 3 letter word. the harder part … | |
/** * @(#)password.java * * * @author * @version 1.00 2012/7/14 */ import javax.swing.JOptionPane; import javax.swing.*; import java.util.*; public class password { public static void main (String[] args) { String user; user=JOptionPane.showInputDialog("enter password to continue(letter only)"); if(user.compareTo("adnan")) { JOptionPane.showMessageDialog(null,"ACCES GRANTED","welcome", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(null,"ACCES DENIED","error", JOptionPane.ERROR_MESSAGE); } } } | |
i want to create a program that would translate number to words from 1-1 billion this is how i started: package app.runner; import javax.swing.*; public class EnglishNumberToWords{ public static void main(String args[]){ int inputNumber=0; String oness[]={"one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"}; String tens[]={"ten","twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety"}; String answer=""; String calculate=""; inputNumber=Integer.parseInt(JOptionPane.showInputDialog(null,"PLease Enter a Number: ")); int billion=inputNumber/1000000; int … | |
import java.util.*; import java.net.*; import java.awt.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.plaf.*; import java.awt.event.*; import java.io.*; import snmp.*; public class SNMPInquisitor extends JFrame implements ActionListener, Runnable { JButton getDataButton, getTreewalkDataButton, getTableButton, getNextButton, setValueButton; JButton clearButton; JTextArea messagesArea; JScrollPane messagesScroll; JTextField hostIDField, communityField, OIDField, valueField; JLabel authorLabel, hostIDLabel, communityLabel, OIDLabel, valueLabel; … | |
Hey guys, I am creating a simple java swing app that would allow me to monitor the activity on my sites. I am using google analytics api to do most of the monitoring(breif descritpion can be found here : https://developers.google.com/analytics/devguides/reporting/core/v2/gdataJava) however this does not show how to incorporate the new … | |
Hi, I am trying to make simple gui which switches jpanel inside jframe but my IDE says "Cannot make static reference to non static method setPage(int) from the type Main". Why is that? There is no static modifier on actionPerformed or at setPage or actually anywhere else than public static … | |
**Hello i am a noob when it comes to java so sorry if its obvious but the code below is giving me a error when i try to compile it, the error is: Exception in thread "main" java.lang.Error: Unresolved compilation problem: at goodcalculator.main(goodcalculator.java:127). Can anyone help me? ** CODE: import … | |
I've a bill which looks like  this is the paper which i use in printer and i want to print the appropriate value in the correct position of that paper. As in the place of date i want to print date and in the place of Rate, Amount … | |
Hi, Here I face one problem in java application. I am working on one project, developed in java 1.4 & 1.5 swing, jboss, applet on netbeans 3.6. But I got an error when I try to debuge or execute in netbeans "IO EXCEPTION WHILE READING: Localhost". Project is successfully build. … | |
Following are the server-client programs,,,, in this client can send files and server have to save it,,,,,i want to add progressbar.....plz help me out!!! client:- import java.net.*; import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; class ftpclient extends JFrame implements ActionListener { JButton b1,b2; JTextField t1; ftpclient() { b1 =new … |
The End.