3,978 Topics

Member Avatar for
Member Avatar for dsmush

Hi, I'm creating a Java Swing application that lets the user enter the usual details one would expect in an address book then click the save button. The current JPanel will then be hidden while another JPanel is shown. This second panel is used for viewing all the contacts added …

Member Avatar for BestJewSinceJC
0
2K
Member Avatar for sabah_786

Hey all. Ok i've written the code below with no syntax errors. However, im struggling. 1) For Button 1 - Check Balance, I want to firstly bar out the pin number so it doesn't show. How do I do this? 2) For button 1 - I have added show input …

Member Avatar for sabah_786
0
278
Member Avatar for aym312

hello! I have run into a brick wall trying to write a traffic light program. The program must display a traffic light (so far I have tried painting it on a Graphics) and use radio buttons (red, yellow, green) to change the color of the light. So far, I've got …

Member Avatar for aym312
0
1K
Member Avatar for chloeclover

Hey all, i'm looking for some help/advise on how to tackel a piece of code i'm stumped on. My project is in netbeans, GUI swing, JForm. Ive made up all my gui appearance, i have a jtext box that shows the calculations of 3 other jtext boxes from a user's …

Member Avatar for peter_budo
0
263
Member Avatar for rogue005

I am using a PriorityBlockingQueue in my server program for a network printer manager, but the thing is whenever I print the size of the queue its always 1. I think it is cause i am using threads in my program to support multiple clients. How do i solve this …

Member Avatar for rogue005
0
143
Member Avatar for SCoder1

what's wrong with my java code? NullPointerException was found by my compiler.... [code] import java.awt.event.*; import java.awt.*; import javax.swing.*; import javax.swing.event.*; class WheelCalc extends JFrame implements ActionListener { public static final int WIDTH = 400; public static final int HEIGHT = 400; public JLabel NewTire; public JLabel OldTire; public JTextField …

Member Avatar for stultuske
0
152
Member Avatar for BEBELINDO

[code]import java.applet.*; import javax.swing.*; import java.io.*; import java.net.*; public class Audioapp extends JApplet { public class Sound // Holds one audio file { private AudioClip song; // Sound player private URL songPath; // Sound path Sound(String filename) { try { songPath = new URL(getCodeBase(),filename); // Get the Sound URL song …

0
53
Member Avatar for jfAdik

Hello Coders out there... I posted my code for a binary search tree assignment and the code is a working code... :::::DETAILS TO KNOW ABOUT THE CODE:::::: the program is required to 1. ask user the HEIGHT OF THE TREE which will determine the length of the array.. 2.and then …

0
47
Member Avatar for BobbieJean

Hi, I'm having trouble with...I don't know, either choosing the correct loop to use or maybe using the one I need but having it incorrectly placed. Right now, the program will give the "Invalid item number" message from my else statement if I enter an invalid value in the first …

Member Avatar for BobbieJean
0
99
Member Avatar for BobbieJean

Hi, I've been working on this program for nearly two days straight and I just can't get it quite right. So it's supposed to get input from the user and apply it to a switch statement. There are 5 cases that represent the cost per item for each case. Then …

Member Avatar for BobbieJean
0
102
Member Avatar for sirtrucker

I have my calculator GUI to display as I want it too. When I put in my mortgage amount and choose an option from the drop down box and hit calculate everything works as it should but when I try to manually put in the terms and interest rate and …

Member Avatar for jwenting
0
204
Member Avatar for kelvinyap828

basicallt i want to make a simple quiz...and the quiz contained 20 questions...but i have no idea in looping the question...so can anyone help me? [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Random; class Quiz extends JFrame implements ActionListener{ private JButton submit,next; private JTextArea text; private JTextField answer; private JLabel …

Member Avatar for stultuske
0
128
Member Avatar for praneshss

Hi all, I'm basic programmer of Java..I tried to use JFormattedTextField for the first time.. It's giving error in importing sentence only.. I hav written import javax.swing.JFormattedTextField; It shows error "Cannot resolve symbol class FormattedTextField" I don't know what the problem is..Everything seems right..Please help me..

Member Avatar for praneshss
0
56
Member Avatar for bokz06

i think i have converted my application to an applet..... it use to read lines from a .txt file i have on my hard drive but now i want it to read a .txt file from a URL: [CODE]import java.awt.*; import java.awt.event.*; import javax.swing.JButton.*; import javax.swing.event.ListSelectionEvent; import java.net.*; import java.io.*; …

Member Avatar for HoRn
0
171
Member Avatar for senormateo2011

Hi everyone. I am new to this website and I could use some major help. Basically, I am taking AP Computer Science and my teacher has no idea what he is doing. The school thinks that since he can do web design and adobe teaching, he can do java programming. …

Member Avatar for senormateo2011
0
739
Member Avatar for uptheirons1

Okay, I have read through all of the average grade java swing threads I could find on this site, but I can't seem to fix this problem. Everything seems to work correctly, but the average grade won't display in the JTextPane. I am going to get rid of the extra …

Member Avatar for uptheirons1
0
534
Member Avatar for Riddlekid

I got a project, it want us create a application that can keep track of your collection of DVD and allows a user add a new DVD to the collection. The DVD information contain Title, Category, Year and Rating. In this application must use list (ArrayList or Vector or LinkedList) …

Member Avatar for javaAddict
0
90
Member Avatar for justinlee23

my program seems to run fine the first time i run it, but when the JOptionPane box shows up at the end asking if id like to run it again it seems to restart my balance to the initial amount rather than keep it and continue subtracting or adding [CODE] …

Member Avatar for javaAddict
0
130
Member Avatar for jdrake345

Hello, i need assistance with a mortgage calculator program. the requirements are : Program designed with GUI to Write the program in Java (with a graphical user interface) and have it calculate then display the mortgage payment amount from user input of the amount of the mortgage and the user's …

Member Avatar for jwenting
0
385
Member Avatar for k2k

it is strange that my code was working before I modified some variable name/ type. i didn't make any major changes except for changing from double to int, and from double to String. the change was involved a bit sql code change as well though. i got (does anyone have …

Member Avatar for k2k
0
153
Member Avatar for dirnthelord

I'm trying to display a report in my src/iReport/report1.jasper directory. but every time i try to display it i get java.lang.NullPointerException. I can't find where the problem is. Please someone just take a look and help me. I have imported all necessary libraries. im using Netbeans. [CODE] package Windows; import …

Member Avatar for dirnthelord
0
678
Member Avatar for Bobon

Ok guys, firstly i'm sorry for the long code. Don't worry, it is only a small problem related to a small part of the code in the main class. I've highlighted the .area I have a problem here. The first piece of code is my main class. I call a …

Member Avatar for Bobon
0
3K
Member Avatar for Ecliptical210

Hey guys, I'm creating a Maze class along with a client class where it allows the user to input a direction (U/L/R/D), and then the validity of the move will be returned as well as the new position of the maze. So far, I've got this, but when I try …

Member Avatar for rue64ja
0
240
Member Avatar for jeffery12109

please help... here's the code [CODE]import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JPasswordField; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JOptionPane; import javax.swing.JButton; import javax.swing.Icon; import javax.swing.ImageIcon; public class Button extends JFrame{ private JButton reg; private JButton custom; public Button(){ super("BUTTON"); setLayout(new FlowLayout()); reg = new JButton("reg BUTTON"); add(reg); Icon …

Member Avatar for jeffery12109
0
305
Member Avatar for kbhargav

the code works but i do not understand the use of editable option whic provides the codes [code]import java.awt.*; import java.awt.event.*; import java.util.*; import java.net.*; import java.io.*; import javax.swing.*; import javax.swing.event.*; public class WebBrowser { public static void main(String [] args) { JFrame frame = new EditorPaneFrame(); frame.show(); } } …

0
33
Member Avatar for JellyTurf

[CODE]import java.applet.*; import java.awt.*; import javax.swing.*; public class draw extends Applet { public void delay() { try { Thread.sleep(1); // do nothing for 1000 miliseconds (1 second) } catch(InterruptedException e) { e.printStackTrace(); } } public void paint(Graphics g) { //Timer delay = new Timer() for(int i = 0; i < …

0
85
Member Avatar for red_lynx

Hi all, i am not an experienced Java GUI programmer and its the first time i'm asking for help in programming on a forum. I have this simple GUI which allows people to mark text with different categories. I use JTextPane and DefaultStyledDocument. Basically, i took most of the code …

Member Avatar for red_lynx
0
163
Member Avatar for Accendo

This program I thought was working fine. It reads something I type in then it's supposed to break up the words (or random letters) separated by a " " and pop them into array [B]arr[/B]. It works, well sometimes... I don't know what's stopping it and them other times allowing …

Member Avatar for Accendo
0
170
Member Avatar for sandyben

[CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.sql.*; class transfer extends JFrame implements ActionListener { JButton btntrans,btndel,btnexit,btnclear,btnone; ImageIcon bc; JLabel lbltitle ,label1; JTextField text1; JScrollPane scrollPane ; Thread t; DefaultListModel listModel; public transfer() { setSize(550,400); setTitle(" FILE TRANSFER "); Container cp=getContentPane(); lbltitle= new JLabel(bc); label1 = new JLabel(); …

0
68
Member Avatar for ubi_ct83

Hi all, FYI im really new in Java.last time my project was in C but suddenly my supervisor changed to Java.i got the code from him (see below).wanna ask u guys how to learn Java and these means? Lastly, how to create dropdown menu? [CODE] import java.awt.Color; import java.awt.Container; import …

Member Avatar for tiny7415
0
119
Member Avatar for albert101

Hi everyone, I am new to Java and more recently Swing. I was wondering if anyone would be able to show me a way of inputting a value into a text box, and being able to use this to calculate a sum for example. Also I am interested to know …

Member Avatar for albert101
0
91
Member Avatar for mytime19

Hello Everyone, I am trying to extract integer values from 2 int variables i have created in my database table "mytab". The data or table values i have extracted on console and its working fine. But i want to use the values as x,y coordinate for my label i have …

Member Avatar for mytime19
0
813
Member Avatar for Aissi

Hey, I'm having problems with JTextPane, I have class which has gui and other class for the software logic (in this case text editor), so when I try to save a file using filechooser it works fine to the point where it needs to save the information from the JTextPane, …

Member Avatar for javaAddict
0
73
Member Avatar for ndeniche

Hello guys... I'm trying to develop an application with a GUI that sends and receives data via http, by sending a url via POST and eading the content generated by the url. or instance, if i send a nick and order number, the server generates a SessionID via html. My …

Member Avatar for ndeniche
0
210
Member Avatar for mytime19

I am trying to draw stars/asterisks but i can't. Any idea? [CODE] import java.io.*; import java.awt.*; import javax.swing.JPanel; import javax.swing.*; public class kmd1234 extends JFrame{ kmd1234(){ JFrame f; JPanel p; JLabel l; int x,y; f = new JFrame("my frame"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); p = new JPanel(); p.setPreferredSize(new Dimension(512, 512)); p.setBackground(Color.WHITE); l = …

Member Avatar for mytime19
0
94
Member Avatar for StephNicolaou

Hi all, I thought it would be quicker to design using NetBeans, but now I'm finding that it's more trouble to work with NetBeans automatically generated garbage 'code'. Anyhow, I've tried to remove its automatically generated code for the frame's scrollbar but that just totally messes up the layout of …

Member Avatar for StephNicolaou
0
110
Member Avatar for simplyflawless

hey guys, i have to do this program and i'm having trouble with prompting 2 things outside the loop. Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from …

Member Avatar for javaAddict
0
197
Member Avatar for Jongor

Hello fellow seniors, i can display all the data from array after i input all the data, but do not know how to display it on displayDonor() Any help is highly appreciate. [CODE]import javax.swing.JOptionPane; public class DonorMenu{ public static void main(String args[]) { int choice = -1; do{ choice = …

Member Avatar for Jongor
0
112
Member Avatar for omar isaid

the following code I want to press done buttone to close JFrame without exit the application ---------------------------------------------------------------------------------- [CODE] package examples.SecretaryAgent; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Display extends JFrame { private JCheckBox _first_Interval; private JCheckBox _second_Interval; private JButton _done_Button; public Display() { setLayout(new FlowLayout()); _first_Interval=new JCheckBox("First Interval"); _second_Interval=new …

Member Avatar for omar isaid
0
880
Member Avatar for sneaky667

USING JAVA SWING I HAVE A JFRAME WITH TEXT FIELD WHICH I PASS THE USERNAME AS SOON AS I LOGIN. THE ISSUE I HAVE IS WHEN I NAVIGATE TO ANOTHER FRAME AND COME BACK AT A LATER TIME THE FIELD LOSES ITS VALUES I USED THE hide() and SETVISIBILE(TRUE) methods. …

Member Avatar for stultuske
0
38
Member Avatar for gabz16

Please help me add actionlistener ect. to my puzzle program so that i can move the tiles into ascending order..Here is my code.. [code]import javax.swing.*; import java.awt.*; import java.util.Random; public class Rand { private JButton btn[]=new JButton[16]; public static void main(String args[]) { Rand app=new Rand(); } public Rand(){ JFrame …

Member Avatar for gabz16
0
235
Member Avatar for adity

Hi, I wanted to change the color of the first two rows of a Jtable .How do i achieve that? I have written the follow: [CODE] TableCellRenderer render1 = null; render1 = new myCellRenderer(); [/CODE] And the renderer is written as : [CODE] class myCellRenderer extends DefaultTableCellRenderer implements TableCellRenderer { …

Member Avatar for balmark
0
93
Member Avatar for music_est_vie

Hello. I am a extreme n00b at programming in Java and was wonder if I could get some advice on how to execute some of basic commands. I am working on a group project in school (Computer Science 30) and my group is creating our own extreme basic version of …

0
65
Member Avatar for jxmst32

I am currently writing a program in Netbeans which will perform binary to decimal, decimal to binary, hexadecimal to decimal, decimal to hexadecimal conversions, 1's compliment, 2's compliment, and show the list of boolean algebra rules. I have created the GUI however, I cannot figure out how to make the …

Member Avatar for phoenix911
0
366
Member Avatar for wondering_ed

[CODE]import javax.swing.*; import java.sql.*; public class BankAccountDatabase{ public static void main(String[]args){ Connection conn=null; Statement stmt=null; ResultSet rs=null,rs1=null; String url="jdbc:mysql://localhost/bankaccount"; String username="roo"; String password=""; String query="",query1=""; String accname,accnum,accpin; int PIN,key,menu,AccountNumber; String a,b,c,d,f,g,h,i,j,x,y,z; double dep,withdraw; double balance=0.0; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(java.lang.ClassNotFoundException e){ System.err.print("ClassNotFoundException: "); System.err.println(e.getMessage()); } do{ a=JOptionPane.showInputDialog("MENU\n\n\n1 - Create Account\n2 - Delete …

Member Avatar for BestJewSinceJC
0
159
Member Avatar for firebugg

Hi, I am working on an assignment that does the following... When the program starts, it should look to see whether a file is present that contains a serialized array of vehicles. If so, it redisplays them. Otherwise, it generates random vehicles, writes them to a file, and displays them. …

Member Avatar for javaAddict
0
140
Member Avatar for simplyflawless

hey guys, i have to do this program and i'm having trouble with this certain part: Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8%, …

Member Avatar for phoenix911
0
164
Member Avatar for may781

Hey:) I am creating a project in java,but have been sick for the passed 3 weeks, so I am a bit stuck on how some of the code should look,and where it should be the details are that I am required to develope an application that will allow the user …

Member Avatar for jwenting
0
108
Member Avatar for musikluver4

[code] //Date: 3/16/2010 import javax.swing.*; class PizzaChoice { public static void main(String[] args) throws Exception { char[] whatSize = { 'S', 'M', 'L', 'X'}; char size; double[] sizePrice = {6.99, 8.99, 12.50, 15.00}; int s; System.out.println("What size do you want?"); size = Character.toUpperCase((char)System.in.read()); for (s = 0; s < whatSize.length; …

Member Avatar for musikluver4
0
959
Member Avatar for BERRYH

Write a program that draws a clock face with a time that the user enters in two text fields (one for the hours, one for the minutes). import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Point2D; import java.awt.geom.Ellipse2D; import …

Member Avatar for BERRYH
0
93

The End.