Swing GroupLayout Error()

Hello,
I have an exception in my Japplet and i can`t find the problem. Can somebody find the exception.
Thanks in advance
Bart
This is the exception:
Exception in thread "main" java.lang.IllegalArgumentException: Component must be non-null
at javax.swing.GroupLayout$ComponentSpring.<init>(GroupLayout.java:2878)
at javax.swing.GroupLayout$ComponentSpring.<init>(GroupLayout.java:2858)
at javax.swing.GroupLayout$Group.addComponent(GroupLayout.java:1490)
at javax.swing.GroupLayout$ParallelGroup.addComponent(GroupLayout.java:2414)
at javax.swing.GroupLayout$ParallelGroup.addComponent(GroupLayout.java:2384)
at javax.swing.GroupLayout$Group.addComponent(GroupLayout.java:1471)
at javax.swing.GroupLayout$ParallelGroup.addComponent(GroupLayout.java:2406)
My Code:
package gui;
import javax.swing.*;
import java.awt.*;
public class Gui extends JPanel {
    * File:         Gui.java
    * Version:      1.0
    * Description:  The Gui of a simple spot editing tool for the web.
    * @author       Bart
    * Date:         30-10-2008
    @SuppressWarnings("unchecked")
    private JButton btnPost;
    private JLabel lblSpotter;
    private JLabel lblDatum;
    private JLabel lblTijd;
    private JLabel lblVogelsoort;
    private JLabel lblLocation;
    private JLabel lblFoto;
    private JLabel lblCommentaar;
    private JLabel sl1;
    private JLabel sl2;
    private JLabel dp1;
    private JTextField inputSpotter;
    private JTextField inputDag;
    private JTextField inputUur;
    private JTextField inputVogelsoort;
    private JTextField inputMaand;
    private JTextField inputJaar;
    private JTextField inputMin;
    private JTextField inputLocAB;
    private JTextField inputLoc1234;
    private JTextField inputLoc5678;
    private JTextArea inputCommentaar;
    private JScrollPane jScrollPane1;
     * Method: Constructor Gui
     * Description:
    public Gui() {
     * Method: Constructor Gui
     * Description:
    private void init() {
        this.setVisible(true);
     //buttons
     btnPost = new JButton("Verzend");
     //labels
     lblSpotter = new JLabel("Spotter: ");
        lblDatum = new JLabel("Datum: ");
        lblTijd = new JLabel("Tijd: ");
        lblVogelsoort = new JLabel("Vogelsoort: ");
        lblLocation = new JLabel("Location: ");
        lblCommentaar = new JLabel("Commentaar: ");
        sl1 = new JLabel("/");
        sl2 = new JLabel("/");
        dp1 = new JLabel(":");
     //textfields & areas & scrollpane
     inputSpotter = new JTextField();
        inputDag = new JTextField();
        inputUur = new JTextField();
        inputVogelsoort = new JTextField();
        inputMaand = new JTextField();
        inputJaar = new JTextField();
        inputMin = new JTextField();
        inputLocAB = new JTextField();
        inputLoc1234 = new JTextField();
        inputLoc5678 = new JTextField();
        inputCommentaar = new JTextArea();
        inputCommentaar.setColumns(20);
        inputCommentaar.setRows(5);
     jScrollPane1 = new JScrollPane();
        jScrollPane1.setViewportView(inputCommentaar);
     //grouplayout & adding labels,textfields,textareas to layout
        GroupLayout layout = new GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(lblCommentaar)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addComponent(lblVogelsoort)
                            .addComponent(lblLocation)
                            .addComponent(lblTijd)
                            .addComponent(lblDatum)
                            .addComponent(lblSpotter)))
                    .addComponent(lblFoto))
                .addGap(7, 7, 7)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                    .addGroup(GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(inputDag)
                            .addComponent(inputUur, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addComponent(sl1)
                            .addComponent(dp1))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(inputMin, GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
                            .addComponent(inputMaand))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(sl2)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(inputJaar))
                    .addComponent(jScrollPane1, GroupLayout.Alignment.LEADING)
                    .addGroup(GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addComponent(inputLocAB, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(inputLoc1234, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(inputLoc5678))
                    .addComponent(inputSpotter, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE)
                    .addComponent(inputVogelsoort, GroupLayout.Alignment.LEADING)
                    .addComponent(btnPost))
                .addContainerGap(31, Short.MAX_VALUE))
        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(lblDatum)
                            .addComponent(inputDag, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(inputMaand, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(inputJaar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(inputLocAB)
                            .addComponent(inputLoc1234)))
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                        .addComponent(lblSpotter)
                        .addComponent(inputSpotter, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTijd)
                    .addComponent(inputUur, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(inputMin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(dp1))
                .addGap(7, 7, 7)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(lblVogelsoort)
                    .addComponent(inputVogelsoort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(lblLocation)
                    .addComponent(inputLocAB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(inputLoc1234, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(inputLoc5678, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(lblCommentaar)
                    .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addComponent(lblFoto)
                .addGap(21, 21, 21)
                .addComponent(btnPost)
                .addContainerGap())
      * Method: Start
      * Description:
     public void start() {
      * Method: Stop
      * Description:
     public void Stop() {
      * Method: Destroy
      * Description:
     public void destroy() {
     public static void main(String args[]){
          Gui gui = new Gui();
                gui.init();
}

I`ve changed JPanel into JApplet and init() into go() ,and start(),destroy() and stop() are disabled.
But at the end i want to have the applet into a webbrowser. And i can`t find the error, GroupLayout layout - new GroupLayout(this) seems good in my vision. The error is on the "this" part, is it possible to give the this a value?
Complete Exception
Exception in thread "main" java.lang.IllegalArgumentException: Component must be non-null
        at javax.swing.GroupLayout$ComponentSpring.<init>(GroupLayout.java:2878)
        at javax.swing.GroupLayout$ComponentSpring.<init>(GroupLayout.java:2858)
        at javax.swing.GroupLayout$Group.addComponent(GroupLayout.java:1490)
        at javax.swing.GroupLayout$ParallelGroup.addComponent(GroupLayout.java:2414)
        at javax.swing.GroupLayout$ParallelGroup.addComponent(GroupLayout.java:2384)
        at javax.swing.GroupLayout$Group.addComponent(GroupLayout.java:1471)
        at javax.swing.GroupLayout$ParallelGroup.addComponent(GroupLayout.java:2406)
        at gui.Gui.init(Gui.java:98)
        at gui.Gui.main(Gui.java:212)
Java Result: 1Thanks in advance,
Bart

Similar Messages

  • JDeveloper 11g javax.swing.GroupLayout

    Does JDeveloper 11g support the Swing class javax.swing.GroupLayout ?
    I did not see this class in the layout combo, and when I edited in the source code, I got an error:
    Field groupLayout not found in class oracle.jdevimpl.uieditor.proxy.JPanel
    Thanks a lot.
    John

    Hi,
    its a Java 6 feature and I am afraid to say that we didn't upgrade Swing to Java 6 in this release
    Frank

  • Javax.swing.GroupLayout - problem

    Hi
    Puzzling problem has occurred when developing the same application on different PC�s and using the same IDE (Netbeans 5.5) on both.
    The problem is that the �javax.swing.GroupLayout� class is being used when inserting netbeans GUI components on one of the PC�s. However, the other PC uses �org.jdesktop.layout.GroupLayout� and generates an error when trying to compile the �javax.swing.GroupLayout� components. It cannot find the javax.swing.GroupLayout� class.
    The jdk is jdk 6 for both.
    Can anyone shed any light on this?
    Regards
    GB

    Did you check the project properties?
    Project properties | Categories: Libraries --> Java Platform: JDK 1.6
    (javax.swing.GroupLayout works only with 1.6)

  • Import javax.swing.* error

    Heya. I decided to learn java and i've been doing the tutorials, recently i started the swing tutorials and the learn by example page. However, whenever I try to import javax.swing.* it gives me an error. SO you know, i am using the J2SDK 1.4.2 and netbeans IDE 5.0. Here's the error text and what i type.
    import javax.swing.* ;
    the error is:
    illegal start of expression and then sometimes i get <identifier> expected.
    can anyone help me?

    To update. I figured out how to do this with a blank start file in netbeans, however it's awful to have to delete main and then make a new class file. So, is there anyway to get a blank template project or to import javax.swing.* without having to delete main and start with a blank file? SO, i guess my question has changed, but it's still about an import javax.swing.* error.
    thanks.

  • Where is javax.swing.GroupLayout Class....?

    In the Java 6 Doc I am getting the information about javax.swing.GroupLayout class. But I cpuld not find the class in Jar.
    Am I missing something?
    It will be appriciated If you help me to finding the Jar file for this class.
    Thanks.

    Thanks for help.
    I have got it. As I am using beta version of Java6 in which that class was missing. In the latest version of JDK , I have found that class.

  • Swing layout error

    i have posted this in the jdbc forum but i have not recieved any responsed yet so im posting it here in the hope that one of you might
    have a solution.
    I searched this forum, and i was surprised to find that none had this problem. I ll get to the point.
    I am using netbeans, so i downloaded the mysql driver , added it to the project library and compiled and ran my program . I did not have any problems.
    so i triedt to run the app on a different machine and it gave me the
    popular swing layout error. I fixed that error. by adding some lines to the xml file mentioned in the netbeans faq.
    Now it gives me another popular error when i try to run the .jar file from command line on the same machine i developed the app
    the errror is
    System Exception Output : com.mysql.jdbc.Driver
    is there a way to avoid this error like the swing layout error
    thanks in advance

    So, nothing whatsoever to do with a Swing layout error, then :o)

  • Jre 15.0_22/Linux - Swing components error when using GTKLookAndFeel

    Hello,
    I'm not sure if it's a JRE bug or what, but on Linux platforms our applet fails when using swing components using the GTKLookAndFeel.
    To demonstrate/test, I have the ff test applet:
    import java.applet.Applet;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    public class TestApplet extends Applet {
      @Override
      public void init() {
        super.init();
        test();
      public static void main(String[] args) {
        (new TestApplet()).test();
      public void test() {
        try {
          String className = UIManager.getSystemLookAndFeelClassName();
          System.out.println(className);
          javax.swing.LookAndFeel laf = (javax.swing.LookAndFeel) this.getClass().forName(className).newInstance();
          UIManager.setLookAndFeel(laf);
          System.out.println("setting classloader");
          UIManager.put("ClassLoader", this.getClass().getClassLoader());
          UIManager.getLookAndFeelDefaults().put("ClassLoader", this.getClass().getClassLoader());
        } catch (ClassNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (InstantiationException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (IllegalAccessException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (UnsupportedLookAndFeelException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        System.out.println(UIManager.getLookAndFeelDefaults().getUIClass("javax.swing.JTextField"));
        UIManager.getLookAndFeelDefaults().getUI(new javax.swing.JTextField());
    }The system look and feel here is GTKLookAndFeel. The problem is that the getUI() call in the last line is returning null and I can see in the console:
    UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JTextField
    java.lang.Error
    .. etc.
    This is happening for different swing classes, I just used JTextField here as a simple test case.
    This only happens if the applet is run from the browser (via the java plugin). If I run the above code from the command line, there is no error raised, and the actual component UI class is a Synth class.
    This is only happening for us in Java 1.5.0_22 on Linux...on 1.5.0_15 and 1.6+ it seems to be fine. I'm using the 1.5.0_22 JDK downloaded from Sun.
    Anyone have any idea how to fix this error or any workaround? As you can see in the code above, I tried specifying the classloader (I read it in some other thread on these forums), but no luck there.
    Or is this a known problem in 1.5.0_22? Can anyone else replicate it?

    Installation howto you can find on http://www.puschitz.com
    Try use "Search" function before you create new topic. This one was discussed many times.

  • Iteration, multithread access, cuncurrenthashmap, swing, Strange Error

    Hi,
    Lets start with the error:
    Exception in thread "Thread-2" java.lang.IllegalStateException
         at java.util.concurrent.ConcurrentHashMap$HashIterator.remove(Unknown Source)
         at DrawFrame$allthread.run(DrawFrame.java:569)
         at java.lang.Thread.run(Unknown Source)Next lets look at the code:
                        Iterator<Rectangle> hr = rectangles.values().iterator();
                                       while (hr.hasNext()) {
                                            Rectangle rh = hr.next();
                                                                         if (somecondition){
                                                                             hr.remove();
                                                            }So apparently it looks like I'm trying to remove a rectangle, this works fine for a while, but then will randomly break at an unexpected time. Anyone got any advice? I think the error should be apparent. By the way, this is hashmap is getting used by seperate threads... but it is a cuncurrenthashmap.
    Whats goin on?
    Nate

    Myth shot down in flames...
    package forums;
    import java.util.Iterator;
    import java.util.Map;
    import java.util.HashMap;
    import java.util.concurrent.ConcurrentMap;
    import java.util.concurrent.ConcurrentHashMap;
    class ConcurrentHashMapPutAllContainingNullTest
      public static void main(String[] args) {
        try {
          Map<Integer,String> map = new HashMap<Integer,String>();
          map.put(1, "ONE");
          map.put(2, null);
          map.put(3, "THREE");
          ConcurrentMap<Integer,String> cache = new ConcurrentHashMap<Integer,String>();
          cache.putAll(map); // this is line 19
        } catch (Exception e) {
          e.printStackTrace();
    produces
    C:\Java\home\src\forums>"C:\Program Files\Java\jdk1.6.0_07\bin\java.exe" -Xms512m -Xmx1024m -enableassertions -cp C:\Java\home\classes; forums.ConcurrentHashMapPutAllContainingNullTest
    java.lang.NullPointerException
            at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
            at java.util.concurrent.ConcurrentHashMap.putAll(ConcurrentHashMap.java:909)
            at forums.ConcurrentHashMapPutAllContainingNullTest.main(ConcurrentHashMapPutAllContainingNullTest.java:19)

  • Swing JTable error when clicking on column header

    Hi I'm using ADF Swing in JDev 10.1.3 linking a UI JTable to a ADF viewobject, when clicking on the column header i get the follwing:
    [ConditionalEventPump] Exception occurred during event dispatching:
    oracle.jbo.InvalidObjNameException: JBO-25005: Objektnavn 1 for type Variabel er ugyldigt
    at oracle.jbo.common.VariableImpl.validateName(VariableImpl.java:234)
    at oracle.jbo.common.VariableImpl.setVariableKind(VariableImpl.java:301)
    at oracle.jbo.server.ViewRowSetImpl.defineNamedWhereClauseParam(ViewRowSetImpl.java:3390)
    at oracle.jbo.server.ViewObjectImpl.retrieveByKey(ViewObjectImpl.java:10374)
    at oracle.jbo.server.ViewObjectImpl.retrieveByKey(ViewObjectImpl.java:10180)
    at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:3955)
    at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:3794)
    at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:3782)
    at oracle.jbo.server.ViewObjectImpl.findByKey(ViewObjectImpl.java:6991)
    at oracle.adf.model.bc4j.DCJboDataControl.setCurrentRowInRSI(DCJboDataControl.java:930)
    at oracle.adf.model.bc4j.DCJboDataControl.setCurrentRowWithKey
    (DCJboDataControl.java:881)
    at oracle.jbo.uicli.jui.JUTableBinding$1$1.run(JUTableBinding.java:222)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:158)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

    Hi,
    in this case the bind variable name comes from the viewLink definition. What is the m/d, is it based on e.g. Departments/Employees pushing the ADF BC wizard? I need to understand how to build a testcase that allows me to reproduce the issue. Do you show both , master and detail on the Swing form, or only the detail?
    Frank

  • Javax.swing.GroupLayout

    Hi
    I have used Netbeans 7 to design my UI screens which uses jdk1.6, but i need to port it to jdk1.4..
    how can i make these changes?

    user7041221 wrote:
    I have used Netbeans 7 to design my UI screens which uses jdk1.6, but i need to port it to jdk1.4..
    how can i make these changes?Display the form in "Design" mode, right click the "Form" node in the "Inspector" window and set the property "Layout Generation Style" to "Swing Layout Extensions Library". Select the source level and java platform in the project properties window (File | Project Properties).
    Cheers,
    André

  • Org.jdesktop.layout.GroupLayout Error..

    org.jdesktop.layout.GroupLayout is a class used in Netbeans ide and is used for specifying the layout of the controls on the form.. how do i use this when im building my application in notepad..
    Thanx in advance..

    http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html

  • Load swing applet error

    hi
    when i load the applet, the message displayed in IE status bar is 'load: Test can't be instantiated' and NS status bar message 'Applet Test exception: java.lang.NullPointerException'.
    well here's my simple applet code :
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class TestEditor extends JApplet {
    JButton
    b1 = new JButton("Button 1"),
    b2 = new JButton("Button 2");
    public void init() {
    public TestEditor()
    Container cp = getContentPane();
    cp.setLayout(new FlowLayout());
    cp.add(b1);
    cp.add(b2);
    here is the html applet tag code :
    <APPLET name="myapplet" codebase="." CODE="TestEditor.class" WIDTH=420 HEIGHT=570>
    </APPLET>
    please if anyone can give me any idea...

    Hi,
    Just install the JRE plugin from java.sun.com/plugin.
    Then you to use this following code for running the applet with plugin.
    <EMBED type="application/x-java-applet;version=1.3" width="180" height="20"
    align="baseline" code="TestApplet" codebase="/javacall"
    MAYSCRIPT=true
    pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html">
    <NOEMBED>
    No JDK 1.2 support for APPLET!!
    </NOEMBED>
    </EMBED>
    Also please refer this URL for HTML Converter.
    http://java.sun.com/products/plugin/1.3/docs/html_converter.html
    Also please refer Java Plugin HTML Specification.
    http://java.sun.com/products/plugin/1.3/docs/tags.html
    I hope this will help you.
    Thanks
    Bakrudeen

  • I cant see  GroupLayout in javax.swing.

    What i doing wrong?
    Thanks

    javax.swing.GroupLayout is since version 1.6.
    {color:#000080}If you are getting an error when trying to import the class, you have an earlier version of the jdk.
    If you cannot see the class in the documentation, you are referring to the documentation for an earlier version.{color}
    http://java.sun.com/javase/6/docs/api/javax/swing/GroupLayout.html
    {color:#000080}db{color}

  • Font errors in Swing apps

    Hi, all. I've just installed the jdk 1.4.0 beta on Linux, and I get the following error message whenever I run an application that uses Swing (the error message is repeated about 20 times in a row):
    Font specified in font.properties not found [--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
    If I edit out all occurences of that string in jre/lib/font.properties, I get this error once:
    Warning: Cannot convert string "-b&h-lucidasans-medium-r-normal-sans-*-140-*-*-p-*-iso8859-1" to type FontStruct
    Also, I have a java application that depends on font size and type for proper output formatting (it uses "courier"). With the new jdk, the font looks very different, and the output is correspondingly garbled. Does anybody know what the heck is going on here?

    I have run into a similar problem with the new beta JDK. I work from home 90% of the time on a windows box, and everything ran fine. I had been using the JDK 1.4 beta 3 at home. I come to work today, and run the application here on a Solaris box, (which the sysadmin has configured for JDK 1.4 beta 2), and I get this error:
    Warning: Cannot convert string "-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1" to type FontStruct
    I think it has to do with the different betas. My next step is to check the changes between the two releases.
    If you find something that works, let me know.
    Robert Kausch
    [email protected]

  • Got error while compiling this source code?

    [code =java]package com.agent.client.movies;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.util.ArrayList;
    public interface DataSourceMovies extends Remote{
    ArrayList<String[]> getAllMovies() throws RemoteException;
    ArrayList<String[]> findMoviesByYear( int year) throws RemoteException;
    ArrayList<String[]> findMoviesByDirector(String director) throws RemoteException;
    ArrayList<String[]> findMoviesByGenre(String genre) throws RemoteException;
    ArrayList<String[]> findMoviesByName(String name) throws RemoteException;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    * MovieClient.java
    * Created on Apr 24, 2012, 10:49:58 AM
    package com.agent.client.movies;
    import com.agent.client.songs.SongsClient;
    import com.agent.client.Utility;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.StringTokenizer;
    import javax.naming.InitialContext;
    import javax.swing.DefaultListModel;
    import javax.swing.JOptionPane;
    import javax.swing.table.DefaultTableModel;
    public class MovieClient extends javax.swing.JFrame {
    ArrayList<String> mappedips = new ArrayList<String>();
    DefaultListModel<String> modelmsg = new DefaultListModel<String>();
    InitialContext ctx;
    /** Creates new form MovieClient */
    public MovieClient(String ips) {
    setLookAndFeel();
    initComponents();
    Utility.setInCenter(this);
    StringTokenizer stok = new StringTokenizer(ips, ":");
    while(stok.hasMoreTokens())
    mappedips.add(stok.nextToken());
    public void setLookAndFeel(){
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
    * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
    try {
    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
    if ("Nimbus".equals(info.getName())) {
    javax.swing.UIManager.setLookAndFeel(info.getClassName());
    break;
    } catch (ClassNotFoundException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    //</editor-fold>
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel2 = new javax.swing.JPanel();
    btclose = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    txtkey = new javax.swing.JTextField();
    btsearch = new javax.swing.JButton();
    jPanel9 = new javax.swing.JPanel();
    rdbyname = new javax.swing.JRadioButton();
    rdbydirector = new javax.swing.JRadioButton();
    rdbygenre = new javax.swing.JRadioButton();
    rdbyyear = new javax.swing.JRadioButton();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    lstMessages = new javax.swing.JList(modelmsg);
    jPanel7 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    tabmovies = new javax.swing.JTable();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new java.awt.Dimension(500, 500));
    jLabel1.setFont(new java.awt.Font("Simplified Arabic", 1, 24));
    jLabel1.setForeground(new java.awt.Color(0, 102, 204));
    jLabel1.setText("Mobile Agent: Find Movie Information");
    jPanel1.add(jLabel1);
    getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
    btclose.setText("Close");
    btclose.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btcloseActionPerformed(evt);
    jPanel2.add(btclose);
    getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_END);
    jPanel3.setLayout(new java.awt.BorderLayout());
    jPanel4.setLayout(new java.awt.GridLayout(2, 1));
    jLabel2.setText("Key");
    btsearch.setText("Search");
    btsearch.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btsearchActionPerformed(evt);
    javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
    jPanel8.setLayout(jPanel8Layout);
    jPanel8Layout.setHorizontalGroup(
    jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel8Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, 482, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(btsearch)
    .addContainerGap(130, Short.MAX_VALUE))
    jPanel8Layout.setVerticalGroup(
    jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel8Layout.createSequentialGroup()
    .addGap(14, 14, 14)
    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(btsearch))
    .addContainerGap(13, Short.MAX_VALUE))
    jPanel4.add(jPanel8);
    buttonGroup1.add(rdbyname);
    rdbyname.setSelected(true);
    rdbyname.setText("By name");
    buttonGroup1.add(rdbydirector);
    rdbydirector.setText("By director");
    buttonGroup1.add(rdbygenre);
    rdbygenre.setText("By genre");
    buttonGroup1.add(rdbyyear);
    rdbyyear.setText("By year");
    javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
    jPanel9.setLayout(jPanel9Layout);
    jPanel9Layout.setHorizontalGroup(
    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel9Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(rdbyname)
    .addGap(36, 36, 36)
    .addComponent(rdbydirector)
    .addGap(37, 37, 37)
    .addComponent(rdbygenre)
    .addGap(33, 33, 33)
    .addComponent(rdbyyear)
    .addContainerGap(352, Short.MAX_VALUE))
    jPanel9Layout.setVerticalGroup(
    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel9Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(rdbyname)
    .addComponent(rdbydirector)
    .addComponent(rdbygenre)
    .addComponent(rdbyyear))
    .addContainerGap(20, Short.MAX_VALUE))
    jPanel4.add(jPanel9);
    jPanel3.add(jPanel4, java.awt.BorderLayout.PAGE_START);
    jPanel5.setLayout(new java.awt.BorderLayout());
    jPanel6.setLayout(new java.awt.BorderLayout());
    lstMessages.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));
    jScrollPane1.setViewportView(lstMessages);
    jPanel6.add(jScrollPane1, java.awt.BorderLayout.CENTER);
    jPanel5.add(jPanel6, java.awt.BorderLayout.PAGE_END);
    jPanel7.setLayout(new java.awt.BorderLayout());
    tabmovies.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {
    new String [] {
    "Name", "Director", "Genre", "Release Year"
    jScrollPane2.setViewportView(tabmovies);
    jPanel7.add(jScrollPane2, java.awt.BorderLayout.CENTER);
    jPanel5.add(jPanel7, java.awt.BorderLayout.CENTER);
    jPanel3.add(jPanel5, java.awt.BorderLayout.CENTER);
    getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);
    pack();
    }// </editor-fold>//GEN-END:initComponents
    private void btcloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btcloseActionPerformed
    System.exit(0);
    }//GEN-LAST:event_btcloseActionPerformed
    private void btsearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btsearchActionPerformed
    searchMovies();
    }//GEN-LAST:event_btsearchActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btclose;
    private javax.swing.JButton btsearch;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JList lstMessages;
    private javax.swing.JRadioButton rdbydirector;
    private javax.swing.JRadioButton rdbygenre;
    private javax.swing.JRadioButton rdbyname;
    private javax.swing.JRadioButton rdbyyear;
    private javax.swing.JTable tabmovies;
    private javax.swing.JTextField txtkey;
    // End of variables declaration//GEN-END:variables
    private void searchMovies() {
    if(txtkey.getText().trim().length()==0){
    JOptionPane.showMessageDialog(null, "Please enter some words...");
    return;
    for(String ip : mappedips){
    modelmsg.addElement("Looking up node : " + ip);
    DataSourceMovies movies = null;
    try {
    ctx = new InitialContext();
    movies = (DataSourceMovies)ctx.lookup("rmi://" + ip + "/movieserver");
    } catch (Exception e) {
    modelmsg.addElement("Error contacting node...");
    e.printStackTrace();
    break;
    List<String[]> movieslist = null;
    try{
    if(rdbyname.isSelected())
    movieslist = movies.findMoviesByName(txtkey.getText().trim());
    else if(rdbydirector.isSelected())
    movieslist = movies.findMoviesByDirector(txtkey.getText().trim());
    else if(rdbygenre.isSelected())
    movieslist = movies.findMoviesByGenre(txtkey.getText().trim());
    else if(rdbyyear.isSelected()){
    try {
    movieslist = movies.findMoviesByYear(Integer.parseInt(txtkey.getText().trim()));
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Invalid year...");
    return;
    if(movieslist!=null && movieslist.size()>0){
    modelmsg.addElement("Songs found...");
    DefaultTableModel model = (DefaultTableModel) tabmovies.getModel();
    while(model.getRowCount()>0){
    model.removeRow(0);
    tabmovies.revalidate();
    for(String[] moviedata : movieslist)
    model.addRow(moviedata);
    catch(Exception ex) {               
    modelmsg.addElement("Error reading data...");
    break;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package com.agent.client.movies;
    import com.agent.client.Utility;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.net.Socket;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JWindow;
    import javax.swing.SwingConstants;
    public class MovieSplashScreen {
    private javax.swing.JLabel lbimage;
    private javax.swing.JLabel lbloading;
    private javax.swing.JLabel lbmobile;
    private javax.swing.JPanel panelBack;
    public static void main(String[] ar) {
    new MovieSplashScreen().displaySplash(ar[0]);
    public void displaySplash(String mapperip) {
    JWindow window = new JWindow();
    window.getContentPane().add(
    new JLabel("Loading JFrame...", SwingConstants.CENTER));
    window.setSize(525, 240);
    Utility.setInCenter(window);
    panelBack = new javax.swing.JPanel();
    lbimage = new javax.swing.JLabel();
    lbloading = new javax.swing.JLabel();
    lbmobile = new javax.swing.JLabel();
    panelBack.setBackground(new java.awt.Color(255, 255, 255));
    panelBack.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
    panelBack.setLayout(null);
    lbimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/agent/client/splash.jpg"))); // NOI18N
    panelBack.add(lbimage);
    lbimage.setBounds(250, 20, 250, 180);
    lbloading.setFont(new java.awt.Font("Showcard Gothic", 0, 30)); // NOI18N
    lbloading.setText("Loading...");
    panelBack.add(lbloading);
    lbloading.setBounds(50, 120, 210, 70);
    lbmobile.setFont(new java.awt.Font("Tekton Pro Cond", 0, 24)); // NOI18N
    lbmobile.setForeground(new java.awt.Color(0, 51, 51));
    lbmobile.setText("Mobile Agents 1.0");
    panelBack.add(lbmobile);
    lbmobile.setBounds(30, 20, 230, 40);
    window.add(panelBack, java.awt.BorderLayout.CENTER);
    window.setVisible(true);
    try {
    Thread.sleep(5000);
    } catch (InterruptedException e) {
    Socket client = null;
    try {
    client = new Socket(mapperip,2222);
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Mapping server down...");
    System.exit(0);
    DataInputStream din = null;
    DataOutputStream dout = null;
    String ips = null;
    try {
    din = new DataInputStream(client.getInputStream());
    dout = new DataOutputStream(client.getOutputStream());
    dout.writeUTF("movies");
    ips = din.readUTF();
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Cannot retrieve mappings...");
    e.printStackTrace();
    System.exit(0);
    window.setVisible(false);
    MovieClient sclient = new MovieClient(ips);
    sclient.setVisible(true);
    window.dispose();

    {code = java}package com.agent.client.movies;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.util.ArrayList;
    public interface DataSourceMovies extends Remote{
    ArrayList<String[]> getAllMovies() throws RemoteException;
    ArrayList<String[]> findMoviesByYear( int year) throws RemoteException;
    ArrayList<String[]> findMoviesByDirector(String director) throws RemoteException;
    ArrayList<String[]> findMoviesByGenre(String genre) throws RemoteException;
    ArrayList<String[]> findMoviesByName(String name) throws RemoteException;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    * MovieClient.java
    * Created on Apr 24, 2012, 10:49:58 AM
    package com.agent.client.movies;
    import com.agent.client.songs.SongsClient;
    import com.agent.client.Utility;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.StringTokenizer;
    import javax.naming.InitialContext;
    import javax.swing.DefaultListModel;
    import javax.swing.JOptionPane;
    import javax.swing.table.DefaultTableModel;
    public class MovieClient extends javax.swing.JFrame {
    ArrayList<String> mappedips = new ArrayList<String>();
    DefaultListModel<String> modelmsg = new DefaultListModel<String>();
    InitialContext ctx;
    /** Creates new form MovieClient */
    public MovieClient(String ips) {
    setLookAndFeel();
    initComponents();
    Utility.setInCenter(this);
    StringTokenizer stok = new StringTokenizer(ips, ":");
    while(stok.hasMoreTokens())
    mappedips.add(stok.nextToken());
    public void setLookAndFeel(){
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
    * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
    try {
    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
    if ("Nimbus".equals(info.getName())) {
    javax.swing.UIManager.setLookAndFeel(info.getClassName());
    break;
    } catch (ClassNotFoundException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    java.util.logging.Logger.getLogger(SongsClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    //</editor-fold>
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jPanel2 = new javax.swing.JPanel();
    btclose = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    txtkey = new javax.swing.JTextField();
    btsearch = new javax.swing.JButton();
    jPanel9 = new javax.swing.JPanel();
    rdbyname = new javax.swing.JRadioButton();
    rdbydirector = new javax.swing.JRadioButton();
    rdbygenre = new javax.swing.JRadioButton();
    rdbyyear = new javax.swing.JRadioButton();
    jPanel5 = new javax.swing.JPanel();
    jPanel6 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    lstMessages = new javax.swing.JList(modelmsg);
    jPanel7 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    tabmovies = new javax.swing.JTable();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new java.awt.Dimension(500, 500));
    jLabel1.setFont(new java.awt.Font("Simplified Arabic", 1, 24));
    jLabel1.setForeground(new java.awt.Color(0, 102, 204));
    jLabel1.setText("Mobile Agent: Find Movie Information");
    jPanel1.add(jLabel1);
    getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
    btclose.setText("Close");
    btclose.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btcloseActionPerformed(evt);
    jPanel2.add(btclose);
    getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_END);
    jPanel3.setLayout(new java.awt.BorderLayout());
    jPanel4.setLayout(new java.awt.GridLayout(2, 1));
    jLabel2.setText("Key");
    btsearch.setText("Search");
    btsearch.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    btsearchActionPerformed(evt);
    javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
    jPanel8.setLayout(jPanel8Layout);
    jPanel8Layout.setHorizontalGroup(
    jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel8Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, 482, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(btsearch)
    .addContainerGap(130, Short.MAX_VALUE))
    jPanel8Layout.setVerticalGroup(
    jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel8Layout.createSequentialGroup()
    .addGap(14, 14, 14)
    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(txtkey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(btsearch))
    .addContainerGap(13, Short.MAX_VALUE))
    jPanel4.add(jPanel8);
    buttonGroup1.add(rdbyname);
    rdbyname.setSelected(true);
    rdbyname.setText("By name");
    buttonGroup1.add(rdbydirector);
    rdbydirector.setText("By director");
    buttonGroup1.add(rdbygenre);
    rdbygenre.setText("By genre");
    buttonGroup1.add(rdbyyear);
    rdbyyear.setText("By year");
    javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
    jPanel9.setLayout(jPanel9Layout);
    jPanel9Layout.setHorizontalGroup(
    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel9Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(rdbyname)
    .addGap(36, 36, 36)
    .addComponent(rdbydirector)
    .addGap(37, 37, 37)
    .addComponent(rdbygenre)
    .addGap(33, 33, 33)
    .addComponent(rdbyyear)
    .addContainerGap(352, Short.MAX_VALUE))
    jPanel9Layout.setVerticalGroup(
    jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel9Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(rdbyname)
    .addComponent(rdbydirector)
    .addComponent(rdbygenre)
    .addComponent(rdbyyear))
    .addContainerGap(20, Short.MAX_VALUE))
    jPanel4.add(jPanel9);
    jPanel3.add(jPanel4, java.awt.BorderLayout.PAGE_START);
    jPanel5.setLayout(new java.awt.BorderLayout());
    jPanel6.setLayout(new java.awt.BorderLayout());
    lstMessages.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));
    jScrollPane1.setViewportView(lstMessages);
    jPanel6.add(jScrollPane1, java.awt.BorderLayout.CENTER);
    jPanel5.add(jPanel6, java.awt.BorderLayout.PAGE_END);
    jPanel7.setLayout(new java.awt.BorderLayout());
    tabmovies.setModel(new javax.swing.table.DefaultTableModel(
    new Object [][] {
    new String [] {
    "Name", "Director", "Genre", "Release Year"
    jScrollPane2.setViewportView(tabmovies);
    jPanel7.add(jScrollPane2, java.awt.BorderLayout.CENTER);
    jPanel5.add(jPanel7, java.awt.BorderLayout.CENTER);
    jPanel3.add(jPanel5, java.awt.BorderLayout.CENTER);
    getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);
    pack();
    }// </editor-fold>//GEN-END:initComponents
    private void btcloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btcloseActionPerformed
    System.exit(0);
    }//GEN-LAST:event_btcloseActionPerformed
    private void btsearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btsearchActionPerformed
    searchMovies();
    }//GEN-LAST:event_btsearchActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btclose;
    private javax.swing.JButton btsearch;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JList lstMessages;
    private javax.swing.JRadioButton rdbydirector;
    private javax.swing.JRadioButton rdbygenre;
    private javax.swing.JRadioButton rdbyname;
    private javax.swing.JRadioButton rdbyyear;
    private javax.swing.JTable tabmovies;
    private javax.swing.JTextField txtkey;
    // End of variables declaration//GEN-END:variables
    private void searchMovies() {
    if(txtkey.getText().trim().length()==0){
    JOptionPane.showMessageDialog(null, "Please enter some words...");
    return;
    for(String ip : mappedips){
    modelmsg.addElement("Looking up node : " + ip);
    DataSourceMovies movies = null;
    try {
    ctx = new InitialContext();
    movies = (DataSourceMovies)ctx.lookup("rmi://" + ip + "/movieserver");
    } catch (Exception e) {
    modelmsg.addElement("Error contacting node...");
    e.printStackTrace();
    break;
    List<String[]> movieslist = null;
    try{
    if(rdbyname.isSelected())
    movieslist = movies.findMoviesByName(txtkey.getText().trim());
    else if(rdbydirector.isSelected())
    movieslist = movies.findMoviesByDirector(txtkey.getText().trim());
    else if(rdbygenre.isSelected())
    movieslist = movies.findMoviesByGenre(txtkey.getText().trim());
    else if(rdbyyear.isSelected()){
    try {
    movieslist = movies.findMoviesByYear(Integer.parseInt(txtkey.getText().trim()));
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Invalid year...");
    return;
    if(movieslist!=null && movieslist.size()>0){
    modelmsg.addElement("Songs found...");
    DefaultTableModel model = (DefaultTableModel) tabmovies.getModel();
    while(model.getRowCount()>0){
    model.removeRow(0);
    tabmovies.revalidate();
    for(String[] moviedata : movieslist)
    model.addRow(moviedata);
    catch(Exception ex) {
    modelmsg.addElement("Error reading data...");
    break;
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package com.agent.client.movies;
    import com.agent.client.Utility;
    import java.io.DataInputStream;
    import java.io.DataOutputStream;
    import java.net.Socket;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JWindow;
    import javax.swing.SwingConstants;
    public class MovieSplashScreen {
    private javax.swing.JLabel lbimage;
    private javax.swing.JLabel lbloading;
    private javax.swing.JLabel lbmobile;
    private javax.swing.JPanel panelBack;
    public static void main(String[] ar) {
    new MovieSplashScreen().displaySplash(ar[0]);
    public void displaySplash(String mapperip) {
    JWindow window = new JWindow();
    window.getContentPane().add(
    new JLabel("Loading JFrame...", SwingConstants.CENTER));
    window.setSize(525, 240);
    Utility.setInCenter(window);
    panelBack = new javax.swing.JPanel();
    lbimage = new javax.swing.JLabel();
    lbloading = new javax.swing.JLabel();
    lbmobile = new javax.swing.JLabel();
    panelBack.setBackground(new java.awt.Color(255, 255, 255));
    panelBack.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 102, 102), 2));
    panelBack.setLayout(null);
    lbimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/agent/client/splash.jpg"))); // NOI18N
    panelBack.add(lbimage);
    lbimage.setBounds(250, 20, 250, 180);
    lbloading.setFont(new java.awt.Font("Showcard Gothic", 0, 30)); // NOI18N
    lbloading.setText("Loading...");
    panelBack.add(lbloading);
    lbloading.setBounds(50, 120, 210, 70);
    lbmobile.setFont(new java.awt.Font("Tekton Pro Cond", 0, 24)); // NOI18N
    lbmobile.setForeground(new java.awt.Color(0, 51, 51));
    lbmobile.setText("Mobile Agents 1.0");
    panelBack.add(lbmobile);
    lbmobile.setBounds(30, 20, 230, 40);
    window.add(panelBack, java.awt.BorderLayout.CENTER);
    window.setVisible(true);
    try {
    Thread.sleep(5000);
    } catch (InterruptedException e) {
    Socket client = null;
    try {
    client = new Socket(mapperip,2222);
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Mapping server down...");
    System.exit(0);
    DataInputStream din = null;
    DataOutputStream dout = null;
    String ips = null;
    try {
    din = new DataInputStream(client.getInputStream());
    dout = new DataOutputStream(client.getOutputStream());
    dout.writeUTF("movies");
    ips = din.readUTF();
    } catch (Exception e) {
    JOptionPane.showMessageDialog(null, "Cannot retrieve mappings...");
    e.printStackTrace();
    System.exit(0);
    window.setVisible(false);
    MovieClient sclient = new MovieClient(ips);
    sclient.setVisible(true);
    window.dispose();

Maybe you are looking for