pull vendor
This commit is contained in:
39
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/AxisListener.java
vendored
Normal file
39
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/AxisListener.java
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
//**********************************************************************************************
|
||||
// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
|
||||
// All rights reserved. Copying, modification,
|
||||
// distribution or publication without the prior written
|
||||
// consent of the author is prohibited.
|
||||
//
|
||||
// Created on 20. Februar 2002, 22:19
|
||||
//**********************************************************************************************
|
||||
package de.hardcode.jxinput.test;
|
||||
|
||||
import de.hardcode.jxinput.event.JXInputEventManager;
|
||||
import de.hardcode.jxinput.event.JXInputAxisEventListener;
|
||||
import de.hardcode.jxinput.event.JXInputAxisEvent;
|
||||
import de.hardcode.jxinput.Axis;
|
||||
|
||||
/**
|
||||
* Example listener to an axis.
|
||||
*
|
||||
* @author Herkules
|
||||
*/
|
||||
public class AxisListener
|
||||
implements JXInputAxisEventListener
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a new instance of AxisListener.
|
||||
*/
|
||||
public AxisListener( Axis axis )
|
||||
{
|
||||
JXInputEventManager.addListener( this, axis, 0.1 );
|
||||
}
|
||||
|
||||
|
||||
public void changed( JXInputAxisEvent ev )
|
||||
{
|
||||
System.out.println( "Axis " + ev.getAxis().getName() + " changed : value=" + ev.getAxis().getValue() + ", event causing delta=" + ev.getDelta() );
|
||||
}
|
||||
|
||||
}
|
||||
38
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/ButtonListener.java
vendored
Normal file
38
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/ButtonListener.java
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
//**********************************************************************************************
|
||||
// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
|
||||
// All rights reserved. Copying, modification,
|
||||
// distribution or publication without the prior written
|
||||
// consent of the author is prohibited.
|
||||
//
|
||||
// Created on 20. Februar 2002, 22:19
|
||||
//**********************************************************************************************
|
||||
package de.hardcode.jxinput.test;
|
||||
|
||||
import de.hardcode.jxinput.event.JXInputEventManager;
|
||||
import de.hardcode.jxinput.event.JXInputButtonEventListener;
|
||||
import de.hardcode.jxinput.event.JXInputButtonEvent;
|
||||
import de.hardcode.jxinput.Button;
|
||||
|
||||
/**
|
||||
* Sample button listener.
|
||||
*
|
||||
* @author Herkules
|
||||
*/
|
||||
public class ButtonListener implements JXInputButtonEventListener
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a new instance of AxisListener.
|
||||
*/
|
||||
public ButtonListener( Button button )
|
||||
{
|
||||
JXInputEventManager.addListener( this, button );
|
||||
}
|
||||
|
||||
|
||||
public void changed( JXInputButtonEvent ev )
|
||||
{
|
||||
System.out.println( "Button " + ev.getButton().getName() + " changed : state=" + ev.getButton().getState() );
|
||||
}
|
||||
|
||||
}
|
||||
37
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/DirectionalListener.java
vendored
Normal file
37
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/DirectionalListener.java
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
//**********************************************************************************************
|
||||
// (C) Copyright 2002 by Dipl. Phys. Joerg Plewe, HARDCODE Development
|
||||
// All rights reserved. Copying, modification,
|
||||
// distribution or publication without the prior written
|
||||
// consent of the author is prohibited.
|
||||
//
|
||||
// Created on 20. Februar 2002, 22:19
|
||||
//**********************************************************************************************
|
||||
package de.hardcode.jxinput.test;
|
||||
|
||||
import de.hardcode.jxinput.event.JXInputEventManager;
|
||||
import de.hardcode.jxinput.event.JXInputDirectionalEventListener;
|
||||
import de.hardcode.jxinput.event.JXInputDirectionalEvent;
|
||||
import de.hardcode.jxinput.Directional;
|
||||
|
||||
/**
|
||||
* Sample directional listener.
|
||||
*
|
||||
* @author Herkules
|
||||
*/
|
||||
public class DirectionalListener implements JXInputDirectionalEventListener
|
||||
{
|
||||
/**
|
||||
* Creates a new instance of AxisListener.
|
||||
*/
|
||||
public DirectionalListener( Directional directional )
|
||||
{
|
||||
JXInputEventManager.addListener( this, directional, 1.0 );
|
||||
}
|
||||
|
||||
|
||||
public void changed( JXInputDirectionalEvent ev )
|
||||
{
|
||||
System.out.println( "Directional " + ev.getDirectional().getName() + " changed : direction=" + ev.getDirectional().getDirection() + ", value=" + ev.getDirectional().getValue() + ", event causing delta=" + ev.getDirectionDelta() );
|
||||
}
|
||||
|
||||
}
|
||||
97
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/JXInputDevicePanel.form
vendored
Normal file
97
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/JXInputDevicePanel.form
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Events>
|
||||
<EventHandler event="componentShown" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="OnShow"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout">
|
||||
<Property name="horizontalGap" type="int" value="2"/>
|
||||
<Property name="verticalGap" type="int" value="2"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="mAxesPanelContainer">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="mAxesPanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="North"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="1"/>
|
||||
<Property name="rows" type="int" value="1"/>
|
||||
<Property name="verticalGap" type="int" value="20"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="mDirectionalPanel">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="South"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="1"/>
|
||||
<Property name="rows" type="int" value="1"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="mButtonScrollPane">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="East"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="mButtonsPanel">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="1"/>
|
||||
<Property name="rows" type="int" value="1"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
296
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/JXInputDevicePanel.java
vendored
Normal file
296
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/JXInputDevicePanel.java
vendored
Normal file
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* JXInputDevicePanel.java
|
||||
*
|
||||
* Created on 23. Januar 2002, 22:19
|
||||
*/
|
||||
package de.hardcode.jxinput.test;
|
||||
|
||||
import de.hardcode.jxinput.JXInputManager;
|
||||
import de.hardcode.jxinput.JXInputDevice;
|
||||
import de.hardcode.jxinput.Axis;
|
||||
import de.hardcode.jxinput.Directional;
|
||||
import de.hardcode.jxinput.Button;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.GridLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Font;
|
||||
import java.util.Dictionary;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Herkules
|
||||
*/
|
||||
public class JXInputDevicePanel extends javax.swing.JPanel
|
||||
{
|
||||
private static final Font AXIS_SLIDER_FONT = new Font( "Verdana", Font.PLAIN, 9 );
|
||||
|
||||
private final JXInputDevice mDev;
|
||||
private final ArrayList mAxisSliders = new ArrayList();
|
||||
private final ArrayList mButtonCheckboxes = new ArrayList();
|
||||
private final ArrayList mDirectionalLabels = new ArrayList();
|
||||
|
||||
|
||||
/** Creates new form JXInputDevicePanel */
|
||||
public JXInputDevicePanel( JXInputDevice dev )
|
||||
{
|
||||
mDev = dev;
|
||||
initComponents();
|
||||
initFromDevice();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class connecting a JSlider with an Axis.
|
||||
*/
|
||||
private class AxisSlider extends JSlider
|
||||
{
|
||||
Axis mAxis;
|
||||
AxisSlider( Axis axis )
|
||||
{
|
||||
super( ( Axis.SLIDER == axis.getType() ? 0 : -100 ), 100 );
|
||||
this.setMajorTickSpacing( Axis.SLIDER == axis.getType() ? 25 : 50 );
|
||||
this.setMinorTickSpacing( 5 );
|
||||
this.setPaintTicks( true );
|
||||
this.setPaintLabels( true );
|
||||
this.setEnabled( false );
|
||||
|
||||
Dictionary labeldict = this.getLabelTable();
|
||||
Enumeration labels = labeldict.elements();
|
||||
while ( labels.hasMoreElements() )
|
||||
{
|
||||
JLabel label = (JLabel)labels.nextElement();
|
||||
label.setFont( AXIS_SLIDER_FONT );
|
||||
label.setSize( 32, 12 );
|
||||
label.setHorizontalAlignment( SwingConstants.LEFT );
|
||||
}
|
||||
|
||||
mAxis = axis;
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
int ax = (int)(mAxis.getValue() * 100.0);
|
||||
|
||||
//
|
||||
// Only if value really changes
|
||||
//
|
||||
if ( ax != this.getValue() )
|
||||
{
|
||||
this.setValue( ax );
|
||||
this.setToolTipText( mAxis.getName() + ": " + Double.toString( mAxis.getValue() ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class ButtonCheckbox extends JCheckBox
|
||||
{
|
||||
Button mButton;
|
||||
ButtonCheckbox( Button button )
|
||||
{
|
||||
super( button.getName() );
|
||||
this.setEnabled( false );
|
||||
mButton = button;
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
boolean state = mButton.getState();
|
||||
|
||||
//
|
||||
// Only if value really changes
|
||||
//
|
||||
if ( state != this.isSelected() )
|
||||
{
|
||||
this.setSelected( state );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class DirectionalLabel extends JLabel
|
||||
{
|
||||
Directional mDirectional;
|
||||
int mCurrent = 0;
|
||||
|
||||
DirectionalLabel( Directional directional )
|
||||
{
|
||||
super( directional.getName() );
|
||||
mDirectional = directional;
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
int dir = mDirectional.getDirection();
|
||||
|
||||
//
|
||||
// Only if value really changes
|
||||
//
|
||||
if ( dir != mCurrent )
|
||||
{
|
||||
this.setText( mDirectional.getName() + ": " + ( mDirectional.isCentered() ? "-" : Integer.toString( dir ) ) );
|
||||
mCurrent = dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup the dialogs content from the JXInputDevice.
|
||||
*/
|
||||
void initFromDevice()
|
||||
{
|
||||
if ( null != mDev )
|
||||
{
|
||||
((GridLayout)mAxesPanel.getLayout()).setRows( mDev.getNumberOfAxes() );
|
||||
|
||||
for ( int i = 0; i < mDev.getMaxNumberOfAxes(); ++i )
|
||||
{
|
||||
if ( null != mDev.getAxis( i ) )
|
||||
{
|
||||
AxisSlider slider = new AxisSlider( mDev.getAxis( i ) );
|
||||
|
||||
JLabel name = new JLabel( mDev.getAxis( i ).getName() );
|
||||
name.setVerticalAlignment( SwingConstants.TOP );
|
||||
name.setHorizontalAlignment( SwingConstants.CENTER );
|
||||
name.setPreferredSize( new java.awt.Dimension( 90, 0 ) );
|
||||
|
||||
JPanel p = new JPanel();
|
||||
p.setLayout( new BorderLayout() );
|
||||
|
||||
p.add( name, BorderLayout.WEST );
|
||||
p.add( slider, BorderLayout.CENTER );
|
||||
|
||||
mAxesPanel.add( p );
|
||||
|
||||
// Add to list of all AxisSlider controls
|
||||
mAxisSliders.add( slider );
|
||||
|
||||
// Add an event listener:
|
||||
new AxisListener( mDev.getAxis( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
((GridLayout)mButtonsPanel.getLayout()).setRows( mDev.getNumberOfButtons() );
|
||||
for ( int i = 0; i < mDev.getMaxNumberOfButtons(); ++i )
|
||||
{
|
||||
if ( null != mDev.getButton( i ) )
|
||||
{
|
||||
ButtonCheckbox chk = new ButtonCheckbox( mDev.getButton( i ) );
|
||||
mButtonCheckboxes.add( chk );
|
||||
mButtonsPanel.add( chk );
|
||||
|
||||
// Add an event listener:
|
||||
new ButtonListener( mDev.getButton( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
((GridLayout)mDirectionalPanel.getLayout()).setRows( mDev.getNumberOfDirectionals() / 2 );
|
||||
for ( int i = 0; i < mDev.getMaxNumberOfDirectionals(); ++i )
|
||||
{
|
||||
if ( null != mDev.getDirectional( i ) )
|
||||
{
|
||||
DirectionalLabel lbl = new DirectionalLabel( mDev.getDirectional( i ) );
|
||||
mDirectionalLabels.add( lbl );
|
||||
mDirectionalPanel.add( lbl );
|
||||
|
||||
// Add an event listener:
|
||||
new DirectionalListener( mDev.getDirectional( i ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void update()
|
||||
{
|
||||
Iterator it = mAxisSliders.iterator();
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
((AxisSlider)it.next()).update();
|
||||
}
|
||||
|
||||
it = mButtonCheckboxes.iterator();
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
((ButtonCheckbox)it.next()).update();
|
||||
}
|
||||
|
||||
it = mDirectionalLabels.iterator();
|
||||
while ( it.hasNext() )
|
||||
{
|
||||
((DirectionalLabel)it.next()).update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
|
||||
private void initComponents()
|
||||
{
|
||||
mAxesPanelContainer = new javax.swing.JPanel();
|
||||
mAxesPanel = new javax.swing.JPanel();
|
||||
mDirectionalPanel = new javax.swing.JPanel();
|
||||
mButtonScrollPane = new javax.swing.JScrollPane();
|
||||
mButtonsPanel = new javax.swing.JPanel();
|
||||
|
||||
setLayout(new java.awt.BorderLayout(2, 2));
|
||||
|
||||
addComponentListener(new java.awt.event.ComponentAdapter()
|
||||
{
|
||||
public void componentShown(java.awt.event.ComponentEvent evt)
|
||||
{
|
||||
OnShow(evt);
|
||||
}
|
||||
});
|
||||
|
||||
mAxesPanelContainer.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
mAxesPanelContainer.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
mAxesPanel.setLayout(new java.awt.GridLayout(1, 1, 0, 20));
|
||||
|
||||
mAxesPanelContainer.add(mAxesPanel, java.awt.BorderLayout.NORTH);
|
||||
|
||||
add(mAxesPanelContainer, java.awt.BorderLayout.CENTER);
|
||||
|
||||
mDirectionalPanel.setLayout(new java.awt.GridLayout(1, 1));
|
||||
|
||||
mDirectionalPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
add(mDirectionalPanel, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
mButtonsPanel.setLayout(new java.awt.GridLayout(1, 1));
|
||||
|
||||
mButtonsPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
mButtonScrollPane.setViewportView(mButtonsPanel);
|
||||
|
||||
add(mButtonScrollPane, java.awt.BorderLayout.EAST);
|
||||
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void OnShow(java.awt.event.ComponentEvent evt)//GEN-FIRST:event_OnShow
|
||||
{//GEN-HEADEREND:event_OnShow
|
||||
// Commented: the focus is held by a parent component
|
||||
// System.out.println("OnShow");
|
||||
// this.requestFocus();
|
||||
}//GEN-LAST:event_OnShow
|
||||
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel mAxesPanel;
|
||||
private javax.swing.JPanel mAxesPanelContainer;
|
||||
private javax.swing.JScrollPane mButtonScrollPane;
|
||||
private javax.swing.JPanel mButtonsPanel;
|
||||
private javax.swing.JPanel mDirectionalPanel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
79
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/JXInputTestDialog.form
vendored
Normal file
79
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/JXInputTestDialog.form
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.0" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="title" type="java.lang.String" value="JXInput (C) 2001-2006 HARDCODE Dev."/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
</SyntheticProperties>
|
||||
<Events>
|
||||
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="closeDialog"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="mMainPanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout">
|
||||
<Property name="horizontalGap" type="int" value="10"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="mLabelNoDevice">
|
||||
<Properties>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
<Property name="text" type="java.lang.String" value="No JXInputDevice available!"/>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
||||
<BevelBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="North"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JTabbedPane" name="mDevicesTabbedPane">
|
||||
<Events>
|
||||
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="mDevicesTabbedPaneFocusGained"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JButton" name="mButtonReset">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Reset "/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="mButtonResetActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="South"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
286
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/JXInputTestDialog.java
vendored
Normal file
286
vendor/JXInput/0.3.4/java/de/hardcode/jxinput/test/JXInputTestDialog.java
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
//**********************************************************************************************
|
||||
// Dipl. Phys. Joerg Plewe, HARDCODE Development
|
||||
// Created on 27. Dezember 2001, 01:15
|
||||
//**********************************************************************************************
|
||||
|
||||
package de.hardcode.jxinput.test;
|
||||
|
||||
import de.hardcode.jxinput.*;
|
||||
import de.hardcode.jxinput.event.*;
|
||||
import de.hardcode.jxinput.keyboard.JXKeyboardInputDevice;
|
||||
import de.hardcode.jxinput.virtual.JXVirtualInputDevice;
|
||||
import de.hardcode.jxinput.virtual.VirtualAxis;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Test dialog showing some features of JXInput.
|
||||
* @author Herkules
|
||||
*/
|
||||
public class JXInputTestDialog extends javax.swing.JDialog
|
||||
implements ActionListener
|
||||
{
|
||||
|
||||
private JXKeyboardInputDevice mKeyboardDevice = null;
|
||||
private JXVirtualInputDevice mVirtualDevice = null;
|
||||
|
||||
Button mButtonUp;
|
||||
Button mButtonDown;
|
||||
Button mButtonLeft;
|
||||
Button mButtonRight;
|
||||
Button mButtonFire;
|
||||
Button mButtonSpace;
|
||||
|
||||
/** Creates new form JXInputTestDialog */
|
||||
public JXInputTestDialog(java.awt.Frame parent, boolean modal)
|
||||
{
|
||||
super(parent, modal);
|
||||
initComponents();
|
||||
configureKeyboardInputDevice();
|
||||
configureVirtualInputDevice();
|
||||
initDevicePanels();
|
||||
pack();
|
||||
|
||||
// Request the focus so that the keyboarddevice can work
|
||||
mMainPanel.requestFocus();
|
||||
|
||||
new Timer( 50, this ).start();
|
||||
|
||||
// Uncomment this line as an alternative to the Timer above.
|
||||
// Don't use both!!
|
||||
//JXInputEventManager.setTriggerIntervall( 50 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implement ActionListener#actionPerformed().
|
||||
* This is called by the Timer.
|
||||
*/
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
JXInputManager.updateFeatures();
|
||||
SwingUtilities.invokeLater(
|
||||
new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for ( int i = 0; i < mDevicesTabbedPane.getComponentCount(); ++i )
|
||||
{
|
||||
((JXInputDevicePanel)mDevicesTabbedPane.getComponent( i )).update();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Configure a test JXKeyboardInputdevice.
|
||||
*/
|
||||
void configureKeyboardInputDevice()
|
||||
{
|
||||
mKeyboardDevice = JXInputManager.createKeyboardDevice();
|
||||
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_ESCAPE );
|
||||
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_F1 );
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_F2 );
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_F3 );
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_F4 );
|
||||
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_LEFT );
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_RIGHT );
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_UP );
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_DOWN );
|
||||
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_PAGE_UP );
|
||||
mKeyboardDevice.createButton( KeyEvent.VK_PAGE_DOWN );
|
||||
|
||||
mButtonSpace = mKeyboardDevice.createButton( KeyEvent.VK_SPACE );
|
||||
mButtonLeft = mKeyboardDevice.createButton( KeyEvent.VK_A );
|
||||
mButtonRight = mKeyboardDevice.createButton( KeyEvent.VK_D );
|
||||
mButtonDown = mKeyboardDevice.createButton( KeyEvent.VK_S );
|
||||
mButtonUp = mKeyboardDevice.createButton( KeyEvent.VK_W );
|
||||
|
||||
// Configure it to make it listen to the main panel.
|
||||
// I try to keep the kbd focus on it.
|
||||
mKeyboardDevice.listenTo( mMainPanel );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Configure a test JXVirtualInputdevice.
|
||||
*/
|
||||
void configureVirtualInputDevice()
|
||||
{
|
||||
mVirtualDevice = JXInputManager.createVirtualDevice();
|
||||
|
||||
Button firebutton;
|
||||
//
|
||||
// Remember 'fire' button of first device for use
|
||||
// in the virtual device.
|
||||
// For we ran configureKeyboardInputDevice() before,
|
||||
// getJXInputDevice( 0 ) should not return null
|
||||
//
|
||||
firebutton = JXInputManager.getJXInputDevice( 0 ).getButton( 0 );
|
||||
|
||||
VirtualAxis x = mVirtualDevice.createAxis( Axis.ID_X );
|
||||
x.setButtons( mButtonRight, mButtonLeft );
|
||||
x.setName( "x: A-D" );
|
||||
|
||||
VirtualAxis y = mVirtualDevice.createAxis( Axis.ID_Y );
|
||||
y.setButtons( mButtonUp, mButtonDown );
|
||||
y.setSpringSpeed( 0.0 );
|
||||
y.setName( "y: S|W" );
|
||||
|
||||
VirtualAxis slider = mVirtualDevice.createAxis( Axis.ID_SLIDER0 );
|
||||
slider.setIncreaseButton( mButtonSpace );
|
||||
slider.setTimeFor0To1( 2000 );
|
||||
slider.setName( "<space>" );
|
||||
slider.setType( Axis.SLIDER );
|
||||
|
||||
if ( null != firebutton )
|
||||
{
|
||||
slider = mVirtualDevice.createAxis( Axis.ID_SLIDER1 );
|
||||
slider.setIncreaseButton( firebutton );
|
||||
slider.setTimeFor0To1( 2000 );
|
||||
slider.setName( "JoyButton 0" );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize one panel for each device available.
|
||||
*/
|
||||
void initDevicePanels()
|
||||
{
|
||||
int cnt = JXInputManager.getNumberOfDevices();
|
||||
|
||||
mLabelNoDevice.setVisible( cnt == 0 );
|
||||
mDevicesTabbedPane.setVisible( cnt != 0 );
|
||||
|
||||
for ( int i = 0; i < cnt; ++i )
|
||||
{
|
||||
JXInputDevice dev = JXInputManager.getJXInputDevice( i );
|
||||
if ( null != dev )
|
||||
{
|
||||
//
|
||||
// Setup an own panel for each device.
|
||||
//
|
||||
JPanel panel = new JXInputDevicePanel( dev );
|
||||
mDevicesTabbedPane.addTab( dev.getName(), panel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
|
||||
private void initComponents()
|
||||
{
|
||||
mMainPanel = new javax.swing.JPanel();
|
||||
mLabelNoDevice = new javax.swing.JLabel();
|
||||
mDevicesTabbedPane = new javax.swing.JTabbedPane();
|
||||
mButtonReset = new javax.swing.JButton();
|
||||
|
||||
setTitle("JXInput (C) 2001-2006 HARDCODE Dev.");
|
||||
addWindowListener(new java.awt.event.WindowAdapter()
|
||||
{
|
||||
public void windowClosing(java.awt.event.WindowEvent evt)
|
||||
{
|
||||
closeDialog(evt);
|
||||
}
|
||||
});
|
||||
|
||||
mMainPanel.setLayout(new java.awt.BorderLayout(10, 0));
|
||||
|
||||
mLabelNoDevice.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
mLabelNoDevice.setText("No JXInputDevice available!");
|
||||
mLabelNoDevice.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
mMainPanel.add(mLabelNoDevice, java.awt.BorderLayout.NORTH);
|
||||
|
||||
mDevicesTabbedPane.addFocusListener(new java.awt.event.FocusAdapter()
|
||||
{
|
||||
public void focusGained(java.awt.event.FocusEvent evt)
|
||||
{
|
||||
mDevicesTabbedPaneFocusGained(evt);
|
||||
}
|
||||
});
|
||||
|
||||
mMainPanel.add(mDevicesTabbedPane, java.awt.BorderLayout.CENTER);
|
||||
|
||||
mButtonReset.setText("Reset ");
|
||||
mButtonReset.addActionListener(new java.awt.event.ActionListener()
|
||||
{
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
mButtonResetActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
mMainPanel.add(mButtonReset, java.awt.BorderLayout.SOUTH);
|
||||
|
||||
getContentPane().add(mMainPanel, java.awt.BorderLayout.CENTER);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void mButtonResetActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_mButtonResetActionPerformed
|
||||
{//GEN-HEADEREND:event_mButtonResetActionPerformed
|
||||
|
||||
while ( this.mDevicesTabbedPane.getTabCount() > 0 )
|
||||
this.mDevicesTabbedPane.removeTabAt( 0 );
|
||||
|
||||
JXInputManager.reset();
|
||||
configureKeyboardInputDevice();
|
||||
configureVirtualInputDevice();
|
||||
initDevicePanels();
|
||||
pack();
|
||||
|
||||
// Request the focus so that the keyboarddevice can work
|
||||
mMainPanel.requestFocus();
|
||||
|
||||
}//GEN-LAST:event_mButtonResetActionPerformed
|
||||
|
||||
private void mDevicesTabbedPaneFocusGained(java.awt.event.FocusEvent evt)//GEN-FIRST:event_mDevicesTabbedPaneFocusGained
|
||||
{//GEN-HEADEREND:event_mDevicesTabbedPaneFocusGained
|
||||
// Switch focus back to main panel!
|
||||
this.mMainPanel.requestFocus();
|
||||
}//GEN-LAST:event_mDevicesTabbedPaneFocusGained
|
||||
|
||||
/** Closes the dialog */
|
||||
private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
|
||||
setVisible(false);
|
||||
dispose();
|
||||
System.exit( 0 );
|
||||
}//GEN-LAST:event_closeDialog
|
||||
|
||||
/**
|
||||
* Allow the dialog to run standalone.
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[])
|
||||
{
|
||||
new JXInputTestDialog(new javax.swing.JFrame(), true).setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton mButtonReset;
|
||||
private javax.swing.JTabbedPane mDevicesTabbedPane;
|
||||
private javax.swing.JLabel mLabelNoDevice;
|
||||
private javax.swing.JPanel mMainPanel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user