UML diagram for JVLC, the Java Multimedia Library for VideoLAN
1 Kommentar(e). Veröffentlicht von Christian Ullenboom am Sonntag, April 29, 2007.Die Physik-Engine Phys2D
5 Kommentar(e). Veröffentlicht von Christian Ullenboom am Freitag, April 27, 2007.Phys2D ist eine 2D Physik-Engine, welches Massen, Trägheiten, Reibung simuliert. Die Bibliothek ist in Java 1.4 programmiert und unterstützt
- Boxes
- Circles
- Static Lines
- Restituion and Friction
- Fixed, Elastic and Loose Joints
- Angluar Velocity/Momentum
- Simple API
- Quad Tree Collision
- Gideon Smeding's Polygon
Ein Demo gibt es via via webstart.
Labels: Open Source
Shell-Script-Editor (ShellEd) und Eclipse Target Management Project/Remote System Explorer
0 Kommentar(e). Veröffentlicht von Christian Ullenboom am Dienstag, April 24, 2007.ShellEd (Bild) ist ein Shell-Script-Editor für Unix-Skripte (also ash, bsh, bash, csh, ksh, sh, zsh). Mit Manual und Vervollständigung. Interessant dazu ist das relativ unbekannte Target Management Project, wo man remote, etwa über SSH oder FTP auf einem Server arbeiten und zum Beispiel Dokumente editieren kann. Siehe dazu den Screenshot zum Remote System Explorer (RSE).
Mehr Eclipse-Plugins gibt's unter http://www.tutego.com/java/eclipse/plugin/eclipse-plugins.html.
Labels: Eclipse, Entwicklungsumgebung
Korrekte Inhaltsbreite in paintComponent() durch Insets beachten
0 Kommentar(e). Veröffentlicht von Christian Ullenboom am Freitag, April 20, 2007.Entwickler eigener Swing-Komponenten werden fürs Zeichnen auf getWidth() und getHeight() zurückgreifen. Wegen möglichen Insets sollte man jedoch beim Zeichen die Größenveränderungen betrachten.
@Override
protected void paintComponent( Graphics g )
{
Insets insets = getInsets();
int x = insets.left;
int y = insets.top;
int width = getWidth() - insets.left - insets.right;
int height = getHeight() - insets.top - insets.bottom;
...
A range is a very handy feature of programing languages like Python.
- range( 10 ) -> 0 1 2 3 4 5 6 7 8 9
- range( 5, 10 ) -> 5 6 7 8 9
- range( 0, 10, 3 ) -> 0 3 6 9
- range( '0', '9' ) -> 012345678
package com.tutego;And the main class
import static com.tutego.Range.range;
public class RangeDemo
{
public static void main( String[] args )
{
for ( int i : range( 10 ) )
System.out.print( i + " " );
System.out.println();
for ( int i : range( 5, 10 ) )
System.out.print( i + " " );
System.out.println();
for ( int i : range( 0, 10, 3 ) )
System.out.print( i + " " );
System.out.println();
for ( int i : range( '0', '9' ) )
System.out.print( (char) i );
System.out.println();
String[] a = { "Mary", "had", "a", "little", "lamb" };
for ( int i : range(a.length ) )
System.out.printf( "%d %s%n", i, a[i] );
}
}
Range /*
* This project is made available under the terms of the BSD license, more information can be found at
* http://www.opensource.org/licenses/bsd-license.html
*
* Copyright (c) 2007. Christian Ullenboom (http://www.tutego.com/) and contributors. All rights reserved.
*/
package com.tutego;
import java.util.Iterator;
/**
* Class that generates immutable sequences (ranges) as Iterable<Integer>
* objects. A range represents a start (0 if not given), an stop (mandatory) and
* an optional step (1 by default). The start value is included in the range,
* the stop value is exclusive. Every range is handled by an Iterable<Integer>
* which can by used in an extended for loop.
*
* <pre>
* for ( int i : range( 0, 10, 3 ) )
* System.out.print( i + " " ); // 0 3 6 9
* </pre>
*
* @author Christian Ullenboom (tutego)
* @version 1.0
*/
public class Range
{
public static Iterable<Integer> range( final int start, final int stop, final int step )
{
if ( step <= 0 )
throw new IllegalArgumentException( "step > 0 isrequired!" );
return new Iterable<Integer>()
{
public Iterator<Integer> iterator()
{
return new Iterator<Integer>()
{
private int counter = start;
public boolean hasNext()
{
return counter < stop;
}
public Integer next()
{
try
{
return counter;
}
finally { counter += step; }
}
public void remove() { }
};
}
};
}
public static Iterable<Integer> range( final int start, final int stop )
{
return range( start, stop, 1 );
}
public static Iterable<Integer> range( final int stop )
{
return range( 0, stop, 1 );
}
}
JavaServer Faces 2.0 Draft und Diskussionen
0 Kommentar(e). Veröffentlicht von Christian Ullenboom am Donnerstag, April 19, 2007.Dinge, die aktuell diskutiert werden und ich interessanter finde:
- The act of writing JSF applications and components "by hand" will be made much easier by this JSR.
- Allow for "zero configuration" web applications. No faces-config.xml, no web.xml. If necessary, annotations will be used to supplement the configuration data.
- Leverage annotations to declare JSF artifacts (components, managed beans, navigation rules, etc) to the runtime.
- Eliminate the need to author a JSP tag handler when writing JSF components.
- Real world, production view description technology, including templating: include something influenced by Facelets, JSFTemplating or Tiles in the specification
- All the artifacts that comprise a JSF application can be modified while the application is running.
- Expand the request processing lifecycle to be aware of Ajax.
- Decent client side, inter-component and form-level validation (leveraging JSR-303 validation if possible).
- Strategic additions to the Standard HTML RenderKit: Date Picker, Tree, Tab View, File Upload components.
- Provide a mechanism to minimize the "Lost Update" and "Duplicate Button Press" problems.
- Page actions: The ability to say, "when this page loads, invoke this action (via Ajax if necessary)."
- Allow JSF application resources to be accessed via REST. Add support for REST (JSR 311)
- "Skinning", or "Themeing" of components.
- WebBeans (JSR-299)
Die Dinge (und mehr) könnten Teil von Java EE 6 werden.
Links zu dem Thema:
- https://javaserverfaces-spec-public.dev.java.net/proposals/JSF-2_0-draft.html
- http://weblogs.java.net/blog/edburns/archive/2007/03/prejcpfiled_dra_1.html
- http://www.jsfcentral.com/editorial/jsf2_wishlist_1.html
- http://wiki.java.net/bin/view/Projects/Jsf2RequirementsScratchpad
- http://www.theserverside.com/news/thread.tss?thread_id=44836
So etwas bei RowSetMetaDataImpl in den Sun-Quellen zu sehen tut weh
0 Kommentar(e). Veröffentlicht von Christian Ullenboom am Donnerstag, April 12, 2007.Neue String-Objekte als Kopie von existierende Strings aufzubauen ist ganz schön übel. Aus javax.sql.rowset.RowSetMetaDataImpl:
public void setColumnLabel(int columnIndex, String label) throws SQLException
{
checkColRange(columnIndex);
if (label != null) {
colInfo[columnIndex].columnLabel = new String(label);
} else {
colInfo[columnIndex].columnLabel = new String("");
}
}
Wie die API-Doku zum Konsturktor so schön schreibt:
Unless an explicit copy of {@code original} is needed, use of this constructor is unnecessary since Strings are immutable.
Java EE 6 -- das Spiel geht weiter
0 Kommentar(e). Veröffentlicht von Christian Ullenboom am Freitag, April 06, 2007.Es war klar, dass es nach der Java EE 5 ein Java EE 6 geben wird. Nun wurde die neue JSR 313: JavaTM Platform, Enterprise Edition 6 (Java EE 6) Specification ausgerufen. Teil der Java EE 6 wird sein:
- JSR-196 Java Authentication SPI for Containers
- JSR-236 Timer for Application Servers
- JSR-237 Work Manager for Application Servers
- JSR-299 Web Beans
- JSR-311 JAX-RS: Java API for RESTful Web Services
Auf Web-Beans bin ich gespannt, denn da gehen die Ideen von JBoss Seam ein, also EJB 3 und JSF zu verheiraten.
Aktualisiert werden laut Standard:
- Enterprise JavaBeans
- Java Persistence API
- Servlets
- JavaServer Faces
- JAX-WS
Und Verschoben sind:
- JSR-168 Portlet Specification
- JSR-170 Content Repository for Java technology API
- JSR-207 Process Definition for Java
- JSR-208 Java Business Integration (JBI)
- JSR-225 XQuery API for Java (XQJ)
- JSR-235 Service Data Objects
- JSR-286 Portlet Specification 2.0
- JSR-289 SIP Servlet v1.1
- JSR-301 Portlet Bridge Specification for JavaServer Faces
Das Release ist für das 3 Q 2008 angedacht. Viel Zeit also noch.
Labels: Java EE
Das "Swing Application Framework" (JSR 296)
1 Kommentar(e). Veröffentlicht von Christian Ullenboom am Freitag, April 06, 2007.Hans Mueller schrieb schon für JavaOne 2007 eine kleine Einführung in das vielleicht zukünftige Swing-Framework (JSR 296) in Java 7: http://weblogs.java.net/blog/hansmuller/archive/ts-3399-final.pdf. Neben https://appframework.dev.java.net/intro/index.html ist nun unter http://weblogs.java.net/blog/diverson/archive/2007/04/swing_applicati.html ist nun eine weitere keine Beschreibung dazugekommen.
Um die Aufgaben kurz zusammenzufassen: Das Swing-Framwork soll eine (sehr?) leichtgewichtige Alternative zu Eclipse RPC und dem NetBeans Framework werden, um Actions, Properties und Voreinstellungen komfortabel zusammenzubringen. Zentral ist die Klasse Application, die den Lebenszyklus einer Swing-Applikation definiert.

Von https://appframework.dev.java.net/intro/index.html
Im Allgemeinen werden eigene Klassen dann von Application abgeleitet.
public class MySwingApp extends Application {
JFrame mainFrame = null;
@Override protected void startup( String[] args ) {
mainFrame = new JFrame();
mainFrame.setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
mainFrame.pack();
mainFrame.setVisible( true );
}
public static void main( String[] args ) {
launch( MySwingApp.class, args );
}
}In startup() werden nun die Komponenten aufgebaut. Dabei können Elemente wie das JLabel auf Eigenschaften aus Property-Dateien zurückgreifen:
JLabel l = new JLabel();
l.setName( "myLabel" );
Unter dem Namen myLabel gibt es einen Property-Eintrag:
myLabel.text=Text vom Label.
Auch der Name des Fensters lässt sich so setzen:
Application.title=Hallo Welt!
Um einem JButton eine Action zuzuweisen (Listener sind nicht mehr nötig), bekommt jede Aktion einen Namen, die in einer Map eingetragen ist.
ApplicationActionMap aMap = ApplicationContext.getInstance().getActionMap( getClass(), this );
JButton btn = new JButton();
b.setName( "myButton" );
b.setAction( aMap.get( "los" ) );
Die Aktionen selbst kommen von Methoden, die mit @Action annotiert sind. Standardmäßig bestimmt der Methodenname den Namen der Action, doch das kann mit name überschrieben werden.
@Action( name = "los" );
public void myAction( ActionEvent e ) {
System.out.println( "Es hat klick gemacht." );
}
Properties der Schaltflächen lassen weitere Eigenschaften zu:
myButton.Action.text = &Klick mich...
myButton.Action.accelerator = control K
myButton.Action.shortDescription = klicke und du wirst was erleben
Weitere Links:
Eclipse auf das Basis von Swing
0 Kommentar(e). Veröffentlicht von Christian Ullenboom am Donnerstag, April 05, 2007.Labels: Eclipse, Entwicklungsumgebung





