Login | Register
My pages Projects Community openCollabNet

Discussions > dev > RE: how to change background?

gef
Discussion topic

Back to topic list

RE: how to change background?

Reply

Author "Christensen, Blake" <Blake dot Christensen at dsionline dot com>
Full name "Christensen, Blake" <Blake dot Christensen at dsionline dot com>
Date 2002-08-21 08:28:13 PDT
Message I changed the background color by editing Editor.java changing:

  protected void defineLayers(GraphModel gm, Layer lay) {
    _layerManager.addLayer(new LayerGrid());
    _layerManager.addLayer(new LayerPageBreaks());
    // the following line is an example of another "grid"
    //_layerManager.addLayer(new LayerPolar());
    if (lay != null) _layerManager.addLayer(lay);
    else if (gm == null) _layerManager.addLayer(new
LayerDiagram("Example"));
    else _layerManager.addLayer(new LayerPerspective("untitled", gm));
  }

to:

  protected void defineLayers(GraphModel gm, Layer lay) {
    _layerManager.addLayer(new LayerGrid(Color.gray​,Color.white,16,fals​e));
// <<<<<
    _layerManager.addLayer(new LayerPageBreaks());
    // the following line is an example of another "grid"
    //_layerManager.addLayer(new LayerPolar());
    if (lay != null) _layerManager.addLayer(lay);
    else if (gm == null) _layerManager.addLayer(new
LayerDiagram("Example"));
    else _layerManager.addLayer(new LayerPerspective("untitled", gm));
  }

This doesn't allow for any dynamic color changes obviously.

> -----Original Message-----
> From: A dot S dot P dot Bagehot at hw dot ac dot uk [mailto:A dot S dot P dot Bagehot at hw dot ac dot uk]
> Sent: Wednesday, August 21, 2002 10:11 AM
> To: dev at gef dot tigris dot org
> Subject: Re: how to change background?
>
>
> Hi Martin,
>
> I tried that but it didn't work. Think the method is right but I got a
> line
> wrong somewhere.
>
> something like:
>
> LayerManager lm = myFooEditor.getLayerManager();
> Layer gridLayer = lm.getLayerNamed("Grid");
> gridLayer = new GridLayer(Color.lightGray /* grid points */,
> Color.white /* backgorund */,
> 16 /*spacing */,
> true/ false /* can't remember last arg !
> */);
>
> cheers,
> Alex
>
> Martin Ginkel wrote:
> >
> > On 21-Aug-2002 A dot S dot P dot Bagehot at hw dot ac dot uk wrote:
> > > Hi,
> > >
> > > how do you change the background color in a JGraph? Ie.
> in any diagram.
> > > It appears to be painted in the GridLayer, which has a _bgColor
> >
> > Yepp!
> > from LayerGrid:
> >
> > /** Paint lines on the given Graphics. */
> > private void paintLines(Graphics g, boolean paintBackground) {
> > Rectangle clip = g.getClipBounds();
> > if (paintBackground) {
> > g.setColor(_bgColor);
> > g.fillRect(clip.x, clip.y, clip.width, clip.height);
> > }
> > ...
> > }
> >
> > > attribute, but I can't locate the code to change it!
> >
> > since _bgColor is protected, I think there is no way
> besides creating a
> > new LayerGrid() and adding it to the LayerManager. There is
> currently no
> > setter for _bgColor, only the Constructor allows to change it.
> > Perhaps you supply a patch. The setup of the default Layers
> happens in
> > the Editor now.
> >
> > Martin
> >
> > --
> > +-[Martin
> Ginkel]-------------​-[mailto:ginkel(at)m​pi-magdeburg.mpg.de]​-+
> > | MPI Magdeburg, Zi S2.09 Sandtorstr. 1, D-39106
> Magdeburg, Germany |
> > | Q: How do you save a drowning lawyer? A: Throw him a
> rock. |
> > +-[tel/fax: +49 391 6110
> 482/529]----[http://www.mpi-magde​burg.mpg.de]-+
> >
> >
> --------------------​--------------------​--------------------​---------
> > To unsubscribe, e-mail: dev-unsubscribe at gef dot tigris dot org
> > For additional commands, e-mail: dev-help at gef dot tigris dot org
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: dev-unsubscribe at gef dot tigris dot org
> For additional commands, e-mail: dev-help at gef dot tigris dot org
>



---------- Internet E-mail Confidentiality Disclaimer ----------

PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message. If
you are not the addressee indicated in this message or the employee or agent
responsible for delivering it to the addressee, you are hereby on notice
that you are in possession of confidential and privileged information. Any
dissemination, distribution, or copying of this e-mail is strictly
prohibited. In such case, you should destroy this message and kindly notify
the sender by reply e-mail. Please advise immediately if you or your
employer do not consent to Internet email for messages of this kind.

Opinions, conclusions, and other information in this message that do not
relate to the official business of my firm shall be understood as neither
given nor endorsed by it.



--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: dev-unsubscribe at gef dot tigris dot org
For additional commands, e-mail: dev-help at gef dot tigris dot org

« Previous message in topic | 1 of 2 | Next message in topic »

Messages

Show all messages in topic

RE: how to change background? "Christensen, Blake" <Blake dot Christensen at dsionline dot com> "Christensen, Blake" <Blake dot Christensen at dsionline dot com> 2002-08-21 08:28:13 PDT
     RE: how to change background? Martin Ginkel <ginkel at mpi-magdeburg dot mpg dot de> Martin Ginkel <ginkel at mpi-magdeburg dot mpg dot de> 2002-08-21 08:34:22 PDT
Messages per page: