3,978 Topics

Member Avatar for
Member Avatar for aznnytezx

import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Random; public class snake1 { public static void main(String args[]) { String name1= JOptionPane.showInputDialog("Enter Player one's name"); Windows myW=new Windows(name1); myW.setSize(800,600); myW.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { System.exit(0); } }); myW.show(); while(true) { myW.repaint(); try{Thread.sleep(60/myW.getLevel());}catch(Exception e){} } } } …

Member Avatar for jasimp
0
99
Member Avatar for regent_royal

Hello friends, I want to overlap two JPanels at same location in the same frame... by clicking button on the same frame. If one panel is setVisible(true) at the same time if I click button and this Panel will be setVisible(false) another will be setVisible(true) but that does not resolve …

Member Avatar for masijade
0
69
Member Avatar for msnider9

I am not able to click on the menu choices and have them fill out the form. I also am not certain that it is reading from the text file. Can someone check and let me know what I need to change in this program? [code] import java.awt.*; import java.awt.event.*; …

Member Avatar for peter_budo
0
89
Member Avatar for anbuhikaru

i need to convert this JApplet program into a JFrame, but dont know how to do it, can anybody help me please? [this is extremly urgent as i need to have this done by tuesday] [code=language] /*Game.java 5.5.08 This program, Game.java, is an educational game that tries to allow the …

Member Avatar for jwenting
0
86
Member Avatar for hurly

Ok, I'm stumped and asking for a push. I need help adding an instance variable for my timer in my frame class. After that I need to : Instantiate your timer. Pass in the initial time (in seconds) and a reference to your timer display JTextField object. This can be …

0
61
Member Avatar for BBaller1211

I'm new to Swing, and still relatively new to Java as a whole, and am having trouble with my first Swing program. I'm trying to make a simple Pong game - it will display the title screen with a "Play" button on it that when pressed starts the game. Here …

Member Avatar for BBaller1211
0
82
Member Avatar for aznnytezx

[code] import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Random; public class snake1 { public static void main(String args[]) { String name1= JOptionPane.showInputDialog("Enter Player one's name"); Windows myW=new Windows(name1); myW.setSize(800,600); myW.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { System.exit(0); } }); myW.show(); while(true) { myW.repaint(); try{Thread.sleep(60/myW.getLevel());}catch(Exception e){} } } …

0
57
Member Avatar for Barman007

Now this is an assignment for me, but ive spent the last two weeks writing this code day and night, I just cant get it out of my head, I have to beat it lol. So anyway, two days ago I won and completed my program exactly the way I …

Member Avatar for Barman007
0
93
Member Avatar for TheWhite

[code=java] import java.awt.Color; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Testing extends JFrame { public static void main(String[] args){ SwingUtilities.invokeLater(new Runnable() { public void run(){ new Testing(); } }); } private Testing(){ super("tester"); launch(); } private void launch(){ setBounds(200, 200, 300, 300); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel topPanel = new …

Member Avatar for TheWhite
0
3K
Member Avatar for wujianwei
Member Avatar for javaAddict
0
98
Member Avatar for degamer106

When I add buttons to a panel, the buttons seem to take a huge amount of space. How do I get rid of the space? For example: [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Tester { public static void main(String[] args) { JButton dayButton = new JButton("Day"); JButton …

Member Avatar for jwenting
0
183
Member Avatar for mo86uk

Hi Guys, I was trying to build a library catalogue with GUI (Graphic User Interface) which consists of two text boxes and four buttons. I have actually created the layout, but I dont know how to add actions to the buttons. Could anyone help me please. the Question is: for …

Member Avatar for jwenting
0
3K
Member Avatar for javauser215

I have several files and am receiving errors message when compiling and would appreciate any help. Thank you in advance. Model class file: [CODE]class Model extends Product5 { String genre; //add product to product inventory double restockFee; //fee for restocking //initialize constructor public Model( String genre, String name, int identificationNumber, …

Member Avatar for javauser215
0
123
Member Avatar for nadhi

Good day to all! I am glad to join this technical forum. I am very new to programming and I am here to learn many technical things from the group. I have been assigned a task of developing an application for a project I am in. I have sought help …

Member Avatar for nadhi
0
80
Member Avatar for monster597

Hi I have design a basic JFrame which displays three buttons in a frame. The code is given below: import java.awt.*; import javax.swing.*; public class PaymentFrame { public static void main(String[] args) { JFrame f = new JFrame("Payment Frame "); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(800, 600); Container content = f.getContentPane(); content.setBackground(new Color(240,170,50)); content.setLayout(new …

Member Avatar for Ezzaral
0
127
Member Avatar for nadhi

Hello all! I am trying to create a form like structure using Swing to enter data into MySQL database. I have a combo box that has a list of items to be chosen. If the user does not find the option that he needs, he can choose 'Other' as an …

Member Avatar for nadhi
0
94
Member Avatar for dayanandabv

Hi all, I am getting Null pointer exception while getting other applet in the same page, can guide what i am doing wrong here is demo code [code] // First applet import java.applet.Applet; public class Applet1 extends javax.swing.JApplet { Applet applet1 = null; public void init() { try { java.awt.EventQueue.invokeAndWait(new …

Member Avatar for dayanandabv
0
154
Member Avatar for degamer106

I'm having a little trouble trying to nest two component classes (both extend JComponent) together. When I create the frame in my tester file, instantiate each class, and try to add both of them to the frame, it doesn't come out correctly. For instance, I want my frame to display …

Member Avatar for masijade
0
148
Member Avatar for Taker

Hi Everybody I am in need for help. I have a program which is surppose to allow the user to input a boat and a time and date of hire for that boat. Problem is that the button wont work and i dont know how to get the time in …

0
74
Member Avatar for gator6688

[CODE]import java.text.DecimalFormat; import javax.swing.JOptionPane; public class PayrollSystemTest { public static void main( String[] args ) { String workerType; String first; String last; String ssn; int month; int day; int year; float salary; float rate; float hourlyWage=0; float hours; float wage; float sales; DecimalFormat twoDigits = new DecimalFormat( "0.00" ); // …

Member Avatar for javaAddict
0
130
Member Avatar for MxDev

hi guys, is there any stand alone GUI designer which could deal with most of Swing components and generate human readable code and also free

Member Avatar for sukatoa
0
125
Member Avatar for aabundle

Hello, I have a simple GUI but when i put another Jframe in an action listener it squishes the main page in with the new Jframe, i know this is probably basic but my text book yeilds no result, here is my code. Maybe i am going about the process …

Member Avatar for aabundle
0
216
Member Avatar for kira4

import java.io.*; import java.net.*; import java.awt.*; import java.awt.event.*; public class EmailSender { public static void main(String[] args) throws Exception { // Establish a TCP connection with the mail server. Socket soc = new Socket("gsmtp183.google.com", 25); // Create a BufferedReader to read a line at a time. InputStream is = soc.getInputStream(); …

Member Avatar for VernonDozier
0
140
Member Avatar for Kusno

Dear all, I'm newbie in Java/JSP. I have created project with Java Desktop for university lecture subject. But I still have one task, still with Java but in Web environment. I have this class. This class is used to get connection to MySQL. I create it for Java GUI [code=JSP]import …

Member Avatar for ~s.o.s~
0
141
Member Avatar for bpushia

I am trying to get the ST.java (Server Thread) to communicate with the CT.java (Client Thread), i am stuck at this point, i dont know rather it is something to do with the port # and host, or if it has anything to do with the Server thread, please reply …

0
79
Member Avatar for chweetnancy

Need help with this code. Anyone with knowledge on java please help. i found some on this forum, but that is also wrong. can anyone give me some help what is want is to smooth the values in an integer array. If its totally wrong please dont yell [code] import …

Member Avatar for jwenting
0
107
Member Avatar for aashanugraha

how can i calll a crystal report from a java swing program? can u pls send the answer with an exampl what are the jar files to be down loaded? and the xml files?? thanks in advance

Member Avatar for jwenting
0
49
Member Avatar for shouvik.d

Hi All, I am trying to develop an application which would use a combo box to obtain a set of records from a database table. Now on the count of number of records that are available in the table I need to populate a JPanel say Parent with another JPanel …

Member Avatar for javaAddict
0
144
Member Avatar for msnider9

Here is my code. It will compile but will not execute. The error is Exception in thread "main" java.lang.NullPointerException at Calculator2.<init>(Calculator2.java.33) at Calculator2.main(Calculator2.java.91) [code] import java.awt.*; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; class Calculator2 extends JFrame implements ActionListener { private JPanel panelAdder; private JLabel labela; private JLabel labelt; private JLabel …

Member Avatar for masijade
0
106
Member Avatar for guerreronoli

hello all, I created a program that connected to database!.... I've done to display all records from database in JTable..... but when I'm deleting a row it can't delete automatically it needs to close the program to update the JTable!.... here's my program!.... package classes; import javax.swing.*; import java.awt.*; import …

Member Avatar for Ezzaral
0
1K
Member Avatar for mousey182

I've tried searching the web and cant find anything to help me. I'm trying to create a 2D java maze application and have come up with the code below. It generates the maze and GUI no problem, and I've worked the code out to create a xPosition and a yPosition …

Member Avatar for chrisclairs
0
1K
Member Avatar for eleonora

Hello, I strongly need your assistance what is needed to modify in order the board to inherit the complete functionality of the game. The clienthandler class contains all the methods for playing the game on the terminal [please check the code] Thanks in advance for any help ! [CODE=java] import …

Member Avatar for jwenting
0
128
Member Avatar for Taker

[code] import javax.swing.JFrame; import java.awt.*; import java.awt.event.*; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.UIManager; public class GUINew extends JDialog implements ActionListener { public static void main (String [] args) { protected JButton ok; protected JButton cancel; protected ButtonGroup type; protected JTextField …

Member Avatar for blufab
0
116
Member Avatar for jimJohnson

I am in the middle of a program and have a quick question and not sure how i do this... "have the Frame display in the center of the monitor " [code=java] //import packages import java.awt.*; import java.awt.event.*; import java.awt.datatransfer.*; import java.text.DecimalFormat; import javax.swing.JOptionPane; //create a subclass at the fram …

Member Avatar for jimJohnson
0
143
Member Avatar for saintb

following masijade advice i tried busting my head abit. i have written the following code import java.awt.event.*; import java.awt.*; import javax.swing.*; import javax.swing.border.*; public class Game extends JApplet implements ActionListener { //Creating a new JPanel called panel1 JPanel panel1 = new JPanel(); //Creating a JLabel for panel1 JLabel header = …

Member Avatar for masijade
0
132
Member Avatar for Kusno

I'm able to set UIManager for UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel") and UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel") but for UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel") I get an error like this : java.lang.ClassNotFoundException: com.sun.java.swing.plaf.metal.MetalLookAndFeel What's wrong with my code ?? Thanks, Kusno.

Member Avatar for Kusno
0
246
Member Avatar for welbyobeng

Hey I am a newbie in java and I was wondering if someone can help me. Where would I place [QUOTE]int [] qDifference = new int [3]; for(int i = 0; i < 3; i++) { qDifference[i] = q[i + 1] - q[i]; }[/QUOTE] in the code below to show …

Member Avatar for welbyobeng
0
90
Member Avatar for eranga262154

Hi all, How it is possible to make curved vertex of a swing container like JDialog. Say I the property setUndecratoed() to true, so there is just a rectangular shape window I have. I want to curved a vertex there. Any suggestions really appreciate.

0
66
Member Avatar for jimJohnson

I was sick the day on our review for this programming assignment so I am in kind of a dillema with a jerk for a professor...What I am going to do is after each section show you guys what I have and I don't think I should have too many …

Member Avatar for jimJohnson
0
185
Member Avatar for anbuhikaru

So i'm a java student in 9th grade and my code gives me an error i have never encountered before... time is off the essence, so quick help is loved!: it says: Play.java:5: Play is not abstract and does not override abstract method keyReleased(java.awt.event.KeyEvent) public class Play extends JApplet implements …

Member Avatar for jasimp
0
160
Member Avatar for Techboy52

//Below i am trying to display a map onto my grid layout using the ImageViewer and I keep //getting a error cannot find symbol class ImageViewer. I really need to use this //ImageViewer because i need to use the x and y coordinate. I don't know any image //viewer display …

Member Avatar for darkagn
0
85
Member Avatar for Noliving

I basically have the entire program done except for one little problem my maxDepth output is wrong! But the rest of the assignment is after your program gets the correct answers, add static variables calls, depth, and maxDepth to your class and add code to your implementation of Z to …

Member Avatar for Noliving
0
86
Member Avatar for genji

hey guys I've been trying to connect this jsp site with MySQL database for a school assignment and I just can't seem to get it to work. It's getting really really frustrating because I have copied my friend's code(which does work on his pc) and for some odd reason it …

Member Avatar for jwenting
0
90
Member Avatar for ihtraa

[code] public void addRowsAntGrouping(){ Vector vectorAddRow = new Vector(); vectorAddRow.add(""); vectorAddRow.add(""); ((DefaultTableModel)jTableAntGrouping.getModel()).addRow(vectorAddRow); } [/code] Hi, I am in need of replacing the textfield of a table with combobox. the rows in the table are declared as vectors. there are two fields in the table. the first field is text and …

Member Avatar for masijade
0
92
Member Avatar for Kusno

Dear all, I have these code below (netbeans) : All cells in columns "saldo Awal" are set to 58000000000.00, but appear in cell is 5.8E9 What should I fix in my code ? Thanks, Kusno import javax.swing.DefaultCellEditor; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; import java.awt.Component; import java.text.NumberFormat; import javax.swing.JTable; import javax.swing.JOptionPane; import …

Member Avatar for Ezzaral
0
106
Member Avatar for Ryano24

I have to write an applet that asks the user to enter two floating-point numbers, obtains the two numbers from the user and draws their sum, product, difference and quotient. This is what I have so far. Can anyone make sure I am on the right track. import java.awt.Graphics; // …

Member Avatar for darkagn
0
109
Member Avatar for Noliving

Well this is a lab assignment, the problem I'm having is that the sample code he gave us is suppose to run as is, but it doesn't. I email him and he thought that most likely there might be a problem with the CLASSPATH for java or that I might …

Member Avatar for Noliving
0
186
Member Avatar for i_raghuveer

Problem Description: You are to write a golf game that allows the user to play one hole, a 280 metre par 5. For each swing, the player chooses a club and then the program generates the distance hit for each shot, updating the distance to the hole accordingly. Play proceeds …

Member Avatar for i_raghuveer
-1
131
Member Avatar for Taker

Devlope a Pedel boat class and a Rowing boat class and mark a boat as hired, storing the customer name and time, return a boat's details as a String, including customer name and time of hire if it currently hired out, calculate the amount due on a hired boat, given …

Member Avatar for Taker
-1
90
Member Avatar for piyush09

please help me in finding the proble in the following code import java.awt.*; import java.awt.image.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class button extends JButton { public button(String s) { setName(s); setVisible(true); } } class label extends JLabel { public label (String s) { setText(s); setVisible(true); } } class loginform …

Member Avatar for piyush09
0
228

The End.