3,978 Topics

Member Avatar for
Member Avatar for Lensva

its supposed to draw an oval on MouseClicked: [code="java"] import java.awt.event.*; import javax.swing.*; import java.awt.*; public class PaintPad extends JPanel implements MouseListener { private int mouseX, mouseY; public static void main(String args[]) { PaintPad pad = new PaintPad(); pad.setGui(); } public void setGui() { JFrame frame = new JFrame(); JPanel …

Member Avatar for Lensva
0
1K
Member Avatar for k2k

I fixed the StackOverFlowError problem from my last thread.. however, my ActionListener is still not working. if any GUI guru here may point out the issue, it would be great. i think this is something very simple and i miss it. [code] //my ActionListener class import java.sql.*; import javax.swing.*; import …

Member Avatar for k2k
0
115
Member Avatar for cherryduck

Hi everyone, I'm trying to create a simple Java game, The Last Space Invader, where you control the last space invader and the tank automatically tracks and shoots at you. The code for my invader is as follows: [CODE]import javax.swing.*; import java.awt.*; import java.io.*; import javax.imageio.*; import java.awt.event.*; public class …

Member Avatar for cherryduck
0
499
Member Avatar for k2k

hi, would someone please point out what is wrong with my ActionListener setup? [code] // in my menu class, parse JScrollPane and JTable to the showTable constructor in the ShowTable Class showTableMItem.addActionListener(new ShowTable(scrollPane, table)); [/code] [code] /* * set local JScrollerPane and JTable to be the JScrollPane and JTable from …

0
77
Member Avatar for abhi_elementx

hi. I get a NillpointerException. Here's my code: [CODE] private void Login_ButtonMouseClicked(java.awt.event.MouseEvent evt) { String usrname = uname_TextField.getText(); String pass = passwd_PasswordField.getText(); String pwrd = pass.toString(); String args[] = null; boolean auth_flag = false; try{ R = S.executeQuery("select uname, passwrd from Employee_Master;"); while(R.next()){ if(usrname.equals(R.getString("uname"))){ if(pwrd.equals(R.getString("passwrd"))){ this.dispose(); [B]args[0] = R.getString("uname")[/B]//causing nullpointerexception …

Member Avatar for BestJewSinceJC
0
115
Member Avatar for abhi_elementx

hi. I have a jlist on a frame. I want to add items dynamically in the list. So, I am using DefaultListModel..Here's my code: [CODE]public class AdminFrame extends javax.swing.JFrame { private Statement S; private ResultSet R; DefaultListModel model = new DefaultListModel(); JList Employee_list = new JList(model); /** Creates new form …

Member Avatar for JamesCherrill
0
76
Member Avatar for ClimaxBeetle

Hello, this is my first time in participating in this forum and also this is the first time that I've used Java for my entire life. The objective behind my problem was: "Create an Animal Interface that has two methods: eat and move. All these methods do not have any …

Member Avatar for BestJewSinceJC
1
136
Member Avatar for abhi_elementx

Hi. I have two tables in mysql - [B]customer_master[/B] and [B]contact_master[/B]. customer_master has a primary key - "cust_id" ,which is a foreign key in contact_master and "cust_name" which is also a foreign key in contact_master. I have a [B]frame[/B] which will do [B]CRUD operations for contact_master[/B]. The frame has two …

Member Avatar for BestJewSinceJC
0
838
Member Avatar for jacline

I wrote a code about circle starts to grow followed by finner circles, with each new one disappearing earlier while growing but in my code it is only growing how can I disappear the early one?? I didnt put the main method only classes [code] import java.util.ArrayList; import javax.swing.*; import …

Member Avatar for Ezzaral
0
171
Member Avatar for abhi_elementx

hi all. I want to ch ange my jframe's icon(cup of coffee). i chkd the forum but that's what i m doing... here's my code: [CODE]public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { AppStarter dialog = new AppStarter(new javax.swing.JFrame(), true); dialog.setLocationRelativeTo(null); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public …

Member Avatar for abhi_elementx
0
194
Member Avatar for christiangirl

Hello, this code is throwing and IOException and FileNotFoundException and I am having trouble figuring out why. Where exactly does the song need to go in order for the program to pick it up? Also, is this code for putting the song in the program correct? Thanks! [code] //Hangman a …

Member Avatar for christiangirl
0
138
Member Avatar for abhi_elementx

Hello guys. I am doing a swing application wherein I m using a DefaultTableModel. Here's my code: [CODE] DefaultTableModel tab = new DefaultTableModel(){ @Override public boolean isCellEditable(int r, int c){ //if(c == 10) {return true;} return false; } }; private JTable jt = new JTable(tab); [/CODE] The JTable will diplay …

Member Avatar for abhi_elementx
0
110
Member Avatar for VernonDozier

I am trying to learn GridBagLayout. I've gotten the hang of it in many respects, but I am having serious problems when the first row has element(s) with a gridwidth greater than 1 or the first column has elements(s) with a gridheight greater than 1. I'm trying to make a …

Member Avatar for VernonDozier
0
405
Member Avatar for neutralfox

Hello everyone, Can someone please explain to me the meaning of the code below: [code] public class Client extends javax.swing.JFrame implements Runnable { // constructutor public Client( String host, int port ) { . . . new Thread( this ).start(); } public void run() { something.... } } [/code] This …

Member Avatar for JamesCherrill
0
123
Member Avatar for mkadiri

Im stuck on my loop program, I have to create a loop program for arrays which only stops if a user inputs quit or the user has input 1000 entries, the program then has to sort the arrays in order of composer. I've tried so many different kinds of algorithms …

Member Avatar for mkadiri
0
123
Member Avatar for jacline

a GUI application that presents a game based on a 4 by 4 matrix of buttons.One of the buttons (selected at random) "hides" the prize. A status bar at the top of the window shows the number of guesses. When the prize button is pressed, the status bar shows "You …

Member Avatar for jacline
0
807
Member Avatar for syuk

DEAR JAVA EXPERTS. can u help me? i dont know how to do the next move.... i want to write code that can make each object of the class Book can hold the following information about a book: title, up to four authors, publisher, ISBN, price, and number of copies …

Member Avatar for BestJewSinceJC
0
218
Member Avatar for jacline

Design and implement a simple GUI application (or applet) that displays the graph of a quadratic function, Ax2 + Bx. Below the plot should be two sliders which allow the user to interactively set the values of A & B, the display being updated continuously in response to any changes …

Member Avatar for jacline
0
130
Member Avatar for easytrucker45

I am having problems getting my program to compile and run. Newbie from the word go. The main problem is I have all of the code but I cannot make the other classes go with the main class. Any help would be great. Here is the code that I have …

Member Avatar for easytrucker45
0
253
Member Avatar for Hockeyfreak889

ok the other day i posted about how to actually display an image and then what the best way would be to read in a location of an image and then display it. Now my new question is how do you resize an image. At the moment the image i …

Member Avatar for JamesCherrill
0
285
Member Avatar for k2k

Okay, I basically have a menu bar with menuItems.. say just showTableMenuItem --> to display the table .... and addMenuItem() --> to add new record. I want to be able to display the table (when user clicks on the button), and then disappear the table and display the addMenu page(when …

Member Avatar for k2k
0
127
Member Avatar for britto

hi everyone.... im doing IDE for java swing (like dragging comp into design area)... is there a way to save the design as format and when i open it the design must be showed as it was saved.... Thanks in advance...

Member Avatar for darkagn
0
84
Member Avatar for MxDev

Hi guys, how to read a unicode characters (arabic characters) form ResultSet object which appears after extraction as question marks like this(?????) i've tried to use the "getUnicodeStream()" method and "getCharacterStream()" method but both leads to the same results, does anyone have a workaround to this problem. Thanks in advance. …

-1
84
Member Avatar for AirmanTheGreat

Hello, I am to write a program that is capable of taking an array of doubles from the user, then calculating each numbers square, cube etc. and then displaying it to the screen. The program itself is fine, but one aspect of the program is that if a user enters …

Member Avatar for AirmanTheGreat
0
82
Member Avatar for lauren316

THis program is supposed to take a number (1-5) from the user. After each number is entered, it should ask how many of each product they want, then show the total for that product and and overall total at the end. I have to use a swich statement. And stop …

Member Avatar for BestJewSinceJC
0
113
Member Avatar for younaskhanpk

You are required to develop a GUI for car show room. The program must use collection to store and process information about cars. The class for car information must have following attributes: 1. Name of car’s manufacturer 2. Name of car’s owner 3. Registration number of car 4. NIC number …

Member Avatar for younaskhanpk
0
100
Member Avatar for hell_tej

hi I am using NetBeans 6.0 to create my Desktop Application which is swing based Database Application. I want to create a splesh screen in my application using JavaFX but i don't know how to visible created JavaFX. Can Anyone tell me how to create Splesh screen using JavaFX or …

Member Avatar for peter_budo
0
156
Member Avatar for JavaKiddo

This is a conceptual question... I'm planning to make a simple paint program using swing and I want to plan it in advance before I actually code it. I want to be able to draw some rectangles using fillRect, etc, and then be able to drag those rectangles around the …

Member Avatar for Ezzaral
1
123
Member Avatar for subho07

i want to display data from a table using jTable in swing.how can i increase the text fields....kindly can anyone give me some codes

Member Avatar for subho07
0
247
Member Avatar for 25kayden

Here are the errors I am getting, but I can't figure it out. Please help: GUI.java: 10: illegal start of expression public GUI(MovieCollection i) { ^ GUI.java: 110: illegal start of expression private javax.swing.JButton extButton; ^ GUI.java:111: illegal start of expression private javax.swing.JTextArea text Area; Here is my program: //GUI.java …

Member Avatar for JamesCherrill
0
116
Member Avatar for Intrade

Why is it that when I attempt to repaint the entire Applet, the screen flashes (as if the repaint requests are slowed down due to many details being painted all at once), whereas a repaint to a JPanel added to the ContentPane of the JRootPane doesn't flash at all? Then …

Member Avatar for Ezzaral
0
127
Member Avatar for gyagyus

Hi, I try to use this function and although I have imported javax.swing.JComponent, the compiler does not recognize it ("cannot find symbol method paintImmediately(int,int,int,int)"). Any help would be greatly appreciated, gyagyus

Member Avatar for Ezzaral
0
85
Member Avatar for jackiejoe

Having a problem with getting my array into a TextArea, I originally wanted to use a JTable but found the Table Model and what to do too difficult for what I want so my question is I have my array and now I want to display it inside a TextArea, …

Member Avatar for javaAddict
0
2K
Member Avatar for get2tk

after building the GUI using the java swing and awt ,how do i make the response of my mouse click pass the mesage accross from the client;s machine to the server machine?and where can i reaD more about it and also how do i get it to control and update …

Member Avatar for JamesCherrill
0
62
Member Avatar for G-to-the-RIZZLE

Could potentially have the longest error message EVER and have no idea how to solve it .... Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems: The import java.sql cannot be resolved The import javax cannot be resolved Connection cannot be resolved to a type Statement cannot be resolved to a …

Member Avatar for G-to-the-RIZZLE
0
2K
Member Avatar for k2k

Hi, I am trying write a program to input and output data from a microsoft access file with java.sql class and the swing class. basically i am on the first stage, trying to figure out different parts. the first thing i would like to know is: (assume it is already …

Member Avatar for k2k
0
285
Member Avatar for bunifrog

Hi Everyone I am new and just found this site yesturday I am looking forward to visiting here often. I have been working on this project (yes for school the awful Inventory Program.) I had it working and did a couple of quick changes walked away for a nap and …

Member Avatar for bunifrog
0
140
Member Avatar for denniskhor

[CODE]/* * PartOfSpeechView.java */ package partofspeech; 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 javax.swing.JDialog; import javax.swing.JFrame; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileNotFoundException; import java.io.IOException; /** * The application's main frame. */ public class PartOfSpeechView …

Member Avatar for ejosiah
-1
179
Member Avatar for lounestor

hi im a new memeber .iv started learning java recently. i was wondering could anyone help with this problem because i just cant seem to work out where i'm going wrong. its my method call thats giving me the proplem...i think. if anybody has any solutions i would be grateful …

Member Avatar for lounestor
0
134
Member Avatar for neutralfox

Hello everyone, I am in big trouble, actually, I am developing a chat in Java. I am still on the server part, but the problem is that when i am clicking on a button to instantiates a class, the whole program freeze, please help me to figure out this problem. …

Member Avatar for neutralfox
0
2K
Member Avatar for charlie81

Not sure how to call the methods in this program. [CODE]import javax.swing.JOptionPane; public class Main_Class { private static final char Y = 0; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub /** * @param args */ // declare variables int input1, input2, …

Member Avatar for darkagn
0
90
Member Avatar for jackiejoe

So I have been messing around with Swing and am starting to grasp general functions with buttons and text boxes etc.. But what I want to do is have a main page (JFrame Form) with 3 buttons and when I click whichever button I want it to open another JFrame …

Member Avatar for weblover
0
120
Member Avatar for madden88chw

I have the following as my code, and i cant figure out why i am getting this error. I think it has to do with my While statement. Please help! [code] import javax.swing.*; import java.lang.String; public class FollowingDate { public static void main(String[] args) { String date, month, day, year; …

Member Avatar for verruckt24
1
158
Member Avatar for smoore

Okay I have a finished program that does the job of what I want to to do but it seems so messy. Could you guys gimme some suggestions about how to make this code more efficient... or just neater in general. Much appreciated and thanks in advance. [CODE] import java.awt.*; …

Member Avatar for verruckt24
0
1K
Member Avatar for jackiejoe

Hi, learning swing at the moment and was following a tutorial off the sun website, made mine with eclipse instead of netbeans. but all I get when I try to run it is the following in the Console window: gap= 4 gap= 0 Not sure what is going on here. …

Member Avatar for BestJewSinceJC
0
295
Member Avatar for charlie81

I have error in the top of this program not sure what I did wrong. import javax.swing.JOptionPane; public class Main_Class { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub class wk2 { private static final char Y = 0; /** * @param …

Member Avatar for jasimp
0
159
Member Avatar for ComputerGirl

hi i need help with writing a program...I have to Write a program that simulates a student registration. A button allows entering a student name. Three more buttons are used to enter test scores. Name and test scores are entered into a text field. The information about the student, including …

Member Avatar for darkagn
0
137
Member Avatar for Darkwater

Hey there. I'm using a JTable for the first time, and I've read through the Sun and other tutorials, but this simple concept is still confusing me. So I seek help! Basically; I'm creating a multiplayer (AI-controlled) mining game, which will display maps loaded from XML. I've parsed the XML …

Member Avatar for Ezzaral
0
161
Member Avatar for charlie81

I know I am missing somethings in my code not sure what I am supposed to put in. Here is what I have so far. import javax.swing.JOptionPane; public class Main_Class { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String firstNumber;//first number …

Member Avatar for verruckt24
0
167
Member Avatar for rayda

[ICODE]public class fermi { private int[] guess; private int[] random; private int total; private int win; private int lose; public fermi(int[] gs, int[] rn) { guess=new int[gs.length]; for(int i=0;i<gs.length;i++) guess[i]=gs[i]; random=new int[rn.length]; for(int j=0;j<rn.length;j++) guess[j]=gs[j]; } public fermi() { total=0; win=0; lose=0; } public int totalPlay() { return total+=1; } …

Member Avatar for verruckt24
0
103

The End.