BeanDev: New DZone Refcard for NetBeans 7.0 Platform

Hi!

The new updated Refcard #80 by Heiko Böck, Anton Epple, Miloš Šilhánek, Andreas Stefik, Geertjan Wielenga, and Tom Wheeler for the brand new NetBeans 7 Platform is published.

You can find many informations about the NetBeans Platform, a getting started intro, main features, NetBeans Platform modules,  NetBeans Platform APIs, reusable GUI components and  more.

In this Refcard, you are introduced to the key concerns of the NetBeans Platform so that you can save years of work when developing robust and extensible applications.

Six pages packed with many informations, download this Refcard #80 now!

VN:F [1.9.10_1130]
Rating: 0.0/5 (0 votes cast)
Veröffentlicht unter NetBeans, NetBeans Plattform | Verschlagwortet mit , , , , | Hinterlasse einen Kommentar

IDEDev: Bundle-Key Hyperlinks im Editor Quelltext

Moin!

Bin gerade mit 1001 Sachen beschäftigt und habe mein Blog etwas vernachlässigt. Aber einen kleinen Tipp habe ich gerade zur Hand. In einem älteren Blogeintrag erwähnte ich die Fähigkeit, dass NetBeans in den 7′er Dev-Builds Bundle Einträge in ein Code-Fold bringen kann. Es wird dann der Wert des Standard-Bundle angezeigt.

Es gibt aber noch ein nettes Feature. Man kann mit der Strg-Taste + Mausklick nun auch direkt zur Bundle-Datei zum Schlüssel springen. Es funktioniert genau so, wie man auch zu Klassen, Methoden und Variablen-Deklarationen springen kann.

Mit dem Klick wird die Bundle-Datei geöffnet und der Cursor auf den Schlüssel gesetzt. Wenn man nun die Tastenkombination Strg+1 drückt, wird diese Bundle Datei auch im Project Explorer selektiert (soweit man nicht sowieso eine automatische Selektion aktiviert hat).

Beste Grüße!

VN:F [1.9.10_1130]
Rating: 5.0/5 (1 vote cast)
Veröffentlicht unter NetBeans IDE | Verschlagwortet mit , , | 1 Kommentar

JavaFXDev: Screen capture tool with 200 lines and 500ms startup time

Hi!

Here is my next test with the JavaFX 2.0 ea release. I’ve created a 200-liner to capture parts from the desktop. The “Snipper” detects mouse dragging and two different key strokes (Escape and the letter ‘A’). The captured picture is automatically stored in the user.home/snapshot path.

Before I start to explain the code, I show a small picture about the different scene graph nodes:

At the bottom is the Desktop (I use only the primary screen, but it’s possible to detect all additional screens). The stage is created by the JavaFX Launcher class. I modify the stage to a transparent style and fullscreen mode. The scene (embedded in the stage) captures the mouse events (button pressed, released and dragging). The scene itself has a transparent fill color and contains one group with three different nodes. In the KeyPane-Node I capture the key events. The node is focusable and transparent to mouse events (any mouse event sinks down to the scene). GlassPane is a node with a Shape created by the screen bounds with a rectangular hole. This hole is calculated by the mouse gestures from the user. At last I’ve a visual representation for the user interaction: a red rectangular lasso node.

Weiterlesen

VN:F [1.9.10_1130]
Rating: 5.0/5 (5 votes cast)
Veröffentlicht unter JavaFX | Verschlagwortet mit , , | 11 Kommentare

JavaFXDev: NetBeans Platform with JavaFX 2.0ea

Hi!

Alan O’Leary shows in his blog a WebView integration in Swing. It is a not good documented feature, how to integrate JavaFX 2.0 controls into a swing application. But an integration is a main goal for the JavaFX 2.0 release.

As an enthusiastic NetBeans Platform/RCP developer and JavaFX partner, I work since two days to marriage JavaFX 2.0 and a NetBeans Platform Application. And yes, it works :-)

I’ve created a maven based platform application with a special starter Main.class. I need to launch the JavaFX toolkit system before any other module bootstrapping. The solution here is based on the early access release through the JavaFX partner program. This “best practice” may change significantly between now and the final version. However, I’ll show only a concept, not compilable code.

The solution behind the bootstrapping a NetBeans Platform is based on a FAQ by Tom Wheeler. My Main.class is a JavaFX Application class – I need this Application instance to get rid of from invoke exceptions. The created Stage object by the Launcher can be ignored.

public class Main extends Application{

  private static final String NB_MAIN_CLASS = "org.netbeans.core.startup.Main";

  public static void main(String[] args) throws Exception {
    // do whatever you need here (e.g. show a custom login form)
    System.out.println("Launch Java FX");
    long ms = System.currentTimeMillis();

    Launcher.launch(Main.class, args); // This is the main start up for JavaFX 2.0

    System.out.println("Launched Java FX in " + (System.currentTimeMillis() - ms) + "ms");

    // once you're done with that, hand control back to NetBeans
    ClassLoader classloader = Thread.currentThread().getContextClassLoader();
    Class mainClass = Class.forName(NB_MAIN_CLASS, true, classloader);

    Object mainObject = mainClass.newInstance();
    Method mainMethod = mainClass.getDeclaredMethod("main", new Class[]{String[].class});
    mainMethod.invoke(mainObject, (Object) args);
  }

  @Override
  public void start(Stage stage) {
    // Nothing to do, forget the stage....
  }
}

The Main class is in a standard Java archive. This JAR file and all the JavaFX files must be in the platform/core folder.

At runtime all the core-Libs are available to the whole NetBeans Platform modules (and plugins). For the compiler I need a special dependency to the runtime:

<dependency>
 <groupId>sun.javafx</groupId>
 <artifactId>tools</artifactId>
 <version>2.0.0</version>
 <scope>system</scope>
 <systemPath>${basedir}/../../corelauncher/mainlauncher/src/main/lib/jfxrt.jar</systemPath>
</dependency>

The system path depends on your project structure.

Now I can access all the JavaFX classes in a NetBeans module.

Please note, any scene construction needs to be build up in the JavaFX event queue thread. This is not the EventDispatcher-Thread from Swing!

My favorite call to jump in the JavaFX event thread is: Toolkit.getDefault().defer (Runnable) javafx.application.Platform.runLater (Runnable). But the Toolkit class is in a com.* package. IMHO in the future we get an official way to do this.

The creation of a WebView component is pretty similar to the sample from Alan. But I don’t need a stage object:

    Platform.runLater(new Runnable() {

      @Override
      public void run() {
        group = new Group();
        Scene scene = new Scene(group);

        browser = new WebView(new WebEngine());
        browser.getEngine().addChangeListener(PropertyReference.WILDCARD, new ChangeListener() {

          @Override
          public void handle(Bean paramBean, PropertyReference paramPropertyReference) {
            if ("title".equals(paramPropertyReference.getName())) {
              EventQueue.invokeLater(new Runnable() {
                // Jump to Swing EventDispatcher...
                @Override
                public void run() {
                  BrowserTopComponent.this.setDisplayName(browser.getEngine().getTitle());
                }
              });
            }
            if ("url".equals(paramPropertyReference.getName())) {
              EventQueue.invokeLater(new Runnable() {
                // Jump to Swing EventDispatcher...
                @Override
                public void run() {
                  String url = browser.getEngine().getUrl();
                  tfUrl.setText(url);
                  addHistory(url);
                }
              });
            }
          }
        });

        group.getChildren().add(browser);
        group.setScaleX(0.8d);
        group.setScaleY(0.8d);
        Reflection r = new Reflection();
        r.setTopOffset(8);
        group.setEffect(r);

        scene.setFill(javafx.scene.paint.Color.BLACK);
        browser.setWidth(panel.getWidth());
        browser.setHeight(panel.getHeight());

        panel.setScene(scene);
      }
    });

    panel.addComponentListener(new ComponentAdapter() {
      @Override
      public void componentResized(ComponentEvent e) {
        Platform.runLater (new Runnable() {
          // Jump from Swing-EventDispatcher to the JavaFX Thread:
          @Override
          public void run() {
            browser.setWidth(panel.getWidth());
            browser.setHeight(panel.getHeight());
          }
        });
      }
    });

I’ve added some useful listeners. Please aware the switches between different threads (Swing and JavaFX).

The result is a beautiful NetBeans Platform application with an embedded JavaFX 2.0 WebView:

PS.: I like the Twitter message from Dean Riverson: “Ok, I call a moratorium on rotating and reflecting WebView…” (origin).  -

I have to write 100 times:

I’ll never rotate and reflect WebView again, I’ll never rotate and reflect WebView again,I’ll never rotate and reflect WebView again,I’ll never rotate and reflect WebView again,I’ll never rotate and reflect WebView again,I’ll never rotate and reflect WebView again,I’ll never rotate and reflect WebView again,I’ll never rotate and reflect WebView again,I’ll never rotate and reflect WebView again,I’ll never rotate and reflect WebView again, …
VN:F [1.9.10_1130]
Rating: 5.0/5 (4 votes cast)
Veröffentlicht unter JavaFX, Maven, NetBeans Plattform | Verschlagwortet mit , , | 12 Kommentare

Training: Lingen/Ems – FH Osnabrück – NetBeans Platform Certified Training

Moin!

Letzten Donnerstag und Freitag war es mal wieder soweit, ein sehr intensives und hoffentlich für die Teilnehmer spannendes Training ist zu Ende gegangen.

In zwei Tagen haben wir (Geertjan und ich) mehr als 20 Teilnehmern, an der Fachhochschule Osnabrück Lingen/Ems, die NetBeans Plattform in einem Trainings-Kurs nahe gebracht. Es hat uns besonders gefreut, dass alle Anwesenden bis 18:00 am Freitag durchgehalten haben. Und nein, die Tür war nicht abgeschlossen ;) Weiterlesen

VN:F [1.9.10_1130]
Rating: 0.0/5 (0 votes cast)
Veröffentlicht unter NetBeans Certified Platform Training | Verschlagwortet mit , , | Hinterlasse einen Kommentar

IDEDev: NetBeans 7 Beta2 und spezielles zu Git und JUnit

Moin!

Gestern kündigte ich ja die Beta2 zur NetBeans 7.0 IDE an. Zwei Dinge hatte ich da unterschlagen, die hier noch einer besonderen Erwähnung bedürfen.

Git

In der Beta2 kann man nun (ohne Plugin) git als Versionierungssystem nutzen. Der Git Plan im Wiki gibt schon einen recht guten Überblick, was funktioniert und worauf man noch warten muss.

Folgende Features sollten funktionieren:

Bis zum Finale ist noch einiges zu tun, gerade für das Distributing steht noch was aus (Repository Clone, Pull, Push, Fetch), die Vervollständigung der Branching und Merging Tools (Merge from Branch, Export uncommited changes (Local changes), Apply Patch) sowie Search history of files und eine Blame Integration.

JUnit

Trotz der verwirrenden und unterschiedlichen, teils negativen, Meldungen wird JUnit natürlich weiter von NetBeans unterstützt. Allerdings muss JUnit in Zukunft extra aus dem Plugin-Center geladen werden. Fest integriert ist nur ein Bridge-Modul zu JUnit. Unabhängig zu rechtlichen Vorgaben hat das in Zukunft vielleicht sogar Vorteile, wenn es um die Integration von anderen Unit-Tools geht (z.B durch eine einheitliche API).

Ich hoffe, dass heute der Download nicht so überlastet ist wie gestern. Viel Spaß mit NetBeans 7.

Beste Grüße,
Josch.

VN:F [1.9.10_1130]
Rating: 5.0/5 (2 votes cast)
Veröffentlicht unter NetBeans, NetBeans IDE | Verschlagwortet mit , , | Hinterlasse einen Kommentar

IDEDev: NetBeans 7 Beta2 is out

Moin!

Ab heute ist NetBeans 7.0 Beta 2 verfügbar zum Download.

Die Highlights sind:

  • JDK 7 Unterstützung
  • Integration des WebLogic Servers
  • Verbesserungen, um eine Oracle Datenbank einzubinden
  • Glassfish 3.1 Unterstützung
  • Maven 3 Support
  • Remote URL-JavaDoc Support (JavaDoc muss nicht mehr lokal installiert sein)
  • Neuer GridBagLayout Customizer
  • Für JavaEE CDI, REST Dienste und Java Persistence Verbesserungen, zudem Bean Validation
  • JSF Component Bibliothekenunterstützung,  PrimeFaces ist mit an Board
  • Verbesserte EL-Unterstützung in JSF
  • HTML5
  • JSON
  • PHPDoc-Generierung
  • PHP Rename Refactoring und Safe delete Refactoring
  • PHP 5.3 Alias-Unterstützung
  • C/C++ kann nun besser Binär-Libs importieren
  • C/C++ Projekt-Typ mit Quelltexten auf Remote-Servern
  • Endlich für PHP User: Word-Wrap im Editor
  • Der Profiler wurde aufgebohrt
  • Verbesserte Überprüfung von externen Änderungen an Quelltexten außerhalb der IDE

Auch die NetBeans Platform bekommt Erweiterungen:

Ich hoffe nur die Maven Artifacts werden für Beta2 zeitnah freigegeben, am SNAPSHOT teste ich ungern.

Die aktuellen Release-Notes (en) stehen natürlich auch zur Verfügung. Sehr umfangreich ist, wie immer, die NewAndNoteworthy Seite.

Beste Grüße,
Josch.

VN:F [1.9.10_1130]
Rating: 0.0/5 (0 votes cast)
Veröffentlicht unter NetBeans, NetBeans IDE, NetBeans Plattform | Verschlagwortet mit , , | 3 Kommentare

BeanDev: native2ascii Datei Konverter. NetBeans Plugin Idee

Moin!

Ich habe mal wieder was für meine Ideensammlung: Plugins, die ich schon immer mal programmieren wollte, aber nie die Zeit dazu fand.

Heute der native2ascii Konverter für Dateien, die man im Project-Explorer markiert hat. Kontextmenü mit folgenden Befehlen:

  • To ASCII…
  • Reverse to native…
  • Native to native…

Weiterlesen

VN:F [1.9.10_1130]
Rating: 0.0/5 (0 votes cast)
Veröffentlicht unter NetBeans Plattform, Plugins | Verschlagwortet mit , , | Hinterlasse einen Kommentar

JavaDev: Java auf dem Desktop – Come on Oracle!

Moin!

Eines der massiv unterschätzten Themen ist Java auf dem Desktop. Immer wieder höre ich von Entwicklern, dass Web-Oberflächen, Java EE, Server und Backend-Development die Domäne für Java sei.

Ich denke mal, man muss da ein wenig über den Tellerrand hinaus schauen. Sicherlich ist Java nicht die 1a Desktop Sprache, weil für die vielen netten Gimmiks einfach die nativen OS spezifischen Schnittstellen fehlen. Aber mal ehrlich, warum sollte eine so robuste Programmiersprache auf dem Desktop nichts taugen? Seit 15 Jahren entwickele ich Java-Desktop-Applikationen zunächst für eine kurze Zeit mit AWT, dann seit Swing 1.1 raus war, Swing-Applikationen. Weiterlesen

VN:F [1.9.10_1130]
Rating: 5.0/5 (5 votes cast)
Veröffentlicht unter Java, NetBeans, NetBeans Plattform | Verschlagwortet mit , , | 2 Kommentare

BeanDev: BetterIconView in NetBeans Plattform aufgenommen

You can find an English version on NetBeans Zone.

Moin!

Bei den NetBeans Certified Trainings übernehme ich regelmäßig den Teil Nodes & Explorer Views (pdf). Dabei stelle ich regelmäßig die unterschiedlichen Views vor. Dafür habe ich ein kleines Demo-Programm geschrieben. Das Programm zeigt allerdings nicht nur die Vorzüge der Views, sondern auch die Probleme mit deren Darstellungen. Gerade das IconView glänzt nicht gerade mit schöner Optik. Ich hatte aus der Not eine Tugend gemacht und gerade für das Training eine eigene Implementation vorbereitet. Damit kann man den Teilnehmern sehr leicht zeigen, wie man eigene Views für die Nodes-API erstellen kann.

Weiterlesen

VN:F [1.9.10_1130]
Rating: 0.0/5 (0 votes cast)
Veröffentlicht unter API, NetBeans Plattform | Verschlagwortet mit , | Hinterlasse einen Kommentar