本文整理汇总了Java中edu.umd.cs.piccolo.PNode.setPickable方法的典型用法代码示例。如果您正苦于以下问题:Java PNode.setPickable方法的具体用法?Java PNode.setPickable怎么用?Java PNode.setPickable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.PNode
的用法示例。
在下文中一共展示了PNode.setPickable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FaucetControlNode
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public FaucetControlNode( int orientation, double maxFlowRate ) {
super();
_listeners = new ArrayList();
_enabled = true;
PNode faucetNode = new FaucetNode( orientation );
faucetNode.setPickable( false );
faucetNode.setChildrenPickable( false );
_sliderNode = new FaucetSliderNode( maxFlowRate, SLIDER_TRACK_SIZE, SLIDER_KNOB_SIZE );
_sliderNode.addFaucetSliderListener( new FaucetSliderListener() {
public void valueChanged() {
if ( _enabled ) {
notifyValueChanged();
}
}
});
addChild( faucetNode );
addChild( _sliderNode );
_sliderNode.setOffset( 26, 0.55 * faucetNode.getFullBoundsReference().getHeight() ); //XXX image specific
}
示例2: ConcentrationController
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private ConcentrationController( TranscriptionFactorConfig transcriptionFactorConfig, IntegerProperty tfLevelProperty, int min, int max ) {
PText caption = new PText( GeneExpressionBasicsResources.Strings.CONCENTRATIONS ) {{
setFont( new PhetFont( 14, false ) );
}};
PNode molecule = new MobileBiomoleculeNode( TRANSCRIPTION_FACTOR_MVT, new TranscriptionFactor( new StubGeneExpressionModel(), transcriptionFactorConfig ) );
molecule.setPickable( false );
molecule.setChildrenPickable( false );
addChild( new VBox( 5,
caption,
molecule,
new HorizontalSliderWithLabelsAtEnds( new UserComponent( UserComponents.transcriptionFactorLevelSlider ),
new IntegerToDoublePropertyWrapper( tfLevelProperty ),
(double) min,
(double) max,
GeneExpressionBasicsResources.Strings.NONE,
GeneExpressionBasicsResources.Strings.LOTS ) ) );
}
示例3: AffinityController
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
AffinityController( PNode leftNode, PNode rightNode, Property<Double> affinityProperty ) {
PText caption = new PText( GeneExpressionBasicsResources.Strings.AFFINITY ) {{
setFont( new PhetFont( 14, false ) );
}};
PNode arrowNode = new DoubleArrowNode( new Point2D.Double( 0, 0 ), new Point2D.Double( ARROW_LENGTH, 0 ), ARROW_HEAD_HEIGHT / 2, ARROW_HEAD_HEIGHT, ARROW_HEAD_HEIGHT / 3 );
arrowNode.setPaint( Color.BLACK );
PNode affinityKey = new HBox( leftNode, arrowNode, rightNode );
affinityKey.setPickable( false );
affinityKey.setChildrenPickable( false );
addChild( new VBox( 5,
caption,
affinityKey,
new HorizontalSliderWithLabelsAtEnds( new UserComponent( UserComponents.transcriptionFactorLevelSlider ),
affinityProperty,
0,
1,
GeneExpressionBasicsResources.Strings.LOW,
GeneExpressionBasicsResources.Strings.HIGH ) ) );
}
示例4: createBucketIcon
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
protected static PNode createBucketIcon( final PieSet state, final F<SliceNodeArgs, PNode> createSliceNode ) {
return new PNode() {{
final int denominator = state.denominator;
for ( int i = 0; i < denominator; i++ ) {
Slice cell = state.sliceFactory.createPieCell( state.pies.length(), 0, i, denominator );
addChild( new PhetPPath( cell.getShape(), Color.white, new BasicStroke( 3 ), Color.black ) );
}
Slice slice = state.sliceFactory.createPieCell( state.pies.length(), 0, 0, denominator );
//Create the slice. Wrap the state in a dummy Property to facilitate reuse of MovableSliceNode code.
//Could be improved by generalizing MovableSliceNode to not require
final PNode node = createSliceNode.f( new SliceNodeArgs( slice, state.denominator, false ) );
node.setPickable( false );
node.setChildPaintInvalid( false );
addChild( node );
//Make as large as possible, but small enough that tall representations (like vertical bars) fit
scale( 0.28 );
}};
}
示例5: createLactoseNode
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* Generate an image of Lactose. This is necessary because Lactose exists
* as a combination of two simple model elements in the model, so there is
* no model element that can be created easily as can be done for the
* simple model elements.
*/
private PNode createLactoseNode(ModelViewTransform2D mvt){
PNode lactoseNode = new PNode();
PNode glucoseNode = new SimpleModelElementNode(new Glucose(), mvt, false);
glucoseNode.setOffset(-glucoseNode.getFullBoundsReference().width / 2, 0);
lactoseNode.addChild(glucoseNode);
PNode galactoseNode = new SimpleModelElementNode(new Galactose(), mvt, false);
galactoseNode.setOffset(galactoseNode.getFullBoundsReference().width / 2, 0);
lactoseNode.addChild(galactoseNode);
lactoseNode.setPickable(false);
lactoseNode.setChildrenPickable(false);
return lactoseNode;
}
示例6: createLactoseNode
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* Generate an image of Lactose. This is necessary because Lactose exists
* as a combination of two simple model elements in the model, so there is
* no model element that can be created easily as can be done for the
* simple model elements.
*/
private PNode createLactoseNode(){
PNode lactoseNode = new PNode();
PNode glucoseNode = new SimpleModelElementNode(new Glucose(), MVT, false);
glucoseNode.setOffset(-glucoseNode.getFullBoundsReference().width / 2, 0);
lactoseNode.addChild(glucoseNode);
PNode galactoseNode = new SimpleModelElementNode(new Galactose(), MVT, false);
galactoseNode.setOffset(galactoseNode.getFullBoundsReference().width / 2, 0);
lactoseNode.addChild(galactoseNode);
lactoseNode.setPickable(false);
lactoseNode.setChildrenPickable(false);
return lactoseNode;
}
示例7: createDnaStrandNode
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* Generate an image of a DNA strand. This is necessary because the DNA
* strand in the model is not implemented as a SimpleModelElement, which
* most of the rest of the things on the legend are. The appearence of
* this strand is, at least in part, manually coordinated with the real
* DNA strand, so if the one in the model changes, this will need to
* change too.
*/
private PNode createDnaStrandNode(){
// Parameters of the DNA strand, adjust as needed in order to alter
// the appearance.
double totalWidth = 40;
double height = 5;
double interStrandOffset = 3;
double numCycles = 3;
double numSamples = 100;
Stroke strandStroke = new BasicStroke(1);
// Create the shapes of the DNA strand.
DoubleGeneralPath strandShape = new DoubleGeneralPath();
strandShape.moveTo(0, 0);
double angleIncrement = Math.PI * 2 * numCycles / numSamples;
for (int i = 0; i < numSamples; i++){
strandShape.lineTo(i * (totalWidth / numSamples), Math.sin(angleIncrement * i) * height);
}
PNode dnaStrandNode = new PNode();
PNode strand1Node = new PhetPPath(strandShape.getGeneralPath(), strandStroke, DnaStrandNode.STRAND_1_COLOR);
strand1Node.setOffset(totalWidth / 2, 0);
dnaStrandNode.addChild(strand1Node);
PNode strand2Node = new PhetPPath(strandShape.getGeneralPath(), strandStroke, DnaStrandNode.STRAND_2_COLOR);
strand2Node.setOffset(totalWidth / 2 + interStrandOffset, 0);
dnaStrandNode.addChild(strand2Node);
dnaStrandNode.setPickable(false);
dnaStrandNode.setChildrenPickable(false);
return dnaStrandNode;
}
示例8: updateLayout
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateLayout() {
iconChildNode.removeAllChildren();
for ( int i = 0; i < getter.get(); i++ ) {
PNode newicon = nodeFactory.createNode();
newicon.setPickable( false );
newicon.setChildrenPickable( false );
newicon.scale( 1.3 );//Make it look a bit bigger
iconChildNode.addChild( newicon );
//put next to the previous one
newicon.setOffset( ( MAX_PARTICLE_WIDTH + HORIZONTAL_SPACING ) * i, 0 );
}
iconChildNode.setOffset( iconX, textNode.getFullBounds().getCenterY() );
}
示例9: setDragRegionPickable
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void setDragRegionPickable( final boolean b ) {
for ( Object child : getChildrenReference() ) {
PNode node = (PNode) child;
if ( node != undoButton ) {
node.setPickable( b );
node.setChildrenPickable( b );
}
}
setChildrenPickable( true );
setPickable( true );
}
示例10: createIcon
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private static PNode createIcon( final PieSet state, final F<SliceNodeArgs, PNode> createSliceNode ) {
return new PNode() {{
Slice slice = state.sliceFactory.createBucketSlice( state.denominator, 0L );
//Create the slice. Wrap the state in a dummy Property to facilitate reuse of MovableSliceNode code.
//Could be improved by generalizing MovableSliceNode to not require
final PNode node = createSliceNode.f( new SliceNodeArgs( slice, state.denominator, false ) );
node.setPickable( false );
node.setChildPaintInvalid( false );
addChild( node );
//Make as large as possible, but small enough that tall representations (like vertical bars) fit
scale( 0.28 );
}};
}
示例11: makeChildrenUnpickable
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void makeChildrenUnpickable( PNode layer ) {
for ( Object node : layer.getChildrenReference() ) {
PNode n = (PNode) node;
n.setPickable( false );
while ( n.getInputEventListeners().length > 0 ) {
n.removeInputEventListener( n.getInputEventListeners()[0] );
}
}
}
示例12: PNodeFacade
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public PNodeFacade( PNode target ) {
addChild( target );
target.setPickable( false );
target.setChildrenPickable( false );
PBounds bounds = target.getFullBounds();
addChild( new PhetPPath( bounds, new Color( 0, 0, 0, 0 ) ) );
}
示例13: NuclearDecayProportionChart
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public NuclearDecayProportionChart( boolean pieChartEnabled, boolean moveablePercentIndicatorEnabled,
boolean showPostDecayCurve, boolean lineGraph ) {
_pieChartEnabled = pieChartEnabled;
_movablePercentIndicatorEnabled = moveablePercentIndicatorEnabled;
_showPostDecayCurve = showPostDecayCurve;
// Many of the following initializations are arbitrary, and the chart
// should be set up via method calls before attempting to display
// anything.
_timeSpan = 1000;
_halfLife = 300;
// Set up the parent node that will contain the non-interactive
// portions of the chart.
_nonPickableChartNode = new PNode();
_nonPickableChartNode.setPickable( false );
_nonPickableChartNode.setChildrenPickable( false );
addChild( _nonPickableChartNode );
// Set up the parent node that will contain the interactive portions
// of the chart.
_pickableChartNode = new PNode();
_pickableChartNode.setPickable( true );
_pickableChartNode.setChildrenPickable( true );
addChild( _pickableChartNode );
// Create the border for this chart.
_borderNode = new PPath();
_borderNode.setStroke( BORDER_STROKE );
_borderNode.setStrokePaint( BORDER_COLOR );
_borderNode.setPaint( NuclearPhysicsConstants.CHART_BACKGROUND_COLOR );
_nonPickableChartNode.addChild( _borderNode );
// Create the graph.
_graph = new GraphNode( this, lineGraph );
_nonPickableChartNode.addChild( _graph );
// Add the pie chart (if enabled).
if ( _pieChartEnabled ) {
_pieChart = new ProportionsPieChartNode( this );
_nonPickableChartNode.addChild( _pieChart );
}
// Create and add the carbon options panel.
_carbonOptionsPanel = new CarbonOptionsPanel( this );
_carbonOptionsPanelPSwing = new PSwing( _carbonOptionsPanel );
_pickableChartNode.addChild( _carbonOptionsPanelPSwing );
// Add the movable percentage indicator (if enabled).
if ( _movablePercentIndicatorEnabled ) {
_movablePercentIndicator = new MovablePercentIndicator( this );
_pickableChartNode.addChild( _movablePercentIndicator );
}
}
示例14: LegendEntry
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public LegendEntry(PNode icon, String captionText) {
this.icon = icon;
icon.setPickable(false);
caption = new HTMLNode(captionText, LABEL_COLOR, LABEL_FONT);
caption.setPickable(false);
}
示例15: PointToolNode
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* This constructor creates a node that is independent of the model.
* This was needed so that we could easily generate images of the point tool, for inclusion in the game reward.
*/
public PointToolNode( Vector2D point, Orientation orientation, Color background ) {
// tool body
bodyNode = new PImage( Images.POINT_TOOL_BODY );
/*
* Pointy tip, separate from the body and not pickable.
* Because Piccolo's picking bounds are rectangular, making the tip pickable made it difficult
* to pick a line manipulator when the tip and manipulator were on the same grid point.
* Making the tip non-pickable was determined to be an acceptable and "natural feeling" solution.
*/
PNode tipNode = new PImage( Images.POINT_TOOL_TIP );
tipNode.setPickable( false );
// background behind the displayed value, shows through a transparent hole in the display area portion of the body image
final int backgroundMargin = 5;
backgroundNode = new PPath( new Rectangle2D.Double( 0, 0,
bodyNode.getFullBoundsReference().getWidth() - ( 2 * backgroundMargin ),
bodyNode.getFullBoundsReference().getHeight() - ( 2 * backgroundMargin ) ) );
backgroundNode.setStroke( null );
backgroundNode.setOffset( bodyNode.getOffset() );
backgroundNode.setPickable( false );
// displayed value
valueNode = new PText( "?" );
valueNode.setFont( new PhetFont( Font.BOLD, 15 ) );
valueNode.setPickable( false );
// rendering order
addChild( tipNode );
addChild( backgroundNode );
addChild( bodyNode );
addChild( valueNode );
// orientation
if ( orientation == Orientation.DOWN ) {
tipNode.setOffset( -tipNode.getFullBoundsReference().getWidth() / 2, -tipNode.getFullBoundsReference().getHeight() );
bodyNode.setOffset( -bodyNode.getFullBoundsReference().getWidth() / 2, tipNode.getFullBoundsReference().getMinY() - bodyNode.getFullBoundsReference().getHeight() );
backgroundNode.setOffset( bodyNode.getXOffset() + backgroundMargin, bodyNode.getYOffset() + backgroundMargin );
valueNode.setOffset( 0, bodyNode.getFullBoundsReference().getMinY() + COORDINATES_Y_CENTER - ( valueNode.getFullBoundsReference().getHeight() / 2 ) );
}
else {
tipNode.rotate( Math.PI );
tipNode.setOffset( tipNode.getFullBoundsReference().getWidth() / 2, tipNode.getFullBoundsReference().getHeight() );
bodyNode.setOffset( -bodyNode.getFullBoundsReference().getWidth() / 2, tipNode.getFullBoundsReference().getMaxY() );
backgroundNode.setOffset( bodyNode.getFullBoundsReference().getMinX() + backgroundMargin, bodyNode.getFullBoundsReference().getMinY() + backgroundMargin );
valueNode.setOffset( 0, bodyNode.getFullBoundsReference().getMaxY() - COORDINATES_Y_CENTER - ( valueNode.getFullBoundsReference().getHeight() / 2 ) );
}
// default state
setCoordinates( point );
setBackground( background );
}