This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!

Jesse Walker

Ranch Hand
+ Follow
since Aug 18, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jesse Walker

I went to insert data from a table and then print the form without the user every seeing the form being open. If possible
I have been able to retrieve data from a tabel and insert data into a Table, I was wondering if I made a form inside Microsoft access, could I access that form and input data into the fields?
Thanks,
Jesse
Is there a way to make Java print the contents of a JFrame to the default printer, which class hanles that if their is?

Also, I know of the frame.dispose() method but that doesn't seem to close a JFrame, I have a multiple JFrame application with a back button option, I would like to find the best way to close the current frame, I am usinge JFrame.dispose?
Thanks,
Jesse
11 years ago
is their a way to convert a double to a BigDecimal?
11 years ago
I know round() will round to the nearest whole number but is there anything that will just round to 2 decimal places, the hundredth?
11 years ago
is the java.sql package part of the JRE or does it have to have a SDK installed on the computer?
I am just trying to learn the Java.sql class as well as odbcs, the following is my code, I have everything spelled correctly and all the cases match up, I will post my code below and the printStackTrace from the error as well
package quote;
import java.sql.*;
/**
*
* @author tech
*/
public class Connect {
public static void main(String[] args)
{
try {
String dataSourceName = "mdbTEST";
String dbURL = "jdbcdbc:" + dataSourceName;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection(dbURL, "","");
Statement s = con.createStatement();
s.execute("INSERT INTO TEST12345 VALUES('1','2')"); // Line 25
s.close(); // close the Statement to let the database know we're done with it
con.close();
}
catch (Exception e) {
System.out.println("Error: " + e);
e.printStackTrace();
}
}

/** Creates a new instance of Connect */
public Connect() {
}

}

error is the following:
java.sql.SQLException: General error

at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)

at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)

at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)

at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)

at quote.Connect.main(Connect.java:25)\\where my error is

Any help would be greatly appreciated, I am using DSNs.
This is the error I am getting and below is my code, what am I doing wrong, I cannt find anything that I am not initilazing(sp). Any help would be greatly appreciated.
Thanks,

java.lang.NullPointerException

at wirelessWriter.toExcel.<init>(toExcel.java:30)

at wirelessWriter.toExcel.main(toExcel.java:46)

Exception in thread "main"

Java Result: 1


package wirelessWriter;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.*;
import java.io.*;
import javax.swing.*;
/**
*
* @author tech
*/
public class toExcel {
File f = new File("C:\\Workbook.xls");
POIFSFileSystem fs;

public toExcel(){
if(f.exists()){
try{
fs = new POIFSFileSystem(new FileInputStream(f));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = sheet.getRow(2);
HSSFCell cell = row.createCell((short)0);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue("test");
FileOutputStream fileOut = new FileOutputStream(f);
wb.write(fileOut);
fileOut.close();
}
catch(FileNotFoundException fe){
fe.printStackTrace();
}catch(IOException io){
io.printStackTrace();

}
}
}
public static void main(String[] args){
new toExcel();
}
}
11 years ago
Ok, do I need to include that in my classpath, with a reference to the extact file or just the directory where it is stored in
Anyone have any experience downloading and installing the Jakarta POI? I have download the poi-bin-2.5.1-final-20040804.tar.gz and extracted to. I know I need to look for the Jakarta-commons.jar file and include the path in my classpath enviroment variable, either I downloaded the wrong thing or I have missed a step, I cannot find the file anywhere in my PC. Any help would be appreciated.
Thanks,
Jesse
I will try that I have been trying to use the repaint() but have been getting weird layouts, even using a layout manager.
thanks,
11 years ago
I would like the window to add a component after someone presses a button, how do I go about doing that? is the pain/repaint() method the best approach?
11 years ago
I am attempting to take a String Array that was passed from another Class and insert the text into a JLabel Array to display on a JFrame. The length of the String Array will be different each time. I have used the following code in my attempts:
1)
JLabel[] labels;//gives me a variable may not have been intialized
2)
int y = Array.getLength(info)// where info is the name of the StringArray, JLabel[y] label; //it give me a cannot recognize complier error
3)
JLabel[] labels = {};
and
JLabel[] labels = {new JLabel(info[0])};
When I use the code above and use a loop to try to add the rest of the variables from the STring array to this array I get an ArrayOutOFIndexException.
Any help would be appreciated at all
Thank you,
Jesse
11 years ago
in my application I am trying to create I have:
ButtonGroup fulldesk = new ButtonGroup();
JRadioButton[] radio = {new JRadioButton("Partial"), new JRadioButton("Full")};
fulldesk.add(radio[0]);
fulldesk.add(radio[1]);
Container content = frame.getContentPane();
content.add(fulldesk);

should it be
content.add(radio[0]);
content.add(radio[1]);
???
11 years ago
Looking at the Javadocs, I see that you can add JRadioButtons to a ButtonGroup using the method add(). When you want to display the buttons on a JFrame's ContentPane do you use the add method to add each Button in the Button Group or each buttongroup by themselves
ie
ButtonGroup buttons;
JRadiobutton radio;
buttons.add(radio);
Container content = frame.getContentPane();
content.add(buttons);
or
content.add(radio);

I have tried both ways and I can't get the buttons to show up at all.
Any help would be appreciated
Thank you,
11 years ago