3,978 Topics

Member Avatar for
Member Avatar for Aviras

Hello everyone. I just started on 'converting' my multiplayer text RPG into a graphical form. What I am trying to do is this: Create a title window, basicly just a JPanel with one image filling the space. To this JPanel I add a MouseListener. When a user clicks the window …

Member Avatar for Aviras
0
424
Member Avatar for NEEDHELPINJAVA

Hi, I'm new in this forum and I'm here to ask help on a topic the lecture I didn't turn up. I'm new to creating a search function for my Java application where the user can view the information of the books, such as title, author and the price of …

Member Avatar for Killer_Typo
0
236
Member Avatar for mike101290

Here is my code. my problem now is how to convert it to GUI. [CODE]public class ProductController extends ProductModel{ public String getPname(int barCode){ return this.pname(barCode); } public double getPrice(int barCode) { return this.price(barCode); } public void displayCartControl( int retryTrigger ){ this.displayShoppingCart(retryTrigger); } } [/CODE] [CODE]public class ProductModel { public static …

Member Avatar for NormR1
0
460
Member Avatar for Kronk Vaesir

[B]Can anyone help me. I have been bangin my head on this one for two days. variable number may not have been initialized. code to enter single digit number and return largest of ten. code is as follows.[/B] [code] // Java packages import javax.swing.JOptionPane; public class Counter { // main …

Member Avatar for Ezzaral
0
3K
Member Avatar for abhinavM

I have to read an Excel file and transfer the contents to the database using Java swing.The excel file contains questions for the surveys with options for answers or responses.The database should have a table say Question with columns "Question No., Question, Option 1, Option 2 and so on".I have …

Member Avatar for stultuske
0
1K
Member Avatar for jex310

Can you fix the numberformatexception [code]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main extends JFrame implements ActionListener { int inputtedxend,inputtedyend,inputtedSAngle,inputtedarcAngle; int inputtedxpoint,inputtedypoint,inputtedx,inputtedy,inputtedwidth,inputtedheight; JLabel title=new JLabel("Choose a Grapic Method: "); String select []={"","DrawLine","DrawOval","DrawRect","DrawArc","DrawString","DrawRoundRect","fillRect","fillOval", "fillArc"}; JLabel xend=new JLabel("Enter X end point:"); JTextField inputxend=new JTextField("",5); JLabel yend=new JLabel("Enter Y end point:"); JTextField …

Member Avatar for Muralidharan.E
0
130
Member Avatar for lsvife

could anyone help this... when i run my application i got this error.. Running with storage root C:\Users\182\j2mewtk\2.5.2\appdb\DefaultColorPhone Exception in thread "Child process stdout copier" java.lang.ClassCastException: sun.java2d.NullSurfaceData cannot be cast to sun.java2d.d3d.D3DSurfaceData at sun.java2d.d3d.D3DRenderer.copyArea(D3DRenderer.java:55) at sun.java2d.d3d.D3DSurfaceData.copyArea(D3DSurfaceData.java:665) at sun.java2d.SunGraphics2D.doCopyArea(SunGraphics2D.java:1986) at sun.java2d.SunGraphics2D.copyArea(SunGraphics2D.java:1968) at javax.swing.BufferStrategyPaintManager.copyArea(BufferStrategyPaintManager.java:316) at javax.swing.RepaintManager.copyArea(RepaintManager.java:1239) at javax.swing.JViewport.blitDoubleBuffered(JViewport.java:1604) at javax.swing.JViewport.windowBlitPaint(JViewport.java:1573) at javax.swing.JViewport.setViewPosition(JViewport.java:1118) …

Member Avatar for peter_budo
-1
79
Member Avatar for PROgamer

Im having a problem with this program why i am not able to set present total price of product if gonna seect the product form combo and the remove button cant get the selected index,retrieve the selected item and remove the selected item from the list using its index or …

Member Avatar for PROgamer
0
241
Member Avatar for smiles5611

Hi I am in a java class and am working on a mortgage calculator with gui. I think I almost am done and have the assignment parameters completed but am stuck on two issues. 1) can't get my scroll pane to work. 2) I want to have the user select …

Member Avatar for NormR1
0
250
Member Avatar for conanzz

I have a picture with 2 buttons, and I want to move it through these buttones the problem is I don`t know how to make the actionListener for the other button to move to the other side, [COLOR="Red"]pictures are in the attachments[/COLOR] [CODE]import java.awt.event.*; import javax.swing.*; import java.awt.*; import javax.imageio.*; …

Member Avatar for conanzz
0
206
Member Avatar for phoenx

I have a problem in my game about button how I can display the random number example "3 + 5" in the upper button ...I try one button here but you need to click it in order to see the random number and only one number will appear..please any idea.. …

Member Avatar for phoenx
0
165
Member Avatar for triumphost

How do I call the function in the button section?? I tried doing target(); and got when the program ran, it gave me some exception thing.. [CODE] package smart; import java.applet.Applet; import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.Point; import java.awt.event.ActionEvent; import …

Member Avatar for triumphost
0
301
Member Avatar for akasekaihime

we were asked to create a calculator in java applet......My codes are working except for one thing....whenever I click the clear button, it only erases the first,second and the total sum.....it does not clear the total difference, total product and total quotient....please help me what to do?...... here is the …

Member Avatar for akasekaihime
0
254
Member Avatar for thesimplestnick

So I was trying to add elements into my list. But for some reason the words inside the list are very very small.... is there anyway to increase the font? I tried setFont, doesn't work. :( [CODE] import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import javax.swing.event.DocumentListener; public class sub …

Member Avatar for JamesCherrill
0
164
Member Avatar for sirlink99

I have this snake game I keep talking about and I added in a menu. now when I run the snake game the first time it works. When I press T to return to the title, it returns. When I click on the colored snake game after that the snake …

Member Avatar for NormR1
0
189
Member Avatar for akasekaihime

We are asked to create a calculator but before I do that I must correct the codes given in order for me to know what I must add in my calculator but I do not know how to solve the "void cannot be referenced " error...how can I do that? …

Member Avatar for JamesCherrill
0
1K
Member Avatar for nsyncpilu

Hy , I have a problem with the TableModelListener , my application should print out the cell were the content has been modfied but it does notheing. Here is my code. [CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; import javax.swing.event.*; /** * * @author Pilu */ public class Afisare …

Member Avatar for nsyncpilu
0
464
Member Avatar for sirlink99

I am trying to make a snake program The code I currently have looks like this [CODE] import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.util.*; public class SnakeG extends JPanel implements KeyListener, Runnable{ private Vector<Point> snake = new Vector<Point> (5,2); private Vector<Rectangle> snakeRectangle = new Vector<Rectangle> (5,2); public void startGraphics …

Member Avatar for sirlink99
0
368
Member Avatar for conanzz

I want to update 0X0 when I press of the "AC Milan" to be "1X0" and the last scorer also to be updated with the winner; Also, how to fix the alligenment to the center >>! [CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TestSwingListeners1 { public static void main(String[] …

Member Avatar for mKorbel
0
299
Member Avatar for jsook724

Hi everyone. I am trying to make a batting average calculator, but i am pretty new to java. I want to make it look like this: [url]http://www.kll.org/batting-average.htm[/url] All i have right now is JOptionPanes, and it works, but it doesnt look very nice. So i know i need to put …

Member Avatar for NormR1
0
307
Member Avatar for mattyg1192003

Hello everyone, I have a question regarding a Japplet that I am creating for a theatre. The program is supposed to take a yes or no response from the user, take which section the user will be sitting in, ask how many tickets they would like to purchase, and then …

Member Avatar for mKorbel
0
138
Member Avatar for nsyncpilu

Hy , i read all the other posts about this error but didn`t helped me , tried google but notheing. I have the following method : [CODE] private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: DefaultTableModel model = (DefaultTableModel)jTable2.getModel(); int nrrows = jTable2.getSelectedRowCount(); int[] rows = …

Member Avatar for nsyncpilu
0
2K
Member Avatar for Mylo92

Good day, I'm new and glad to be here, I just need a help with the my code can anyone help me find the main error with it? The JList is giving me hell and since I migrated to a new laptop I'm failing to establish a connection with my …

Member Avatar for peter_budo
0
216
Member Avatar for civirol02

Hi I want to know what's the problem with my code. I'm just a beginner. I'm trying to display the smallest number, but everytime I run the program, the output is always equal to zero. However if I use this code to find the largest number, wherein the boolean condition …

Member Avatar for civirol02
0
3K
Member Avatar for localp

I need to create a swing application, and draw a rectangle and paint it with RGB values. [CODE] Color c = new Color(10, 198, 19, 23); [/CODE] How should i do this ? any tutorial or example i could start with ?

Member Avatar for Ezzaral
0
67
Member Avatar for cozmo87

Hi everyone, I'm writing a program that reads numbers from a text file, stores them in a table, does calculations on the numbers and displays the result in a jTable. The scanner reads the numbers as doubles and stores them in an ArrayList. My tablemodel is very similar to the …

Member Avatar for Zetlin
0
175
Member Avatar for stevanity

Im not asking for home work help .I need a guide.. My teacher gave a huge project work for me. I have to develop an application that maintains basic info about all students in my college (every department and IV batches in each department). And I need to maintain their …

Member Avatar for stevanity
0
384
Member Avatar for Jake.20

Guys need help. i'm having problem in setting the font-size of my jtfText. every time i set the font-size of jtfText all the panels and buttons is also getting bigger but not their font-size just the buttons. This is my code [CODE]import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.event.*; import …

Member Avatar for Ezzaral
0
209
Member Avatar for Jessurider

how can i make the border line to the position shown in the attachment [CODE] package proj; import java.awt.BasicStroke; import java.awt.Color; import java.awt.print.PrinterJob; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.awt.print.Book; import java.awt.print.PageFormat; import java.awt.print.Printable; public class j extends javax.swing.JFrame { public int st,i,k1,k2;PrinterJob printJob = PrinterJob.getPrinterJob(); String str[]=new String[20]; …

Member Avatar for NormR1
0
183
Member Avatar for jason_joseph60

[CODE]import javax.swing.*; import javax.swing.JButton; import java.awt.*; import java.awt.event.*; public class CreateTabbedPane extends JFrame implements ActionListener { JButton b1; JTextField txt1; public CreateTabbedPane() { JFrame frame = new JFrame("Tabbed Pane Frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tab = new JTabbedPane(); tab.addTab("Jay",new abc()); tab.addTab("RD",ram a); } class abc extends JPanel { public abc() { txt1=new …

Member Avatar for NormR1
0
125
Member Avatar for djbhoco

This program is to design a gui for users to add any loan amount, term, and APR; the program then gives a monthly note amount in that field. I cannot figure out what I'm doing wrong. I also cannot get the reset button to work. Can anyone give me an …

Member Avatar for mKorbel
0
240
Member Avatar for sirlink99

I am going to make a calculator and I am having some Issues arranging the buttons. You should be able to see the layout when you run the code. Some clarification though there will be a blank spot under the "3" for a "+/-" button (switches between positive and negative). …

Member Avatar for Ezzaral
0
169
Member Avatar for intes77

Hello im currently having problems with the storing of String to an array im currently using a GUI output so it reads inputs from the textfield here's my code: [CODE]import java.util.*; import javax.swing.*; public class Contents { int listLength; String []word; String []meaning; String []sentence; String []classification; public Contents(int l) …

Member Avatar for intes77
0
806
Member Avatar for fatjoy25

import java.awt.*; import javax.swing.*; import java.awt.Color; import java.awt.event.*; import javax.swing.event.*; import java.io.File; import java.util.*; /* <Applet Code="MyPaint.class" width=400 height=400> </Applet> */ public class MyPaint extends JFrame { /* Declaring the variables.*/ JPanel panel; JPanel textAreaPanel; JTextArea drawTextArea; JScrollPane drawScrollPane; JLabel line, color, paint,kid,cil; JButton circle, rect, poly, ellipse; JComboBox cbLine, …

Member Avatar for NormR1
0
126
Member Avatar for BlackGazer

My operators are pretty much working well, but the problem is every time I do an operation (example: 1+2 = 3) and then tried clicking another number the number that I clicked adds up with the result (so this is what happens, the result is 3, then I click 7 …

Member Avatar for contra_shadow
0
348
Member Avatar for duuude

Hi, I'm trying to use tabbedpanes, my objective is to have a frame split in half( in height). You have the upper tabbed pane, and the lower tabbed pane. Both of them have the same three panels, so the user can choose wether to see panel1 in up and pane2 …

Member Avatar for Anuradha Mandal
0
140
Member Avatar for phoenx

anyone know how to fix the border so that box stay on its position..any reply tanx..:D [CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Exer extends JApplet implements ActionListener{ JButton button1, button2, button3; JTextField tf1, tf2, tf3 ; JLabel counter1, counter2, sum; int total = 0, ans1,ans2; public void …

Member Avatar for Majestics
0
138
Member Avatar for jamd200

[code=java] /*This is a small GUI application that I made for personal use. It allows you to enter the colors of the bands on a 4-band fixed resistor to calculate the resistance (and tolerance) of that particular resistor. Eventually, I will create a version that deals with 5-band and 6-band …

Member Avatar for jamd200
0
7K
Member Avatar for sirlink99

I am trying to read a custom file extension When reading a string from the file it output the correct string, however when I attempt to read an int it does not output the correct int. Here is my code: [CODE] import java.awt.event.*; import java.awt.*; import java.io.BufferedReader; import java.io.FileInputStream; import …

Member Avatar for NormR1
0
276
Member Avatar for sirlink99

I have this key listener in my application, and it wont work. This is my first key listener in an application, however I have done a mouse listener in one before. Anyway here is my code: [CODE] import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.*; public class DropGame extends JPanel …

Member Avatar for sirlink99
0
520
Member Avatar for sirlink99

Hello. I am trying to make a program that has a menu. When you click play , it should (for now) output the text "In Game". It does that. However, it prints the text on a new JFrame. I would like it to print it on the same frame. How …

Member Avatar for sirlink99
0
132
Member Avatar for Majestics

[code] import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.DefaultCellEditor; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class main implements ItemListener { String[] a = {"one","two","three"}; String[] b = {"4","5","6"}; String[] c = {"7","8","9"}; String[] d = {"10","11","12"}; String[] e = {"13","14","15"}; JComboBox a1 = new JComboBox(a); JComboBox b1 …

Member Avatar for Majestics
0
234
Member Avatar for stevanity

Im trying to make a calculator and I thought of using the ScriptEngine class to evaluate expressions. So I designed the following code: CalculatorFrame.java : [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.lang.Math; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; public class CalculatorFrame extends JFrame { public CalculatorFrame() { setTitle("My Scientific Calculator"); …

Member Avatar for stevanity
0
2K
Member Avatar for marsangel

Hi! I am having problems with my login form. So I created a database for my login form so that i can create multiple user. That works fine but when I try to log in the user created an error shows: Error: [CODE] java.sql.SQLException: No row count was produced at …

Member Avatar for marsangel
0
340
Member Avatar for eagl09

Keep getting reached end of file while parsing error I have been told this error is from extra or missing closing brace in code..CANNOT find where it is at. any help?? [code] import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class BasicCalculator { private static …

Member Avatar for rubberman
0
334
Member Avatar for lynnajoe

Hi, This program has the information I need it to have but instead of going down in a column it goes straight across. Can someone show me where to get the formatting for this kind of code? I tried different things to no avail. Thank you for this and all …

Member Avatar for JamesCherrill
0
160
Member Avatar for stevanity

Im reading Core Java (Cay Horstmann) V I And I came across this program......... [CODE]import javax.swing.*; import java.awt.event.*; import java.awt.*; class MyFrame extends JFrame { private ButtonPanel buttonPanel; public MyFrame() { setSize(300,200); setLocation(570,350); setTitle("Button Test"); buttonPanel=new ButtonPanel(); add(buttonPanel); } private class ButtonPanel extends JPanel { public void paintComponent(Graphics g) { …

Member Avatar for NormR1
0
966
Member Avatar for 2blew2b

my program does allow it to build with no errors but when the answer is right or wrong, it doesn't actually draw the appropriate string. I coded it in a way that I feel like would make it work but after clicking on the check answer button, nothing happens. Any …

Member Avatar for pbl
0
152
Member Avatar for bufospro

Hi, I am trying to make a timer applet when I click stop button to stop counting, disappear stop and appears continue button and when I click continue to continue the counting. My code is : [CODE] import java.applet.*; import java.awt.*; import javax.swing.*; public class Timer extends Applet implements Runnable …

Member Avatar for mKorbel
0
99
Member Avatar for KAY111

Hey, I am writing this program in which I get x and y coordinates on stdout from a C program.....something like 23 34 45 56 21 56 .. . and so on.... now I need to pipe these values into a Java program and display a cube at the corresponding …

0
115

The End.