3,978 Topics
![]() | |
[ICODE]public class fermi { private int[] guess; private int[] random; private int total; 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]; total=0; } public int totalPlay() { return total+=1; } } [/ICODE] [ICODE]import javax.swing.JOptionPane; import java.util.Random; public class playFermi { public static … | |
Hello Experts, I need to use JOptionPane a lot in my Java exercises. Instead clustering each Java files with this JOptionPane syntax plus the parameters, I've decided to use sort of class called showFrame which has the method to show message dialog and input dialog. At the moment, im putting … | |
Greetings from Greece. We got a Hangman assignment for my Class at Java. I m just a begginer.And the whole input/output thing is done either by console (system.out.println) or with JOptionPane. So here is my code [code] import javax.swing.JOptionPane; import java.util.*; public class Hangman { public static void main (String … | |
i am working with a piglatin translator that has a GUI but i am stuck on how to make it translate when i you push the translate button here is my GUI what is in red is were the error occurs if someone could help i would appreciate it thanks … | |
hi, Iam trying to add names and numbers to a database then save them by updating them. i run my program, but when i press any button nothing happens????? pls help me, i do not know where is the problem in my program???? [CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; import … | |
hi, I have an application that plays video files using jmf It plays some videos but without audio but while playing some videos the application automaticaly terminates and generates runtime error. A log file is created by name hs_err_pid2232.log which have following message: # # An unexpected error has been … | |
OK. So this program is supposed to prompt the user whether they want to play the guessing game. If they say no then end the program otherwise it will start the game and ask them for their first name, last name and the number of guesses they want. Then it … | |
[code] import javax.swing.*; import java.awt.*; import java.util.*; import java.awt.event.*; import java.io.*; public class PartOfSpeech extends JFrame implements ActionListener { private JButton btn1,btn2; private JTextArea txtAreaArticle; private JTextField txtField1,txtField2,txtField3; private JMenuBar jmb; private JMenu fileMenu; private JMenuItem out; public PartOfSpeech() { setTitle("PART OF SPEECH SYSTEM"); Container con=getContentPane(); con.setLayout(new BorderLayout()); jmb=new JMenuBar(); … | |
hello friends...started to learn python and have covered the basic stuff and some silly gui stuff...i currently have some time so i thought why not prepare a app in python with some killer gui..now java has swing which can be modified to make such GUI...so is there anything which can … | |
Hey Everyone! My name is Ed and I am new to programming and your community. Thanks for the warm welcome and I hope you can follow me with my coding problems. My code is for a project that simulates a simple vending machine. When the program is run three buttons … | |
Hey all, for quite some time I've been working on an inventory management program for work, and I'm having a bit of an issue with the rendering of a JFrame notification window, I'll do my best to explain below (including screenshots). So my program works with a remote FTP server … | |
Hey all, I'm having problems with a project I'm doing, I've started rewriting a project I'm doing as I ended up using too many arrays instead of classes >.< And running into some silly problems: Everytime I run the program I get this error on compilation [COLOR="red"]java.lang.NoSuchMethodError: main Exception in … | |
I am trying to update a jlabel, but the label is not updating. Thanks for any help. Daniel [CODE]package converter; import java.io.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import java.util.Iterator; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.filechooser.FileFilter; public class modelConverter extends JFrame implements ActionListener, ItemListener { // Data panel … | |
I am currently working in one swing application. I need to display html contents in some window. In swing we are having [B]HTMLEditorPane [/B]that can display HTML contents on window (not in browser). Now this HTML contents is not well structured. like starting and ending with html tag inside it … | |
Although I'm a novice in Java I am to make a pool simulator in java with the ability to handle any arbitrary number of balls (i have created a Ball object, balls will be stored in the Ball array called balls). All the parameters are to be read in from … | |
my program doesn't display the shapes after the button is clicked .. can someone help me with this .. import java.awt.*; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class DrawShapes extends JFrame { public DrawShapes() { JPanel panel = new JPanel(); final JButton circle = new JButton("Circle"); JButton square = … | |
Hi I am trying to implement the Fast Fourier Transform. I have some code which I got online and slightly modified. I have a class GrabPixels which extracts a pixel array from an image, the class FFT implements the transform. My problem is I don't think the methods in the … | |
Hello, Can anyone please help me... I need to create a GUI program that holds product inventory. I have five errors and I can't figure out what they are... I need a second look from someone... Thanks in advance! [code] import javax.swing.*; import java.awt.*; import java.text.NumberFormat; import java.util.Locale; public class … | |
Hey everyone, let me get straight to the point: For my program I developed two custom classes that extend jPanel and have some text fields and check boxes in them. (public class ServicePanel extends java.awt.Panel) Now I've encountered three problems. 1. When add those panels to the GUI Palette and … | |
Okay I am writing a program that, in the end, will bring up a GUI window and ask the user what type of shape they want to make. The choices are line, circle, ellipse, rectangle, and polygon. When the user selects a shape they are then asked some key information … | |
I am in the process of designing a game implementation in Java, and without much experience with GUIs past swing applications, I am not quite sure where to start with this. The game I will be implementing can be seen and played here: [url]http://www.pentago-online.com/[/url] In other words, it is board … | |
Hi, Im trying to make a media player in Eclipse. Its just a simple thing not an advanced one but i cant get it to work. I have looked at some examples and tried to create a simular version. I could really use some hints on how to make it … | |
I have a program that is supposed to draw circles every twentieth of a second every time a button is clicked. When the button is pressed, a function is called and a for-loop is executed 25 times. Within that for-loop, [ICODE]repaint ()[/ICODE] should be called. Within the [ICODE]paintComponent[/ICODE] function, random … | |
I am trying to write an applet that receives 2 inputs from a user then opens a window and displays the 2 numbers that were input, along with a message of either "the numbers are equal", or "this number is the largest". My problem--my program never returns "the numbers are … | |
Hey all wonder if you can spot my mistake or point me in the correct direction. I'm new to Java applets after spending quite some time learning/using standard applications. This simple program is basically converting a standard application into an applet, but for the life of me i can't see … | |
import javax.swing.*; import BreezySwing.*; public class PaymentDDJ extends GBFrame { //Declare variables for the window objects.// private JLabel purchasedprice; private JLabel name1; private JLabel downpayment; private JLabel interestrate; private JTextField nameField; private JTextField purchasedpriceField; private JTextField downpaymentField; private JTextField interestrateField; private JButton enter; private JTextArea balance; //Define the other instance … | |
Hello, this is related to [URL="http://www.daniweb.com/forums/thread177461.html"]the last thread I posted[/URL], but it is also different. I found something about ImageObserver with a google search and can't find much on it, I tried doing what the site on google did, but it didn't work with the simple test I wrote. here's … | |
hey how to make an object move in an C graphics program, eg; i have drawn a swing and i want it to move... i am beginner in C graphics program so please help me...:( | |
Hello, I am trying to write a simple program that takes input from the fields I have created for the following UI and writes them to a command prompt. Can someone help me with the next step.... getting the input entered and writing it to the prompt? I would also … | |
Ok, here is the problem. I have to ask a group of people for donations and get the total average and so on. The only problem I have is trying to get the lowest donation from the inputted numbers. I can't seem to get the actual lowest number. It just … | |
Hi, Everything else in this code works properly but the keyTyped method is not working properly. I have been working on this for sometime. Any help would be appreciated. Also, any advice on getting my southPanel to appear when I start the application? It appears but only after I expand … | |
Hello, this is my first post here and I noticed that other people have been struggling with this assignment too. It is the mortgage calculator program for UOP PRG420. So I am sure you all are probably about sick of this by now, but I need help. The book is … | |
[code] package Sorting; import javax.swing.JOptionPane; public class Sorting2 { public static int s[] = new int[100]; public static void main(String[] args) { String ask = ""; for (int i = 0; i< 5;i++){ ask = JOptionPane.showInputDialog("Enter: "); s[i] = Integer.parseInt(ask); System.out.println(s[i]); } for (int x = s.length-1; x>= 0; x--) … | |
Hi, How to add image to Jwindow. Here is my code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; import java.io.*; class Project4 extends JWindow { Container container; JTextField jt; JButton jb; public Project4(String st, final Image image) { container = getContentPane(); container.setLayout(new BorderLayout()); //JTextArea jtp = new JTextArea(st,10,10); //container.add(sp); … | |
![]() | hello. i have a problem running my very first applet (im just converting my previous application to applet). i tried to follow the instructions i found in the manuals, both the one given by my prof and the ones i found in the web, but unfortunately my program wont work. … ![]() |
Dear Members I am having a problem in Java and I am pasting the code and the error message please tell me where is the problem and aslo tell me any directory that can guide me about frequent error messages and their solutions. here is the code. import javax.swing.*; import … | |
Hello, I was hoping that someone might be able to help me with this program: [code] import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.FileNotFoundException; public class CustomerInfo extends JFrame implements ActionListener { //construct components JTextPane textPane = new JTextPane(); //initialize data in … | |
im creating an IDE for jswing what i need is the user must drag and drop swing controls ex: (TextField, JList ...) into a tab in tabbed pane dynamically hw to do this.... | |
hi, iam trying to create phone directory as a seperate Jframe. there is a button in the main JFrame that leads to the seperate Jframe. the seperate Jframe contains JList which includes names and numbers. when click on any name from the list, this name with the number should appear … | |
Hi People, I am trying to run this file but I am having trouble getting the program to incorporate the gif file that I need. Here's the program. // Demonstrating JDesktopPane import javax.swing.*; import java.awt.event.*; import java.awt.*; public class DesktopTest extends JFrame { public DesktopTest() { super("Using a JDesktopPane"); JMenuBar … | |
[ICODE] import javax.swing.*; public class Tokenize{ public static String s[] = new String[100]; public static void main (String args[]){ String ask = JOptionPane.showInputDialog("Enter:"); isAsk(ask); } public static void isAsk(String ask){ StringTokenizer st = new StringTokenizer(ask," ",false); int input = Integer.parseInt(st.nextToken()); if(input<=10&&input>=0){ System.out.println(input); } } } [/ICODE] Here is the sample: … | |
ah im in 1st year IT student, my project is about to make a Notepad and it should have an event to perform. example: is when i go to [B]"file"[/B] then click the [B]"save"[/B] and it will perform.. pls give some example of class that use an event.. Im new … | |
In the following codes, I only specified the user to input only 4 numbers in the textfield. I want to output the numbers inputted by the user but I don't know how to do it seeing that the "text" and "value" is different in a formattedtextfield. All I see in … | |
![]() | I have two problems with the focus on buttons in this project. I've pared the code down to barebones to show the problems; there are only 2 simple classes remaining & still the problems persist. It compiles, runs (java ColorView), and all that's required to see the problems is simply … ![]() |
[CODE]import javax.swing.JOptionPane; import java.util.Random; public class guess2 { public static void main(String[]args) { int num; int guess; int diff; String input; int Diff; Random randomNumbers=new Random(); guess=randomNumbers.nextInt(100); diff= num - guess; Diff=Math.abs(diff); input=JOptionPane.showInputDialog("Enter your guess."); num=Integer.parseInt(input); for(int i=0; i<5;i++) { while(num<0 || num>100) { input=JOptionPane.showInputDialog("Invalid number!Please re-enter: "); num=Integer.parseInt(input); if(Diff==0) … | |
Is it safe to assume that any object that is preceded with the letter 'J' is a member of the Swing package? Just trying to get lightweight versus heavyweight components sorted properly. Thanks. -- Curtis | |
Hi! I'm a newbie in drawing graphics with Java and have another problem with my traffic Jam simulation: At the end of the simulation the program should draw the finalA array as a series of filled/unfilled squares. All I get is a white window coming up:@ I will post all … | |
I've somehow lost the concept of the easiest part of this assignment... OK, We have a program which draws random rectangles based on mousePressed and mouseReleased coordinates. I am adding a Circle class which draws circles as well. I have the class written, the draw method written but now when … | |
I need to design tabs shown in the attached document. I designed some but need your help with the rest. Could you create them using 'Pools Tab' code as a blueprint so the programming outline in all the tabs look similar if at all possible? Password for the document is … | |
Hello I'm working on simple text editor based on jTextPane i have no problem setting text color, size, font etc. but i have no idea how to get attributes from selected paragraph. i'v tried doing it by [CODE]myPane.getCharacterAttributes().getAttribute(key));[/CODE] but what shoud be the key? any help would be appreciated |
The End.