The Source for Java Technology Collaboration
User: Password:



Kirill Grouchnikov

Kirill Grouchnikov's Blog

Bringing life to Swing desktop applications - all you need to know

Posted by kirillcool on May 13, 2007 at 08:43 PM | Comments (7)

You might have seen the teasers (first and second), and now it's the time for all the links.

  • The slides are right here (PDF format, so you can right-click on it and save instead of viewing directly in the browser).
  • The full sources for the main demo are in the CVS repository of Rainbow project (along with the WebStart link).
  • For more information about bytecode injection read this page.
  • The source code for demoes is available here (ghost effects) and here (transition effects).

Many thanks to Alex for having me as a co-presenter. Thanks to all who came to see our presentation, and for those who asked questions.

And one last thing. One of the comments on the previous blog entry requested animating the search mask (on dynamic search result updating). The implementation of the matching JXLayer painter can be found here. Here is how it looks like in action - note how the search mask is animated according to the current search string (in the top-right portion of the frame) and to the current icon scale (last few seconds of the video clip):


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Kirill, thanks for quickly going over your presentation with me in between sessions. I had missed the original talk, and Kirill was cool enough to give me an overview of it an even show me some of the demos.
    I also found the Swing discussion on Thursday night very interesting, it's great to have these presentations and discussions devoid of any marketing bits.
    Augusto

    Posted by: augusto on May 13, 2007 at 09:08 PM

  • Niiiiiiiice :)

    Posted by: liquid on May 14, 2007 at 01:42 AM

  • Nice pragmatical approach!

    But there are errors on page 16 "By default, all controls are opaque" and consequently on 17, that mislead readers to think JLabels to be opaque unless setOpaque(false) is called. Because that is not true, setting the background on a JLabel therefore does nothing, until setOpaque(true) is explicitly called:

    import java.awt.*;
    import javax.swing.*;
    
    public class Toady {
    
    	public static void main(String[] args) {
    		JFrame f = new JFrame("Toady Frog");
    		Container c = f.getContentPane();
    
    		JLabel l = new JLabel();
    		l.setText("Opaque? " + l.isOpaque() + ", Bg: " + l.getBackground());
    		c.add(l, BorderLayout.NORTH);
    
    		l = new JLabel();
    		l.setBackground(Color.BLUE);
    		l.setText("Opaque? " + l.isOpaque() + ", Bg: " + l.getBackground());
    		c.add(l, BorderLayout.WEST);
    
    		l = new JLabel();
    		l.setBackground(Color.RED);
    		l.setOpaque(true);
    		l.setText("Opaque? " + l.isOpaque() + ", Bg: " + l.getBackground());
    		c.add(l, BorderLayout.SOUTH);
    
    		f.pack();
    		f.setVisible(true);
    	}
    
    }
    

    Posted by: toadyfrog on June 23, 2007 at 01:34 AM

  • Or as the Java API Doc for JComponent puts it:
    public void setOpaque(boolean isOpaque)
    [..] The default value of this property is false for JComponent. However, the default value for this property on most standard JComponent subclasses (such as JButton and JTree) is look-and-feel dependent.

    Posted by: toadyfrog on June 23, 2007 at 03:55 AM

  • toadyfrog - the final presentation available from session catalog says "By default, most of the controls are opaque".

    Posted by: kirillcool on June 23, 2007 at 08:55 AM

  • Thanks for the link to the session catalogs - lots of other useful PDFs there.
    Page 17 is still misleading, though:

    JLabel label = new JLabel("Opaque");
    label.setBackground(Color.MAGENTA);
    frame.add(label);
    
    label.setText("Non Opaque");
    label.setOpaque(false);
    
    should be something like:

    JLabel label = new JLabel("Non Opaque");
    frame.add(label);
    
    label.setText("Opaque");
    label.setBackground(Color.MAGENTA);
    label.setOpaque(true);
    
    as JLabels aren't opaque per default. </nitpick>

    That said, thanks for the tutorial which is a great inspiration and hopefully leads me off the trodden path of boring applications.

    Posted by: toadyfrog on June 23, 2007 at 01:32 PM

  • toadyfrog - you're correct about that example. Thanks for pointing this out.

    Posted by: kirillcool on June 23, 2007 at 07:06 PM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds