notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r1297 - development/laboratory/mgr/main/src/main/net/dpml/mgr/main
- From: mcconnell AT netcompartner.com
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r1297 - development/laboratory/mgr/main/src/main/net/dpml/mgr/main
- Date: Sun, 26 Dec 2004 07:24:26 +0100
Author: mcconnell
Date: Sun Dec 26 07:24:26 2004
New Revision: 1297
Modified:
development/laboratory/mgr/main/src/main/net/dpml/mgr/main/DefaultDesktop.java
Log:
simplify
Modified:
development/laboratory/mgr/main/src/main/net/dpml/mgr/main/DefaultDesktop.java
==============================================================================
---
development/laboratory/mgr/main/src/main/net/dpml/mgr/main/DefaultDesktop.java
(original)
+++
development/laboratory/mgr/main/src/main/net/dpml/mgr/main/DefaultDesktop.java
Sun Dec 26 07:24:26 2004
@@ -100,16 +100,6 @@
*/
private final Repository m_repository;
- /**
- * The content panel.
- */
- private JPanel m_panel;
-
- /**
- * The component holding focus.
- */
- private Component m_component;
-
//--------------------------------------------------------------------------
// constructor
//--------------------------------------------------------------------------
@@ -178,41 +168,18 @@
public void focusGained( FocusEvent event )
{
Component component = event.getComponent();
- refocus( component );
+ ((AbstractButton)component).setBorderPainted( true );
}
public void focusLost( FocusEvent event )
{
- }
-
- private void refocus( Component component )
- {
- Component[] children = m_panel.getComponents();
- for( int i=0; i<children.length; i++ )
- {
- Component child = children[i];
- if( child.equals( component ) )
- {
- ((AbstractButton)child).setBorderPainted( true );
- defocus( child );
- }
- }
- }
-
- private void defocus( Component component )
- {
- Component[] children = m_panel.getComponents();
- for( int i=0; i<children.length; i++ )
+ if( !event.isTemporary() )
{
- Component child = children[i];
- if( !child.equals( component ) )
- {
- ((AbstractButton)child).setBorderPainted( false );
- }
+ Component component = event.getComponent();
+ ((AbstractButton)component).setBorderPainted( false );
}
}
-
//--------------------------------------------------------------------------
// implementation
//--------------------------------------------------------------------------
@@ -237,8 +204,7 @@
panel.setBackground( Color.white );
panel.setSize( 700, 500 );
panel.setLayout( new FlowLayout( FlowLayout.LEFT ) );
- m_panel = panel;
- panel.addMouseListener( new BackgroundListener( panel ) );
+ panel.addMouseListener( new BackgroundListener() );
//
// populate the panel with the entries declared in the configuration
@@ -318,6 +284,7 @@
button.setFocusPainted( false );
button.setContentAreaFilled( false );
button.addFocusListener( this );
+ button.addMouseListener( new ClickListener() );
return button;
}
@@ -382,26 +349,26 @@
*/
private static class BackgroundListener extends MouseAdapter
{
- private Container m_container;
-
- private BackgroundListener( Container container )
+ public void mouseClicked( MouseEvent event )
{
- m_container = container;
+ Component component = event.getComponent();
+ component.requestFocus();
}
+ }
+ /**
+ * MouseEvent listener that handles doubleclick events on buttons within
+ * the content panel.
+ */
+ private static class ClickListener extends MouseAdapter
+ {
public void mouseClicked( MouseEvent event )
{
Component component = event.getComponent();
- component.requestFocus();
-
- Component[] children = m_container.getComponents();
- for( int i=0; i<children.length; i++ )
+ int n = event.getClickCount();
+ if( n > 1 )
{
- Component child = children[i];
- if( child instanceof AbstractButton )
- {
- ((AbstractButton)child).setBorderPainted( false );
- }
+ System.out.println( "# DOUBLE-CLICK: " + component );
}
}
}
- svn commit: r1297 - development/laboratory/mgr/main/src/main/net/dpml/mgr/main, mcconnell, 12/26/2004
Archive powered by MHonArc 2.6.24.