Mittwoch, 29. April 2009
http://blog.dotkam.com/2007/06/09/convert-date-to-string-in-java/
import java.util.Date;
import java.text.SimpleDateFormat;
... ... ... ...

public void testConvertDateToString() {

// Allocates a Date object and initializes it so that it represents the time
// at which it was allocated, measured to the nearest millisecond.
Date dateNow = new Date ();

SimpleDateFormat dateformatYYYYMMDD = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat dateformatMMDDYYYY = new SimpleDateFormat("MMddyyyy");

StringBuilder nowYYYYMMDD = new StringBuilder( dateformatYYYYMMDD.format( dateNow ) );
StringBuilder nowMMDDYYYY = new StringBuilder( dateformatMMDDYYYY.format( dateNow ) );

System.out.println( "DEBUG: Today in YYYYMMDD: '" + nowYYYYMMDD + "'");
System.out.println( "DEBUG: Today in MMDDYYYY: '" + nowMMDDYYYY + "'");

}




Dienstag, 28. April 2009
http://www.roseindia.net/java/example/java/swing/SetCellValues.shtml

import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;

public class SetCellValues{
JTable table;
public static void main(String[] args) {
new SetCellValues();
}

public SetCellValues(){
JFrame frame = new JFrame("Setting Cell Values in JTable");
JPanel panel = new JPanel();
String data[][] = {{"Vinod","MCA","Computer"},
{"Deepak","PGDCA","History"},
{"Ranjan","M.SC.","Biology"},
{"Radha","BCA","Computer"}};
String col[] = {"Name","Course","Subject"};
DefaultTableModel model = new DefaultTableModel(data, col);
table = new JTable(model);
SetData("Math",2,2);
SetData("Santosh",3,0);
JTableHeader header = table.getTableHeader();
header.setBackground(Color.yellow);
JScrollPane pane = new JScrollPane(table);
panel.add(pane);
frame.add(panel);
frame.setSize(500,150);
frame.setUndecorated(true);
frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public void SetData(Object obj, int row_index, int col_index){
table.getModel().setValueAt(obj,row_index,col_index);
System.out.println("Value is added");
}
}




inspector jtable events mouseclicked..add handler "my_handler_name" -
in the code youll find something like :

private void usertbl_mouse(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
int row = usertbl.getSelectedRow();
int col = usertbl.getSelectedColumn();
System.out.println( "row:"+ row + ":" + col );

col / row count starts at 0 !!!!
*fin




the target ist to start a seperate init-function just after the GUI was initialised-
Links :
jComboBox mit groupierter Datenbankabfrage initialisieren
http://www.netbeans-forum.de/viewtopic.php?p=10245&sid=61cb4c1e0c5f50611de5de7738313207




Sonntag, 26. April 2009
playing the first time with Exe4j to pack Netbeans Java apps to exe files needed alot of boose!

Puzzle is to find out all the jars needed to satisfy the "compiler" so here we go with the help of the fantasic site : http://www.findjar.com
Analysing the error.log file very looooong so only

The END :
using Netbeans / Liubraries ind the Guibuilder i made the appropriate includs of these JDG1.6 jar files to the Exe4J packer and got abt 56MB junk of exefile whick runs on the develop-machine.

Transfer to a very old WIN98 : seems problem win Java JRE..checking...problm with EXE4j_JAVA_HOME not found - leaving for later seems alot of ppl having the same problem -

http://wiki.netbeans.org/FaqDeployingMatisseBasedProjects ->How can I package the swing-layout-version.jar library into my application JAR? ->
http://wiki.netbeans.org/FaqDeployingMatisseBasedProjects
*
fin for today : deployed EXE4j file to workstation - ok! - still needs test with EXE4J options
*