to be clearly (like the above post),
importing actionListner class into your class that doesn't a matter
your class should be implemented ActionListner class too
and the remainng error is as above post said ( replace exit() instead of Exit() )
to be clearly (like the above post),
importing actionListner class into your class that doesn't a matter
your class should be implemented ActionListner class too
and the remainng error is as above post said ( replace exit() instead of Exit() )
i think you have to implement one more listner for your class
that is ItemListner
to read events from JComboBoxes instead of adding ActionListioner to those components
check it once by implementing ItemListner to those components
and keep line no 205 to 293 with in ItemListener related methods this is causing the some exceptions
to invoke ClearFeilds() method in the given class
i think use trim() function before you plcaing the data into text area
and one more thing you have applied some css class to text area element
check that class css once
is there any propery which gives those spacess in your textarea?
let me know the status once you modifies your code
use window.open() **concept instead of using **iframe concept
i think iframe concept does not work to your actual requiremnt
because iframe never tranfer any data to its parent(i mean the page which holds the iframe)
but in window.open() that thing is possible every element is visible to opened window
so that you can get your actual requirement by using this method instead of iframes
let me know if you have any doubts on my answer
can you show how you get the json data to your page?
i think thats doing the major part of your problem
check once whether you getting json data in synchronization mode or not
<textarea> tag does not have value attribute
if you want to place atext inside test area then you have to plcae your code as follows
<textarea>
<?
// plcae your data here
?>
</textarea>
can you post the MyFunctions.java file?
(for sort out your problem)
the StackOverFlow error may comes with recurcive calls of a function itself
to get more clarity on your problem i need to see the code (if you dont have any problem)
**at line 15 **you have taken the support of some class
myFunctions m;
you haven't instantiated this variable anywhere in your code but you called some methods by using that reference somewhere like line no 331, 344, 357
thats causing the exception check that once
create an object for that class is the solution for your problem
and let me know the status after the modification
check list for your problem
1. did you put any package statements in your java file?
2. are compiling and running on the same directory ?
please check those two conditions (these two are the basic cause of your problem)
use onmouseout instead of onfocusout
it may works for you
make margin-left to '75px'
1.add width : 85% **to the table css and add **margin-left:250px at line: 12
2.provide breaks for displaying data in the <td> tags
3.for 3rd <tr> tag in the first table add colspan=3 attribute
4.there is no body tag in your code and you are not closing the <img> tags properly
5. remove div tag from the top of page add this after body tag
do the following modifications and check it once
are you asking for storing the file to a new path or its original path?
i am getiing little bit confusion on your question
pls clarify me so that i will help you soon
replace your code with the following code at lineno:14
<a href="#" onclick="getDescription('$row[id]')">$row[by]</a> </li>
and write a javascript function which internally coded ajax concept for getting data of a particular id (as said by pritaeas)
and place ajax result data to the target div
i think you got the concept now
please try it once i hope you will get the answer
i think you have to refresh your data grid after the delete operation
but i think you haven't done like that (as of my knowledge)
check it once and let me know the status
instead of line15 at userpage.php
try to plcae the following code
<script type="text/javascript"> setTimeout(your_function_name,3000) </script>
and let me know the status after modifying the code
and also there will be some synchronization problem with the code which is relating (at line 6 ) to the json data
please first you try to replace code then we will sort out the answer
can you place your html code here? (if no one object in this forum)
so that i will answer your question very soon.
you never combine the code of jsp with html componets
html component never communicate with jsp tags
jsp tags can't read html component values
but you are asking these two combination.
i think you got the point
the main problemm of your jsp is you are repeating form tag for all record in the database.but a jsp page support forms with unique name only
what i mean is if have 5 records in database according to your code creates same
<form name='abc' >..some jsp code here ....</form>
content for 5 times (i mean repeated 5 times)
so that javascript does not recognise all these 5 <form> tags with the same name
(i mean <form name="abc"> )
it recognise first appeared <form> tag only
so that this is the main reason of your problem i think
just check it once
i think getSelectedItem() mothos not available in the ItemEvent Class
if you can replace getItem() method instead of that i think that error can be removed
try it once........
i don't know whether that is your actual requirement or not
please check it once
hai UNDER-18 FG,
you did one thing wrong for caliculating netPay value that is
you have taken input from user thats right but you haven't assigned those values to the Payroll class variables.
without doing that how can you caliculate netpay ? the above two posts are explaining same thing
for the solution do one thing
after payroll object is created assign user input values to the payroll class variables
(i think you know how the process is)
but i will provide for you
<instance-name>.variable_name = appropriate_value
do for remaining var's also
after all that,call caliculateNetpay()
then you will get the output as you wished.........
some guidelines for developing your actual requirement
create a table with all your required columns + (1 column for checking login successful or not status)
create 3 jsp pages like login.jsp, user_home.jsp, log_fail.jsp
create 1 servlet file for processing your logic like loginServlet.java
in orderto fullfill your task you must need the above things firstly
happy coding
use <link> tag for adding css to your web page
i think there is no specific configuration to the css in web.xml
because web.xml always talks about server components like servlets and jsps, not anything related to any design issues
move the selected column names and table to another page where you want to display the details and there you have to format these two things as the actual sql-query
for example :
anotherPage.jsp
<%
String tab_name = request.getParameter("table_name");
String col_name1 = request.getParameter("column_name1");
String col_name2 = request.getParameter("column_name2");
.
.
.
.
// and make query_string as follows
String sql_query = "Select "+col_name1+","+col_name2+" from "+tab_name;
// then create connection object ,retrive details
%>
then the remaing code is as it is
otherwise modify your class as follows
public class Payroll
{
public double grossPay;
public double stateTax;
public double federalTax;
public double calculateNetPay()
{
return grossPay - (stateTax + federalTax);
}
public void printOutput(double yo2)
{
System.out.println(" Net Pay is: " + y02);
}
}
and call printOutput() method by passing yo1 value as you called in your program like as follows
// change those lines in your program
y01 = taxes.calculateNetPay();
taxes.printOutput(y01);
happy coding
radha krishna .p
i have done some moduifucations to your code
here is the your modified code
public class SampleGUI extends javax.swing.JFrame {
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
public SampleGUI() {
initComponents();
}
private void initComponents() {
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jCheckBox1 = new javax.swing.JCheckBox();
jCheckBox2 = new javax.swing.JCheckBox();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Ok");
jButton2.setText("Cancel");
jButton3.setText("Help");
jCheckBox1.setText("Snap To Grid");
jCheckBox2.setText("Show Grid");
jLabel1.setText("X :");
jLabel2.setText("Y :");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jCheckBox2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jCheckBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE))
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField2, 0, 0, Short.MAX_VALUE)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE))
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCheckBox1))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCheckBox2)))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton3)))
.addContainerGap(14, Short.MAX_VALUE))
);
pack();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SampleGUI().setVisible(true);
}
});
}
}
happy coding
radha krishna .p
DecimalFormat is another class to format your data as you like
go thru the post (its also a calicuator application)
http://www.daniweb.com/software-development/java/threads/440520/unexpected-end-of-line
check out there modified code once
happy coding
yours
radha krishna
mostly this exception will also comes with if you are passing empty string to Double.parseDouble("") method ( i mean while caliculating the result)
for finding this place s.o.p statements(to know what values are stored in those variables i mean num1.getText() & num2.getText()) before you are caliculating the results
try once that
i think **this is also one reason for getting that kind of exception every time **
happy coding
yours
radha krishna
code is perfect with some logical errors
i have done some modifications to your code here is your modified code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JavaCalculator extends JFrame {
private JButton jbtNum1,jbtNum2,jbtNum3,jbtNum4,jbtNum5;
private JButton jbtNum6,jbtNum7,jbtNum8,jbtNum9,jbtNum0;
private JButton jbtEqual,jbtAdd,jbtSubtract,jbtMultiply,jbtDivide,jbtSolve,jbtClear;
private double TEMP,SolveTEMP;
private JTextField jtfResult;
Boolean addBool = false ;
Boolean subBool = false ;
Boolean divBool = false ;
Boolean mulBool = false ;
String display = "";
public JavaCalculator() {
JPanel p1 = new JPanel();
p1.setLayout(new GridLayout(4, 3));
p1.add(jbtNum1 = new JButton("1"));
p1.add(jbtNum2 = new JButton("2"));
p1.add(jbtNum3 = new JButton("3"));
p1.add(jbtNum4 = new JButton("4"));
p1.add(jbtNum5 = new JButton("5"));
p1.add(jbtNum6 = new JButton("6"));
p1.add(jbtNum7 = new JButton("7"));
p1.add(jbtNum8 = new JButton("8"));
p1.add(jbtNum9 = new JButton("9"));
p1.add(jbtNum0 = new JButton("0"));
p1.add(jbtClear = new JButton("C"));
JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout());
p2.add(jtfResult = new JTextField(20));
jtfResult.setHorizontalAlignment(JTextField.RIGHT);
jtfResult.setEditable(false);
JPanel p3 = new JPanel();
p3.setLayout(new GridLayout(5, 1));
p3.add(jbtAdd = new JButton("+"));
p3.add(jbtSubtract = new JButton("-"));
p3.add(jbtMultiply = new JButton("*"));
p3.add(jbtDivide = new JButton("/"));
p3.add(jbtSolve = new JButton("="));
JPanel p = new JPanel();
p.setLayout(new GridLayout());
p.add(p2, BorderLayout.NORTH);
p.add(p1, BorderLayout.SOUTH);
p.add(p3, BorderLayout.EAST);
add(p);
jbtNum1.addActionListener(new ListenToOne());
jbtNum2.addActionListener(new ListenToTwo());
jbtNum3.addActionListener(new ListenToThree());
jbtNum4.addActionListener(new ListenToFour());
jbtNum5.addActionListener(new ListenToFive());
jbtNum6.addActionListener(new ListenToSix());
jbtNum7.addActionListener(new ListenToSeven());
jbtNum8.addActionListener(new ListenToEight());
jbtNum9.addActionListener(new ListenToNine());
jbtNum0.addActionListener(new ListenToZero());
jbtAdd.addActionListener(new ListenToAdd());
jbtSubtract.addActionListener(new ListenToSubtract());
jbtMultiply.addActionListener(new ListenToMultiply());
jbtDivide.addActionListener(new ListenToDivide());
jbtSolve.addActionListener(new ListenToSolve());
jbtClear.addActionListener(new ListenToClear());
} //JavaCaluclator()
class ListenToClear implements ActionListener {
public void actionPerformed(ActionEvent e) {
//display = jtfResult.getText();
jtfResult.setText("");
addBool = false ;
subBool = false ;
mulBool = false ;
divBool = false ;
TEMP = 0; …
i got the solution and here is the modified code of your code :
public static void main(String[] args)
{
try
{
ArrayList<Integer> idNumbers = new ArrayList<Integer>();
ArrayList<Double> annualIncome = new ArrayList<Double>();
ArrayList<Integer> numPeopleInHousehold = new ArrayList<Integer>();
System.out.println("Reading values:");
Scanner scan = new Scanner(new FileReader("c://survey.txt"));
while (scan.hasNext()) {
String temp = scan.nextLine();
if (!temp.startsWith("#")) {
Scanner tokenizer = new Scanner(temp);
if (tokenizer.hasNext()) {
idNumbers.add(Integer.parseInt(tokenizer.next().trim())); // changed here
}
if (tokenizer.hasNext()) {
String incomeTemp = tokenizer.next().trim();
if(incomeTemp.trim().contains("$")){
incomeTemp = incomeTemp.replace('$',' '); // changed here
}
annualIncome.add(Double.parseDouble(incomeTemp));
}
if (tokenizer.hasNext()) {
numPeopleInHousehold.add(Integer.parseInt(tokenizer.next()));
}
}
}
System.out.println("idNumbers :"+idNumbers);
System.out.println("annualIncome :"+annualIncome);
System.out.println("numPeopleInHousehold :"+numPeopleInHousehold);
}catch(Exception e){
e.printStackTrace();
}
}
input format is like as follows:
100 1.20 58
12 $258.0 6
102 325.0 566
check it once.let me know whether it is your actual requirement or not
i have done two minor changes of your code
1. instead of using nextInt() i used next() method ( this was given the problem in your code)
and
2. after replace the dollor sign of double number you have to reassign the resulttant value to the same object but you forgot it
because of these 2 reasons your code couldn't give the exact solution to your problem
thats all
yours,
radha krishna
note : let it be if any mistakes in my sentence formation
use addItem() method of JCombobox class for adding data to your combobox which is placed on your GUI.i d'not know exactly how to use JPA in java but the following code will help you see it
if you know how to read data using and for example (if your data is in result set object)
jComboBox1.removeAllItems();
/* update fresh data to JcomboBox1 component as follows*/
while(rs.next){
jCombobox1.addItem(rs.getString(1));
}
all the best,
radha krishna.p
use addItem() method of JCombobox class for adding data to your combobox which is placed on your GUI.i d'not know exactly how to use JPA in java but the following code will help you see it
if you know how to read data using and for example (if your data is in result set object)
jComboBox1.removeAllItems();
/* update fresh data to JcomboBox1 component as follows*/
while(rs.next){
jCombobox1.addItem(rs.getString(1));
}
all the best,
radha krishna.p
use addItem() method of JCombobox class for adding data to your combobox which is placed on your GUI.i d'not know exactly how to use JPA in java but the following code will help you see it
if you know how to read data using and for example (if your data is in result set object)
jComboBox1.removeAllItems();
/* update fresh data to JcomboBox1 component as follows*/
while(rs.next){
jCombobox1.addItem(rs.getString(1));
}
all the best,
radha krishna.p
try with this code it gives the above pattern (in java)
public void displayPattern(int n){
for (int i = 1; i <= n; i++)
{
for (int j = i; j > 0; j--) {
System.out.print("\t"+j);
}
System.out.println("");
}
}
all the best,
radha krishna .peram
this is method description of next() in Scanner class :
String next()
Finds and returns the next complete token from this scanner and returns it as a string; a token is usually ended by whitespace such as a blank or line break. If not token exists, **NoSuchElementException ** is thrown.
i think the format of the datatable may be not in the proper way...
please check it once and reply the answer .. so that we will find another solution for your problem if this is not a solutionn.......
and can you tell me the data format of the users table which are storedi the text file?
regards
radha krihsna