3,978 Topics

Member Avatar for
Member Avatar for ThaiAmL

Hello! I'm writing a very simple program to get used to using GUIs, and I'm having a bit of trouble. We're supposed to be writing a program that just creates a window and after the user puts in a number, it calculates the square root and the square of the …

Member Avatar for ThaiAmL
0
218
Member Avatar for Ntropy

Basically, i've been told to initialise a grid into the "canvas" section of this program i've made, I need to make a fine grid that stretches across the whole canvas horizontally and vertically, 10 x 10 pixels apart example of the code i'm editing to do this below... [CODE] class …

Member Avatar for Ntropy
0
317
Member Avatar for javaprog200

Hello, The following program displays the text area for the entire JFrame even though I have set the dimensions of the text area to be 10 x 15. Any help will be greatly appreciated. Thank you! [CODE]import javax.swing.*; import java.awt.*; public class Scrollers extends JFrame { JTextArea area; JButton button; …

Member Avatar for javaprog200
0
183
Member Avatar for Hypnos_16

I have to make a program that outputs something similar to the appearance of a phone. With intractable buttons, (0 - 9) a T button that outputs "Calling" and an E button that outputs "End-Call" Now i have that much done [CODE]import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Dimension; import java.awt.Color; import …

Member Avatar for Hypnos_16
0
295
Member Avatar for wallet123

this is the code that i did: [CODE]import javax.swing.JOptionPane; public class MidtermExam { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int x; int y; int z; int count = Integer.parseInt(JOptionPane.showInputDialog(null,"Enter any Number:")); for(x=1;x<=count;x++){ for(y=x;y<=count;y++){ System.out.print(x+""); } System.out.println(); } } } [/CODE] …

Member Avatar for stultuske
0
189
Member Avatar for mahimahi42

Hi all, I'm working on a project for my CS class to go a little above and beyond the requirements. I have a simple GUI that takes in a username and password and checks a few things (needs uppercase and digit, etc), but I'm trying to have a JLabel that …

Member Avatar for stultuske
0
142
Member Avatar for long89

[CODE] class Circle { private double radius; private String colour; Circle() { } Circle(double r, String c) { this.radius=r; this.colour=c; } public void display() { System.out.println("Radius of circle is "+this.radius); System.out.println("Colour of circle is "+this.colour); } public String getColour() { return (this.colour); } } [/CODE] how calculate and display the …

Member Avatar for long89
0
154
Member Avatar for long89

how to write code include a try-catch statement to handle exception of this code. In the catch() statement, will provide a proper alert to the user on the error occurred. [CODE] import java.io.*; import javax.swing.JOptionPane; class TestArray { public static void main (String []args) { double a; double w; double …

Member Avatar for rushikesh jadha
0
429
Member Avatar for Queen Lala

import java.awt.*; import javax.swing.*; /*<applet code="SampleApplet1",200,300> */ public class SampleApplet1 extends JApplet { int num; public void init() { num=20; } public void paint(Graphics g) { g.drawString("Hello to Applets.Session"+num,70,80); g.showStatus(getAppletInfo); } public int getAppletInfo()//Overrides super class method { return("Created by PTSS"); } public static void main(String arg[]) { SampleApplet1 obj= …

Member Avatar for rushikesh jadha
0
166
Member Avatar for Gsterminator

Hey everybody! So my problem is the very last part, getting the results of my calculation. So what i've done is created a stack with my very own stack class. The = button is suppose to display the result but i get a runtime error. Please help me out. Oh …

Member Avatar for Gsterminator
0
2K
Member Avatar for kalcio

hi i have a problem with my interface,i want to I want when I hit the button, the progress bar goes off, so I have not found where is the problem in my code is that any one can help me and thank you. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JProgressBar; …

Member Avatar for kalcio
0
140
Member Avatar for toferdagofer

import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TheatreRevenue extends JFrame { /** * */ final double percent = .20; double adultCost; private JTextField label2; private JTextField label4; private JTextField label6; private JTextField label8; private JButton button1; private final int WINDOW_WIDTH = 400; private final int WINDOW_HEIGHT = 200; /** …

Member Avatar for DavidKroukamp
0
1K
Member Avatar for Vampiricx3

Hey guys, right now I'm trying to setup my GUI so that I can search for an Employee (which when clicked, disables all of the Text Fields, but not the ID, so I can search for the ID. But right now I have no idea on how to do this, …

Member Avatar for zeroliken
0
178
Member Avatar for beetlejuice

hi, Recently i was trying to look for a pixel searcher for java that was built in with the language but the only command that was somewhat related to specific color pixel searching was the getPixelColor in the robot library. The problem with this command was that it only returned …

Member Avatar for NormR1
0
184
Member Avatar for emidevil

Hi. im kinda new here . i just want some help with this code i cant seem to figure out my problem, i already declared a constructor but it keeps on saying cannot find symbol when i compile it -_- import javax.swing.JOptionPane; import java.io.*; public class Sample_Thread { public static …

Member Avatar for DavidKroukamp
0
574
Member Avatar for debasishdeb

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package progressbar; /** * * @author DEBASISH */ import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.event.ActionEvent; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class Progressbar { JProgressBar jprogressbar=new JProgressBar(); JButton jbutton=new JButton("Retrieve information"); …

Member Avatar for zeroliken
0
132
Member Avatar for rushikesh jadha

when i run my source code on winows xp then progress bar work fine but on linux it just stuck and not run at all, My Code is as follows [CODE]import java.sql.Connection; import java.sql.Statement; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.sql.DriverManager; import java.text.DateFormat; …

Member Avatar for JamesCherrill
0
350
Member Avatar for rushikesh jadha

In linux whenever i run my gui java programe it does not show Image My Code Is As Follows look at line 77. [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; class bank implements ActionListener { JFrame mainframe; JMenuBar mbar; JMenu file,view,help,edit; JMenuItem newacc,exit,login,helpcontent,cust_detail,emp_detail,delEmp,delCust,addEmp; public bank() { mainframe=new JFrame("Bank Application"); try …

Member Avatar for rushikesh jadha
0
228
Member Avatar for dineshswamy

dont know the why this modified JTextField did not show up..help me out [CODE] import java.awt.*; import javax.swing.*; public class JBgtextfield extends JTextArea{ public void paint(Graphics g) { setOpaque(false); ImageIcon ic=new ImageIcon("image1.png"); Image i=ic.getImage(); g.drawImage(i,0,0,this); super.paint(g); } } [/CODE] i then created an instance of this class and added it …

Member Avatar for JamesCherrill
0
166
Member Avatar for Thermalnuke

Hey I am having a problem with this java program im trying to accomplish.... I know how to count the characters or letters in a word, but how do you count every other word and display that letter in a row. Im trying to do an encryption program for example …

Member Avatar for Thermalnuke
0
138
Member Avatar for jackbauer24

[CODE=java]import javax.sound.midi.*; import javax.swing.*; import java.awt.event.*; public class BPlay implements ActionListener { public static void main(String[] args) { BPlay stereo = new BPlay(); stereo.play(); } public void play() { JFrame myfirstFrame = new JFrame(); JButton pl = new JButton("Click me to listen to something"); myfirstFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pl.addActionListener(this); myfirstFrame.getContentPane().add(pl); myfirstFrame.setSize(300, 300); myfirstFrame.setVisible(true); …

Member Avatar for jackbauer24
0
142
Member Avatar for scheppy

Ok, so I have my code for the timer [CODE] computer = new Timer (4000, this); computer.start (); [/CODE] The timer starts at the end of a method, and is supposed to start another method via actionlistener after 4 seconds, the problem is, after 4 seconds, the timer gives a …

Member Avatar for DavidKroukamp
0
192
Member Avatar for Hypnos_16

Hello All, I'm trying to create three independent animations that all occur in one main frame. I have to use the following methods in my code [CODE]--- Animate --- public interface Animate { void move( double x, double y); void changeConfiguration(); } --- Drawable ----- import java.awt.Graphics2D; public interface Drawable …

Member Avatar for NormR1
0
2K
Member Avatar for mehnihma

Can you help me with this problem I have a class and I need to create separate class justo fro reste button, but I am not sure how to do this? Here is what I have done [CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class MyEventC extends JFrame implements …

Member Avatar for peter_budo
0
1K
Member Avatar for Thermalnuke

Hey guys been working on a java Program. I am having a problem with my percent rounding up to 7% instead displaying 6.5% any ideas here is my Program. [CODE]import javax.swing.JOptionPane; import java.math.*; import java.text.NumberFormat; public class Week_three_number_eleven { public static void main(String[] args) { String Investment = JOptionPane.showInputDialog(null,"Please enter …

Member Avatar for stultuske
0
129
Member Avatar for kalz

Hello Everyone I have an Internal frame in my application which has a JTable populated with values from a database and a JButton which performs some operation when a row is selected from the JTable.When the user does not select a row from the JTable and clicks the JButton, I …

Member Avatar for kalz
0
459
Member Avatar for Vampiricx3

Hey guys, I'm currently creating an Employee style GUI program in Java, and I have a .txt file with several Employee details (int, string, string, string, int, double), right now I want to implement a way to display all objects within a JComboBox at the very bottom of my program. …

Member Avatar for Philippe.Lahaie
0
3K
Member Avatar for Vampiricx3

Hey guys, right now I have an Employee style java program that is basically for adding Employee data to a .txt file, I have all of that down pat, I have also got my program to automatically set the highest ID + 1, so I don't have to find the …

Member Avatar for Vampiricx3
0
161
Member Avatar for drico7041

Hey, I was having trouble making my vector print out randomly generated numbers in ascending order. Can I please get some help?. This is my assignment "Write a program name count.java that will use a Vector to store 10,000 randomly generated numbers (ranging from 1 to 99) Now sort the …

Member Avatar for drico7041
0
185
Member Avatar for Eragah

[B][I]Hi I wanted to ask a quick question. I have two classes. And within my main class i am able to pass in variable to three variables EyeColorR to EyeColorB and able to send them the my Eye Class under the consturctor class Eye. the catch is I need to …

Member Avatar for Eragah
0
215
Member Avatar for Vampiricx3

Hey guys, I'm trying to build an Employee system GUI, and right now i'm trying to create a JComboBox to display all of the Employees, but whenever I compile, I get the following errors.. [code]nathan@ubuntu:~/Desktop/Employee GUI [Java]$ javac RectangleProgram.java RectangleProgram.java:42: cannot find symbol symbol : constructor JComboBox(java.lang.String) location: class javax.swing.JComboBox …

Member Avatar for JamesCherrill
0
149
Member Avatar for vaironl

Hello forum, Vaironl here. I have a little problem, in a fairly big piece of code. I'm making a recipe application, which is working fine, but there is one minor error. If I minimize the screen and restore it, some of the components inside it are somehow re sizing of …

0
69
Member Avatar for riahc3

Hey Using MyEclipse 10 for Spring while developing Matisse/Swing GUI applications something very annoying happens: Whenever I change anything on the form in Design view the view always changes to Source view. (In between a progress bar with 'formatting' text appears.) How can I this behaviour switch off? Thanks

0
58
Member Avatar for emclondon

Hello guys, I am stuck again with a new problem. I need help with 3 things: 1. Timer 2. State Pattern 3. Disabling the button on JFrame lets go with the easiest one in the list, the Disabling of button one. I have an app with buttons, and I need …

Member Avatar for ~s.o.s~
0
638
Member Avatar for EulavValue

Hello, I am pretty new to programming and needed some help with one of my programs. I am trying to have the user input how many numbers they want to plug in then they plug in x amount of numbers until they reach whatever they input. After that I am …

Member Avatar for EulavValue
0
232
Member Avatar for umsungun

[CODE] import javax.swing.*; import java.util.*; import java.text.*; class myjavalo{ public static void main (String []args) { String orderStr1, orderStr2, orderStr3; int order1, order2, order3, choice; int i = 0; int menuCat,Entree, SideDish, Drink; System.out.println("\tItem" + "\t\t\tSales Count" + "\t\t\tTotal"); do{ Entree = Integer.parseInt (JOptionPane.showInputDialog (null, "Your Options Are:1 - Tofu …

Member Avatar for umsungun
0
217
Member Avatar for geneh23

Hey everyone, So I am making a sample website for now and will be uploading it when I can but I want a "lavalamp" style menu..however I can't seem to get the hover "slide/float" to work right..it shows the menu bar but wont show the hover effect..can anyone help me …

0
73
Member Avatar for nlyn

So I have an assignment due tomorrow and I've been trying to get this program to work, but it's quite difficult for me to do. I need help in taking the user's input and placing it on the grid and checking for all the matches to see if one of …

Member Avatar for nlyn
0
1K
Member Avatar for behemothdave

Here is my assignment: In Chapter 5, you created a lottery game application. Create a similar game using check boxes. For this game, generate six random numbers, each between 0 and 30 inclusive. Allow the user to choose six check boxes to play the game. [B][U](Do not allow the user …

Member Avatar for stultuske
0
1K
Member Avatar for Vampiricx3

Hey guys, I'm here to ask you a question. I have a constructor to get the highest ID (first int) from my Employee data file (int string string string int double), but I have no idea on how to actually display it within my JTextField, with a +1, so I …

Member Avatar for NormR1
0
126
Member Avatar for thes0mething

Hello everyone on daniweb!:) I'm trying to make a programme which will move a picture to the sides when pressing the right or left arrowkeys. I did successfully put a picture in and I was able to change the side coordinates(called "side" in the programme) to make the picture move. …

Member Avatar for Ezzaral
0
1K
Member Avatar for nlyn

I need help in my Connect Four program. Specifically in placing the user's input on the gameboard & also checking horizonallty, vertically, etc. [CODE]/* * ConnectFour program */ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Scanner; public class ConnectFour implements ActionListener { JFrame frame; JPanel contentPane; JButton displayMessage; public ConnectFour() …

Member Avatar for Philippe.Lahaie
0
91
Member Avatar for sfovell

Hello, I am programming for my Robotics team, and I have to write code for a dashboard, including different camera feeds and setting up rows or columns for the different elements. I am quite new to Java, but I gotten through most of it except for the rows. I can't …

0
132
Member Avatar for emmas4impact

Hello, I'm working on a Moving Ball project and on the moving ball there are random number so i need to use the keyboard or the mouse to click on the number printed on the moving but i dont know how to go about it. here is the code below: …

Member Avatar for emmas4impact
1
2K
Member Avatar for janfritz

hi. i'm trying to make a program that will connect two points that i click in my JPanel. i'm trying to connect the two points with a line. i displayed the values of my (x1, y1) and (x2,y2) coordinates whenever i click using the mouse and there is no error …

Member Avatar for hiddepolen
0
232
Member Avatar for lordsurya08

I'm using Swing's GeneralPath to create complex shapes and fill them. Usually I do this, and it creates a nice hexagon for me: [CODE] path.moveTo(100, 100); path.lineTo(150, 100); path.lineTo(180, 150); path.lineTo(150, 200); path.lineTo(100, 200); path.lineTo(70, 150); path.lineTo(100, 100); g2.draw(path);[/CODE] Suppose I wanted to create a donut-shaped GeneralPath, and do this: …

Member Avatar for JamesCherrill
0
359
Member Avatar for jackmaverick1

I've made a little game (not really, just a bit of a start), but the collision detection is a little screwy. It works within 2 pixels for the bottom three sides. However, on the top, there is a buffer of about 20 pixels that it counts as part of the …

0
78
Member Avatar for person192

Hi daniwebbers, I am a newbie learning java and keep getting a "cannot find symbol" error when I try to compile my program. I've tried searching but I don't really know what search terms I should be using in this case. Can anyone see the problem? [CODE]import javax.swing.*; import java.awt.event.*; …

Member Avatar for peter_budo
0
218
Member Avatar for jade_91

well basically i have this code working to display distance to nearest station and the station name but i want it to show what line the station nearest is located on i've tried to figure it out but just dont seem to be getting anywhere with it the code (including …

Member Avatar for DavidKroukamp
0
103
Member Avatar for jade_91

Hi, basically ive been trying to write code to work out where the nearest station for a person is based on their current location. I did have it working to display nearest station name and distance from that station but something went wrong I must have accidently deleted something or …

Member Avatar for DavidKroukamp
0
142

The End.