View Full Version : سوال: چگونه در netbeans زوم کنیم؟
haj_hadi
چهارشنبه 20 شهریور 1387, 23:44 عصر
چگونه در netbeans یک عکس را زوم کنیم؟
مثلا برای برنامه نقشه
haj_hadi
شنبه 23 شهریور 1387, 16:43 عصر
بابا یه نفر جواب بده دیگه یعنی هیچکس نمیدونه؟؟؟؟
noorsoft
یک شنبه 24 شهریور 1387, 09:23 صبح
Scene scene = new Scene ();
JComponent sceneView = scene.createView ();
JScrollPane panel = new JScrollPane (sceneView);
JDialog dia = new JDialog (new JDialog (), true);
dia.add (panel, BorderLayout.CENTER);
dia.setSize (800, 600);
dia.setVisible (true);
dia.dispose ();
scene.setLayout (SerialLayout.getVerticalLayout ());
ImageWidget image = new ImageWidget (scene);
image.setImage (Utilities.loadImage ("/path/to/image.png"));
scene.addChild (image):
LabelWidget label = new LabelWidget (scene);
label.setText ("My Image Text");
scene.addChild (label);
widget.getActions ().addAction (new MoveAction ());
scene.getActions ().addAction (new ZoomAction ());
scene.getActions ().addAction (new PanAction ());
ConnectionWidget connection = new ConnectionWidget (scene);
connection.setSourceAnchor (new RectangleEdgeAnchor (sourceWidget));
connection.setTargetAnchor (new RectangleEdgeAnchor (targetWidget));
public class StringGraphScene extends GraphScene<String, String, NodeController.StringNode, EdgeController.StringEdge> {
private Widget mainLayer;
private Widget connectionLayer;
private MoveAction moveAction = new MoveAction ();
public StringGraphScene () {
mainLayer = new Widget (this);
connectionLayer = new Widget (this);
addChild (mainLayer);
addChild (connectionLayer);
}
protected NodeController.StringNode attachNodeController (String node) {
UMLClassWidget widget = new UMLClassWidget (this);
widget.setClassName ("Class" + node);
widget.getActions ().addAction (moveAction);
mainLayer.addChild (widget);
return new NodeController.StringNode (node, widget);
}
protected EdgeController.StringEdge attachEdgeController (String edge) {
ConnectionWidget connectionWidget = new ConnectionWidget (this);
connectionLayer.addChild (connectionWidget);
return new EdgeController.StringEdge (edge, connectionWidget);
}
protected void attachEdgeSource (EdgeController.StringEdge edgeController, NodeController.StringNode sourceNodeController) {
((ConnectionWidget) edgeController.getMainWidget ()).setSourceAnchor (new RectangleEdgeAnchor (sourceNodeController.getMainWidget ()));
}
protected void attachEdgeTarget (EdgeController.StringEdge edgeController, NodeController.StringNode targetNodeController) {
((ConnectionWidget) edgeController.getMainWidget ()).setTargetAnchor (new RectangleEdgeAnchor (targetNodeController.getMainWidget ()));
}
}
scene.setZoomFactor (2.0);
Point localLocation = ...; // use "new Point ()" for the origin of the local coordination system
Point sceneLocation = widget.convertLocalToScene (localLocation);
Point viewLocation = scene.convertSceneToView (sceneLocation);
Point screenLocation = SwingUtilities.convertPointToScreen (viewLocation, scene.getComponent ());
Rectangle localRectangle = ...; // use "widget.getBounds ()" for the widget bounds in the local coordination system
Rectangle sceneRectangle = widget.convertLocalToScene (localRectangle);
Rectangle viewRectangle = scene.convertSceneToView (sceneRectangle);
Point viewLocation = ...;
Point sceneLocation = scene.convertViewToScene (viewLocation);
Point localLocation = widget.convertSceneToLocal (sceneLocation);
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.