JGraph

qairo Messages postés 4 Date d'inscription samedi 10 novembre 2007 Statut Membre Dernière intervention 16 avril 2008 - 3 avril 2008 à 20:49
hindosasi Messages postés 2 Date d'inscription vendredi 18 mai 2012 Statut Membre Dernière intervention 3 juillet 2012 - 3 juil. 2012 à 12:03
bonjour,

mon problème et que j'ai crée class rectangle à l'aide de la bibliothèque JGraph.

import java.awt.*;

import java.awt.geom.Rectangle2D;


import javax.swing.*;


import org.jgraph.JGraph;

import org.jgraph.graph.DefaultEdge;

import org.jgraph.graph.DefaultGraphCell;

import org.jgraph.graph.DefaultGraphModel;

import org.jgraph.graph.GraphConstants;

import org.jgraph.graph.GraphModel;


public class rectangle {

public rectangle(){}

public static DefaultGraphCell attaque (String name, double x,

double y, double w, double h, Color bg, boolean raised ) {


// Create vertex with the given name

DefaultGraphCell cell = new DefaultGraphCell(name);


// Set bounds

GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(

x, y, w, h));


// Set fill color

if (bg != null) {

GraphConstants.setGradientColor(cell.getAttributes(), bg);

GraphConstants.setOpaque(cell.getAttributes(), true);

}


// Set raised border

if (raised)

GraphConstants.setBorder(cell.getAttributes(), BorderFactory

.createRaisedBevelBorder());

else

// Set black border

GraphConstants.setBorderColor(cell.getAttributes(), Color.black);


// Add a Floating Port

cell.addPort();


return cell;


}

}

et je veux faire appel à elle dans class Attaque

*****claase Attaque*****

import java.awt.*;

import java.awt.geom.Rectangle2D;


import javax.swing.*;


import org.jgraph.JGraph;

import org.jgraph.graph.DefaultEdge;

import org.jgraph.graph.DefaultGraphCell;

import org.jgraph.graph.DefaultGraphModel;

import org.jgraph.graph.GraphConstants;

import org.jgraph.graph.GraphModel;


public class Attaque


{

public static void main (String args[])

{


// Construct Model and Graph

GraphModel model = new DefaultGraphModel();

JGraph graph = new JGraph(model);


// Control-drag should clone selection

graph.setCloneable(false);


// Enable edit without final RETURN keystroke

graph.setInvokesStopCellEditing(true);


// When over a cell, jump to its default port (we only have one, anyway)

graph.setJumpToDefaultPort(true);


// Insert all three cells in one call, so we need an array to store them


// Create Hello Vertex

rectangle c = new rectangle();

DefaultGraphCell cells = new DefaultGraphCell();

cells = c.attaque("Hello", 140, 140, 40, 140, Color.BLUE, false);


// Insert the cells via the cache, so they get selected

graph.getGraphLayoutCache().insert(cells);


// Show in Frame

JFrame frame = new JFrame();

frame.getContentPane().add(new JScrollPane(graph));

//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.pack();

frame.setVisible(true);


}


}


voila ce qu'ils affiche comme erreur


C:\Documents and Settings\bonbino\Bureau\toto>javac -classpath jgraph.jar Attaque.java

Attaque.java:38: cannot find symbol

symbol : class rectangle

location: class Attaque

rectangle c = new rectangle();

^

Attaque.java:38: cannot find symbol

symbol : class rectangle

location: class Attaque

rectangle c = new rectangle();

^

2 errors


je n'arrive pas à comprendre, ils sont dans le même dossier

je travaille avec Crimson Editor

pouvez vous recompilez peut être quellequ'un d'entre vous peu la détecter je serais reconnaissant

2 réponses

hindosasi Messages postés 2 Date d'inscription vendredi 18 mai 2012 Statut Membre Dernière intervention 3 juillet 2012
3 juil. 2012 à 12:01
chof a wldi kamlin wa7lin f7alk mmkin chi 7d ykon 3ndo m3a Jgraph y3awnnna stpp
0
hindosasi Messages postés 2 Date d'inscription vendredi 18 mai 2012 Statut Membre Dernière intervention 3 juillet 2012
3 juil. 2012 à 12:03
je veux agrandir la taille d'une cellule Jgraph pour etre automatiquement selon le texte integré mercii c urgent
0
Rejoignez-nous