3,978 Topics
![]() | |
So I'm writing an event-driven program. The program is supposed to calculate checks and deposits, but the calculation comes out completely wrong. For instance, if i type 500 for initial balance, click 'entering a transaction', type 1 for checks, and type the amount 50 for transaction amount, the remaining balance … | |
how to code(program )a java spread sheet program using swing components | |
import java.awt.Point; import javax.swing.*; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.JPanel; public class painttest extends JPanel { private int pointCount = 0; private Point[] points = new Point[1000]; public painttest(){ addMouseMotionListener(new MouseMotionAdapter() {public void MouseDragged(MouseEvent event){ if(pointCount<points.length) {points[ pointCount ] = event.getPoint(); // find point ++pointCount; // increment number … | |
![]() | Hello everyone, I'm having some issues with my rock, paper, scissors JApplet program. Of course I have it "extends Applets" from the beginning of my class and I realized that this wasn't the same as JApplet. After I changed "Applet" to "JApplet", when I ran it, it doesn't look like … |
Hi, I am trying to write an application that will calculate the volume of a pool with fixed length and width. The user will be prompted to enter 2 values for depth. The application should draw a cross-section of the pool using length, deep end and shallow end. A part … | |
**Question** You are to design and implement a GUI application that will calculate the price of a pizza, based upon the size, style of crust, and selection of toppings. The price is calculated according to the following rules: • A plain small pizza is $6, medium is $8, large is … | |
This code is supposed to determine for a number of random numbers whether its odd, even , prime. At the end all random numbers should be displayed and the prime ones together with the number of odd and even numbers and their %. The part of the code to determine … | |
Hello! i need to filter the searched data in the database sql and display it on the table. But i keep on getting tis error: java.lang.StringIndexOutOfBoundsException: String index out of range: 1 at java.lang.String.charAt(Unknown Source) at app.SearchByKey.SearchStudentNumber.SearchStudentRecordReader(SearchStudentNumber.java:38) at app.ui.ListOfStudents.updateSearchTable(ListOfStudents.java:159) at app.ui.ListOfStudents$3.keyReleased(ListOfStudents.java:105) at java.awt.Component.processKeyEvent(Unknown Source) at javax.swing.JComponent.processKeyEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) … | |
Hi, Having some issues connecting to MS Access Database. I think its ot connecting to the database. Below are the source codes: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DB extends DBDriver implements ActionListener { JFrame f; JLabel Fname = new JLabel("First Name: "); JLabel Lname = new JLabel("Last … | |
package guessinggame; import java.awt.FlowLayout; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JTextField; //create class GuessingGame that extends to JFrame public class GuessingGame extends JFrame { public static void main(String args[]) { //define variables private JLabel instruction1JLabel; private JLabel instruction2JLabel; private JLabel instruction3JLabel; private JLabel … | |
this is my code, the only problem I'm facing is that the jseperator is not appearing! import java.awt.event.*; import java.util.*; import javax.swing.*; import java.awt.*; public class AdmForm extends JFrame{ Container con1= getContentPane(); Container con2=getContentPane(); JFrame f2= new JFrame(); JButton b1= new JButton("Click me!"); JSeparator sep= new JSeparator(SwingConstants.HORIZONTAL); AdmForm(){ setSize(300,300); setLayout(null); … | |
I want to enter a data from the text field to my database named project marking. When I compile the java program seems there's no errors but when I click on the Calculate Button the data won't enter into the database. This is the partial code I didn't finished it … | |
I have a lottery program nearly completed, thought i had the last of the problems sorted but it seems i did not!! The program has a couple of issues. 1: Everytime i click a button it stores what i clicked, for example 10, and also creates a random number. Problem … | |
Somebody help me, i'm a beginners of the java language, but in my interested to learn a java. and I create a GUI but the MDAS formula is not there, it because i dont know how to solve that, it cause need a pop and post function for the Calculator … | |
//MY Problem is that i'm trying to make a lottery program, the issue i have is when i click a button, i want it to be so that after i click 6 buttons, lets say ,1,2,3,4,5,6, the program will move onto the next stage( i have yet to build that) … | |
So I need to convert the Date to a string in the DayofBirth JOPtionPane areas that starts on lines 43 . it is originally defined as a date and must remain so. The book I am reading recommended using .toString() well that was useless or I just could not figure … | |
import java.awt.Color; import java.awt.event.ItemListener; import java.awt.event.ItemEvent; import javax.swing.*; public class framed implements ItemListener { JToggleButton jtButton; public JPanel createAndShowNewPane() { JPanel GUI= new JPanel(); GUI.setLayout(null); JPanel buttonPane= new JPanel(); buttonPane.setLayout(null); buttonPane.setSize(200,300); buttonPane.setLocation(0,0); GUI.add(buttonPane); jtButton= new JToggleButton("On"); jtButton.setSize(90,50); jtButton.setLocation(100,0); jtButton.addItemListener(this); buttonPane.add(jtButton); return GUI; } public static void window(){ JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame= … | |
Basically im practising java and came up on a challenge that i have yet to overcome. I have added an ActionListener but i want each button to have there own Action. Also what i wanted is to hide the contents in the button. Would be much appreciated to see how … | |
This is my program for a notepad! I am getting error at the part where I'm trying to extract the text from another .txt file!! I used the method realLine() but it only reads one line!! I want to know what other methods can I use here to extract the … | |
INdia in full swing producing the large number of engineering graduates in a year but somewhere they are loosing quality of education are you agree with that | |
Hi, I see a change in the font with string created by graphic2D from other labels. Is it possible to obtain a uniform font? package com.HIPS.biosynML; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; import java.awt.RenderingHints; import java.awt.Shape; import java.awt.font.FontRenderContext; import java.awt.font.LineBreakMeasurer; … | |
I'm having a problem where i am making a simple combo box program that when it runs shows a pic, you can have a drop down box to select a different pic, very simple. I have an array for the file name of each, and a second array to store … | |
I have been trying to implement a partially Dynamically generated GUI but an having trouble with the layout not rendering properly. Simply resizing the window corrects the issue. Here is the problimatic generation code: public void setupBookTabs() { ArrayList<String> bookTabNames = Record.getBookGroups(); for (int i = 0; i < bookTabNames.size(); … | |
Hi, I am making a program that has a JSplitPane and its background is transparent so I add two panels with a JScrollPane on the JSplitPane.. when I add the contents in the panel it doesn't appear. This is the code that I was using: import java.awt.BorderLayout; import java.awt.Color; import … | |
This is for anyone who might find it helpful. This template... * uses double-buffering, which can help game-makers fix that glitchy screen problem * can be exported as a runnable jar file. If you're like me and had trouble making your Applet executable, this is a possible fix. * Additionally … | |
So I am trying to get these radio buttons to respond to input but I have searched the internet and can find no code examples to show me how to do this. I also want to get the spinners to function in conjunction with them so when a product is … | |
Hi, I have a problem of modifying Jtree font. No matter what I do or make changes in code I'm unable to change the default font. I got the TreeCellRenderer code from some website. Any suggesion on font change would be really helpful class MyCellRenderer extends JEditorPane implements TreeCellRenderer { … | |
I'm just a beginner please help! BlueJ accepts my code - there are no compilation errors. But when i want to run the program it doesnt do what i wanted it to. It allows the user to answer the questions about the product and price but the skips to the … | |
Hi. Our homework is to use try...catch block in our calculator applet. I don't understand why the "catch" does not work. It will always go straight to the "finally". Here's the code: import java.applet.*; import java.awt.*; import java.awt.event.*; import java.awt.Label; import javax.swing.*; public class clsCalculator extends Applet implements ActionListener { … | |
In context like **He began to play fatback/swing-based R&B** | |
hello friends i like to make screen like windows my computer in which when we click in local disk and then any folder we don't see any new screen it just open all windows in one screen. is it possible to do in java so that we don't call any … | |
Hi All, I am having a tablespace named Incident which has eight columns . The first column is index which i kept as auto increment. The columns are 1.index(auto_increment) 2.ticket_no (String) 3.date(String) 4.description (String) 5.priority (int) 6.state (String) 7.follow_up (String) 8.status (String) Now i tried to insert test row in … | |
Hi Dude, I need to design an application similar to windows media player. Many suggested to me JMF but my actual need is it should be exactly same as windows media player. In my swing window, I should have the capability to add/edit playlists. If double click it should get … | |
I am trying to read all the files in a folder, if the file name == that of the name the user entered, the text of a button (that when on clicked will open the file) will be set to the file name. But my code for some reason doesn't … | |
Hello everyone. I'm having trouble about Internal JFrames as my code is compiling but it doesn't run. Can someone give me an advice as to how to make it work? Also the reason why I wanted to make internal JFrames is that I'm using layout managers on my panels so … | |
Hi All, I have just finished reading fundamental topics in Java and now i have decided to do a New Project in Java which comprises all basic features of Java. I need help in Understanding/visualizing the architecture / Design model for my Project. Specification is : 1 . Develop a … | |
Hello, I am trying to create an MDI application and am having problems with one of the frames. Walking through the errors, the first error points to a list generated by Netbeans code that I think is the null problem. When I look further down the error list, I get … | |
i want to add scroll bar to scroll this page..this page is user log-in form... to add more fields i have to add scroll bar how can i do so ..pls help package user; import java.awt.Color; import java.awt.Container; import java.awt.Font; import javax.swing.*; public class form extends JFrame package user; import … | |
i am making a calculator in swing and need help with some logic. so some of button my cal will have: 0,1,2,3,4,5,6,7,8,9,dot, mult,divide,mod, equal,sqrt, ln,log,sin,cos,tan, ^, exp, fractor, etc...... bc i have alot of buttons i need a good way to compute them. here what i am thinking: first user … | |
hello all i need to create comobox untill value come from database,example:-if in data base have 5 value then there should be five combox and value should be set in combobox each time automatically anyone help me to how create combobox that should equal to np. of value in database | |
I'm new to JavaFx and Java GUI development in general. For those not fermiliar, it seems that JavaFx threading has some similarities to swing. Anyway, I'm a little confused about when to use a `Thread` class and when to use JavaFx's worker classes (`Task<a>` for example). Should I use JavaFx … | |
I created several JComboBoxes using a for loop. I want them to reset when i click the reset button. But this doesn't work. These are my codes... import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.ItemListener; import java.awt.event.ItemEvent; class TryCombo extends JFrame{ TryCombo(){ super("Trying JComboBox"); setDefaultCloseOperation(EXIT_ON_CLOSE); JButton but = … | |
Hi, I am making a game I added a mouselistener in my game class but when i add a mouse listener in my class to make a custom button it doesn't work, so i had to make a variables mousePressed and variables for the mouse location mX and mY but … ![]() | |
Hi All, I am trying to write a code which checks whether the username and password stored in the database matches to the string created locally and displays it in console. The program connects to the database and gets the string from the table space correctly, but the problem is, … | |
Hello there guys! :) It's been quite a while since the last time I've been here. I am currently working on topics different from my usual, and I have found myself baffled by a problem. So, here goes: I am working on a web application which collects user fiscal data. … | |
I have been searching codes to draw line charts using jfreechart on internetand encountering the constant problem of pack(). When I copy the code I find on net the compiler compiles it. But when I try to use it in my code, the compiler shows error. I don't find its … | |
**I want to enter the value in jtable run time and want to dispaly its sum on same jtable when i pressed calculated button ** how to do please help :) import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import … | |
Heres my code [CODE]import java.applet.Applet; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Order extends Applet implements ActionListener { String password = "pword"; TextField txt1 = new TextField(10); TextField txt2 = new TextField(10); Button btn1 = new Button("Ok"); Button btn2 = new Button("Ok"); Label lbl1 = new Label("Choose Your Order"); … | |
Hi, First, thanks for reading this stuff. I am learning java. I recognize that I am a beginner. Last weekend I have coded a clock. Sourcecode is: import javax.swing.JFrame; import java.util.GregorianCalendar; import java.awt.image.BufferedImage; import java.awt.Canvas; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Color; import java.util.TimerTask; import java.util.Timer; import java.awt.BasicStroke; public … | |
Hi All, Im still finding it hard to understand Paint method, Almost all websites i had gone thru, they are showing examples of how to use it in an applet. I just cant understand on how to use it in a GUI application by extending Jframe object. Here is one … |
The End.