3,978 Topics

Member Avatar for
Member Avatar for jbalaji87

i have a Jframe.in order to paint it i not using paintComponent but ordinary function containing g.drawstring("sd",0,0). when ever i click the mouse the string should appear at that point and it should move with the cursor until another click appears. my problem after clicking the string is not appearing …

Member Avatar for jbalaji87
0
103
Member Avatar for jems5

Not so new anymore more with Java but as it gets more advanced (for me that at least) the tricks evade me. I would like to output sorted values into my GUI but two things are not happening. 1. Cannot get values to print in GUI but prints on screen …

Member Avatar for jems5
0
465
Member Avatar for hannon565

Am having bit of writiers block about how to fix this error. Its a assignment for college so am really just looking for tip or pointer in right direction. Its a simple card game similar to poker. Card.java [CODE] package pokerpkg; public class Card { //Codes for the suits public …

Member Avatar for quuba
0
204
Member Avatar for subrat_p

[CODE]public class examination extends javax.swing.JFrame { public Connection con; public Statement stmt; public ResultSet rs; public String sname,sid,sub; /** Creates new form examination */ public examination() { welcome wl=new welcome(); String stname=wl.regdno.getSelectedText(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:exam"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("SELECT * FROM student where sno='"+stname+"'"); while(rs.next()) { sid=rs.getString(1); sname=rs.getString(2); } …

Member Avatar for javaAddict
0
324
Member Avatar for DARK_BYTE

HI I am working on a project to animate user-defined algos. I am still at the very beginning but I am practicing code in swing and here is an Array class that the user can use in his user defined algo: [CODE] import java.awt.*; import javax.swing.*; public class Array1 extends …

Member Avatar for DARK_BYTE
0
228
Member Avatar for fender422

I completed a homework given by my instructor, but it is not doing what it's suppose to do completely. I was able to add a message in the pixel, but if I run it, some wierd characters were added after the message here's my work. I was only assigned to …

Member Avatar for quuba
0
178
Member Avatar for haxtor21

Hello. I am running a program form my book and i get this warning from eclipse that says: "The serializable class ColorWindow does not declare a static final serialVersionUID field of type long" [CODE]import javax.swing.*; //Needed for Swing classes import java.awt.*; //Needed for COlor class import java.awt.event.*;//Needed for event listener …

Member Avatar for ~s.o.s~
0
422
Member Avatar for blknmld69

[B]Any ideas on how I would could this to add the selection in each box and put it in the total charges label? [/B] [CODE] import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; /** The Main class creates the GUI …

0
87
Member Avatar for pramodsajwan07

/* Calculator program*/import import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JCalculate extends JFrame implements ActionListener { JLabel lblnum1=new JLabel("Enter first number"); JTextField txtnum1=new JTextField(20); JLabel lblnum2=new JLabel("Enter second number"); JTextField txtnum2=new JTextField(20); JLabel lblresult=new JLabel("Result"); JTextField txtresult=new JTextField(20); JButton btnadd=new JButton("Add"); JButton btnsub=new JButton("Sub"); JButton btnmul=new JButton("Multiply"); JButton btndiv=new …

Member Avatar for apines
-1
220
Member Avatar for LianaN

Hi! My code worked correctly, but now it produces the error message. It seems that the command [ICODE]treeModel.reload();[/ICODE] doesn't work anymore. Please explain me what happens? [CODE] private void addOrgFolder() { String[] data = new String[2]; data[0] = text2.getText(); data[1] = text1.getText(); DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)SystClasses.TreeEditTest.tree1.getLastSelectedPathComponent(); tableModel.setQueryDontChangeTable("insert ..."); DefaultMutableTreeNode nNode …

Member Avatar for LianaN
0
336
Member Avatar for adanaz

Hi guys I'm trying to take a user input (name) and replicate the input in other methods. Can anybody help? Here is the code: [CODE]import javax.swing.JOptionPane; public class example { public static void main (String[]args) { entername(); } public static void entername() { String a=""; a = JOptionPane.showInputDialog("Welcome. Enter name …

Member Avatar for adanaz
0
964
Member Avatar for Buffalo101

Hey guys, I'm trying to code a testing app which will display questions on a JForm for a period of time. I need a way of keeping track of time so I know when the user's time is up. What should I use? So far, I've found these: [B]javax.swing.Timer[/B] [B]java.util.Timer …

Member Avatar for Buffalo101
0
1K
Member Avatar for blknmld69

I have started my code to create an application with two combo boxes. One that holds the names of the dormitories and the other holds the meal plans. The user should select a dormitory and a meal plan, and the application should show the total charges for the semester. I …

Member Avatar for jon.kiparsky
0
907
Member Avatar for hwalsh

Can anybody tell me why I'm not getting checkboxes? Sometimes I can get one, but never the three I need. [CODE]public class SwingLab implements ActionListener { // instance variables - this instance will get reader's name private Scanner reader;//name from user private Random random; private ArrayList<String> name;//construct a responder, declare …

Member Avatar for hwalsh
0
167
Member Avatar for winner126

I'm trying to implement a chatroom using RMI and everything was fine until I tried to bring my GUI into the picture, from what I can see the RMI aspect is fine, the client is sending the info to the server, the server sends it to all clients with callback. …

Member Avatar for Ezzaral
0
359
Member Avatar for spades0001

I'm back guys! This time I'm working on this project for class. I have to make a "point of sale" thingy. I worked on it using GuiGenie. My design has four buttons, and I want to design it in such a way that when I click one of the four …

Member Avatar for winner126
0
152
Member Avatar for StaticX

Hi, I am having a terrible time getting to grips with layout managers, and am hoping someone can shed some light onto my misery.My problem is this: I have created a simple GUI, that contains a button panel, a picture panel and a radio button panel.All these panels are put …

Member Avatar for hanvyj
0
147
Member Avatar for cocoll

hello! i need your help to know which checkbox cause the event: i have 2 checkboxes and 2 radiobutton (in swing),then i add the 2 checkboxes to a buttongroup and the 2 radiobutton to a buttongroup,so as default 1 checkbox and 1 radiobutton are selected,so when i check other radiobutton …

Member Avatar for Ezzaral
0
91
Member Avatar for muppet

I have a machine logging production info to a database whenever certain conditions change state, so pretty much randomly throughout the day. The plant runs 24/7 so data is continuously flowing into it with about 500 entries in a 24 hour cycle. The shifts are strictly time based and are …

Member Avatar for smantscheff
0
85
Member Avatar for LianaN

How could I synchronise the timer with some process that runs during X seconds. I need the timer to count seconds only if the process is running. If the process is terminated, then the timer must stop. [COLOR="Red"]Most important is that the process execution time is not known apriori.[/COLOR] Otherwise, …

Member Avatar for LianaN
0
220
Member Avatar for Dhanish

hi to all....i have a video club system where am using an sql server to store records about films....i successfully created the database, the table and input data data into the database using the SQL Command window in netbeans.....however when i use the JOption Pane to input data the VideoName …

0
63
Member Avatar for ceyesuma

Hello I am not sure what is getting serialized. I would like to serialize a JInternalFrame. So what do I send my SaveFrame.java. because it puts a file "null.dat" in the folder. I sent the frame got null.dat sent something I thought was the class of the frame (as shown …

Member Avatar for ceyesuma
0
146
Member Avatar for LianaN

Hi! I want to create a stopwatch that will counter seconds starting from 0. This code worked in case of a real time counter (using Calendar). However, now the counter is fixed on 0. Does anybody know what could cause an error? Thanks! [CODE] timer = new javax.swing.Timer(1000, new ActionListener() …

Member Avatar for apines
0
104
Member Avatar for Bonesawed

Hi All. Im in the process of writing a basic payroll program in Java. It is for some school work and I am really struggling with it. I have been working with it over the last 3 weeks and have not accomplished much. Below is what I have done so …

Member Avatar for apines
0
231
Member Avatar for StaticX

Hello, I have created a simple frame, and in it there are 3 panels.I have a button in the bottom panel, and when pressed should display the text "You pressed the button", in the mainPanel.However this is not working.Can anyone shed some light as to what I am doing wrong …

Member Avatar for kramerd
0
125
Member Avatar for jon.kiparsky

Most of the posts here are from people with problems, looking for help. I thought I would try to talk a bit about ways to find your way out of "stuck". It's been on my mind lately, since I've been wrestling with Swing and it's been winning. Finally worked out …

Member Avatar for apines
1
127
Member Avatar for camopaint0707

Write a program that asks the user to enter today's sales for five stores. The program should display a bar chart comparing each store's sales. Create each bear in the bar chart by displaying a row of asterisks. Each asterisk should represent $100 of sales. Here is an example of …

Member Avatar for kramerd
0
1K
Member Avatar for Buffalo101

Hello, I'm trying to change the look of java apps to something native. In my first JFrame, I'm using: [code=java] try { //org.fife.plaf.VisualStudio2005.VisualStudio2005LookAndFeel //de.javasoft.plaf.synthetica.SyntheticaStandardLookAndFeel //com.jgoodies.looks.plastic.Plastic3DLookAndFeel //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { …

Member Avatar for leiger
1
159
Member Avatar for enfamos

I have asked my instructor to help me with this error so I can move on to the next part of the program which is due Sunday, but no help to give I guess my problem is that when i try to compile my program I get a class, interface,enum …

Member Avatar for enfamos
0
168
Member Avatar for Java_90

Here is my code, I want it so you type something in to the textfield and then you press the button next to it which puts the text in the textArea. It compiles but when you click the JButton it errors out, I'm a beginner to Java anyone know what …

Member Avatar for Java_90
0
2K
Member Avatar for Sunshineserene

Hi all, I am trying to call a 2D array from another class, and equate the 2D array to a 2D array in the class its at. However, I'm having some problems. I can call the 2D array from the class that I want to, but it seems like my …

Member Avatar for Sunshineserene
0
2K
Member Avatar for fahadyousaf

i have made this little program in GUI, Please help in these following error. 1st time when we save the data second time it comes to 2nd field name not on cnic field, it should ask cnic field first then other ask for other fields. Please any one guide me …

Member Avatar for kramerd
0
239
Member Avatar for bibiki

I have the following code as taken from the book I read from: [CODE] import java.awt.*; import javax.swing.*; /** Frame1 is a frame with a label and a button */ public class Frame1 extends JFrame { /** Constructor Frame1 creates a frame with a label and button */ public Frame1() …

Member Avatar for kramerd
0
202
Member Avatar for NightOwls

As the title states, I can't get the background of my JFrame window to change. I would've bet that just .setBackground(Color.RED) would've worked but no luck. Here's my code: [CODE]import javax.swing.JFrame; import javax.swing.*; import java.awt.*; public class win { public static void main(String[] args) { JFrame guiWindow = new JFrame("Calculator"); …

Member Avatar for NightOwls
0
94
Member Avatar for ronny22

Hi all I made this animation app and I think its all correct however i get a error message which is: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.RangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at Animation.getScene(Animation.java:56) at Animation.getImage(Animation.java:49) at MainAnimation.draw(MainAnimation.java:64) at MainAnimation.movieLoop(MainAnimation.java:53) at MainAnimation.run(MainAnimation.java:34) at MainAnimation.main(MainAnimation.java:10) I cant …

Member Avatar for ronny22
0
169
Member Avatar for rayden150

[CODE] import javax.swing.*; import javax.swing.JFrame; public class Ejer1 { public static void main(String [] args){ JFrame frame = new JFrame (Box); frame.setVisible(true); frame.setSize(300,300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel(); JPanel panel = new JPanel(); frame.add(panel); frame.add(label); System.out.println("*********"); System.out.printf("%s\n%s\n%s\n%s\n%s\n", "* *","* *","* *", "* *", "* *","*", "* *","* *","* *","* …

Member Avatar for kramerd
0
229
Member Avatar for sciprog1

Hello Members, How do I change the code below sothat I can have the JLabel at the center of the JFrame and the two JButtons directly below the JLabel? Thank you! [CODE]import java.awt.*; import javax.swing.*; public class Layout { public static void main (String args[]) { JFrame m = new …

Member Avatar for sciprog1
0
188
Member Avatar for Sunshineserene

Hi all, I'm actually equating a 2D array from a class to another class. I call it using method call. However, it seems like the 2D array is empty after I equate it to another 2D array in another class. May I know where is the problem? [CODE]import java.io.*; import …

Member Avatar for apines
0
242
Member Avatar for neo_31591

hey guys... my database consists of questions...for a quiz....i need to read the question so that its displayed into the JLabel... [CODE=JAVA] //package Proj; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; class Testpage extends JFrame implements ActionListener { public static String usr; JMenuBar mbr; JMenu File,Help; JPanel p1,p2; JLabel …

Member Avatar for neo_31591
0
2K
Member Avatar for Zibo

Hello! Here's the problem: After making some GUI application (NetBeans) in output directory (containing generated .jar file) also appeared a directory 'lib' with additional .jar. This jar is some extra library with classes, which path is added in manifest ("Class-Path: lib/bla.jar"). So I've used to pack my applications always intto …

Member Avatar for Zibo
0
186
Member Avatar for 080346

i have written the following code, my 1st combo box getting the write data but when i have problem in the getting the data in 2nd combo box when i select from the 1st one....kindly help me....advance thnx for answering String obj =(String)jComboBox1.getSelectedItem(); res=stat.executeQuery("Select flight from main where Route="+obj); String …

Member Avatar for hanvyj
0
74
Member Avatar for lee.j.baxter

Hi, I'm creating a component for a process flow charting system, and have come to the point where I need to implement D&D between components. I have a panel containing expanding lists, where each list item represents a process definition. What I need to do is the following. Altogether, I'm …

Member Avatar for kramerd
0
228
Member Avatar for yup790

Hello I'm trying to make a random number generator to work out probability and chance, although it keeps coming up with an ArrayIndexOutOfBoundsException on line 41(roughly). I would be really greatful if you could help! thx p.s.This is not for school[code]/* * To change this template, choose Tools | Templates …

Member Avatar for leiger
0
178
Member Avatar for toferdagofer

Im trying to have the center circles follow the mouse if it enters the screen and go back to the original position if the mouse exits screen. Im not sure what to put into my mouse listener and would appeciate some help [CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; public class …

Member Avatar for BestJewSinceJC
0
120
Member Avatar for sciprog1

Hello Members, I have a simple Client/Server program which does the following: Server sends an array of Images one at a time to the Client. Client displays them one at a time. My Server: [CODE]import java.net.*; import java.io.*; import javax.swing.*; public class Server { public static void main(String[] args) throws …

Member Avatar for sciprog1
0
145
Member Avatar for Son of a gun

Can I ask for some advice / help please, I am writing a UI that upon the user making a selection from a drop down list it then populates details about the selection in text boxes. I am writing this as three classes the main class, the UI (User Interface …

Member Avatar for Son of a gun
0
111
Member Avatar for rational_

Design and implement an object-oriented program describing two kinds of BANK accounts, [B]FixedFee[/B] and [B]ChargeableFee[/B], that differ in the way that fees are charged: • FixedFee: There is a fixed £5.00 fee at the end of the each month • ChargeableFee: Each withdrawal costs £0.50. The total fee is calculated …

Member Avatar for apines
0
306
Member Avatar for minimi

[CODE] import javax.swing.JOptionPane; public class Test1 { public static void main (String[] args) { // Method 1 Test3 method1 = new Test3(); // is this the method to call Test3()? JOptionPane.showMessage (null, method1 // Method 2 JOptionPane.showMessageDialog (null, Test3()); // Method 3 JOptionPane.showMessageDialog (null, Test3.toString()); } } class Test2 { …

Member Avatar for apines
0
143
Member Avatar for intes77

[CODE]import javax.swing.*; class Month { public static void main(String[]args) { String value=JOptionPane.showInputDialog(null,"Enter Month Day and Year"); if(value.length()==10) { char Month=value.charAt(0)+value.charAt(1); char Day=value.charAt(3)+value.charAt(4); char Year=value.charAt(6)+value.charAt(7)+value.charAt(8)+value.charAt(9); JOptionPane.showMessageDialog(null," "+Month+"/"+Day+"/"+Year+""); } else { JOptionPane.showMessageDialog(null,"INVALID INPUT!!"); } } }[/CODE] Hello i need help about combing the charAt()'s for example i would input 05/05/2010 i want …

Member Avatar for intes77
0
443
Member Avatar for Roy1287

Hi. I'm new to this forum and to programming in general. This is my first programming class and it is in JAVA. I have been doing alright in the class, but am really struggling with this weeks program assignment. If you could help me out at all I would really …

Member Avatar for kramerd
0
831

The End.