How to draw line to connect components dynamically??

Dear Friends:
I have following code is for drag/drop label, I hope to draw straight line to connect any TWO or more labels within this panel,
[1]. keep all connected line
[2]. can draw dynamically,
I search quite a while with google, still very confused,
Can any guru throw aome light how to do
[1]. code 1:
package swing.dnd;
import java.awt.*;
import javax.swing.*;
public class TestDragComponent extends JFrame {
     public TestDragComponent() {
          super("Test");
          Container c = getContentPane();
          c.setLayout(new GridLayout(1,2));
          c.add(new MoveableComponentsContainer());
          c.add(new MoveableComponentsContainer());
          pack();
          setVisible(true);
     public static void main(String[] args) {
          try {
               UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
          catch (Exception ex) {
               System.out.println(ex);
          new TestDragComponent();
[2]. Code 2:
package swing.dnd;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import java.awt.image.*;
import java.awt.dnd.DragSource;
import java.awt.dnd.DropTarget;
public class MoveableComponentsContainer extends JPanel {     
     public DragSource dragSource;
     public DropTarget dropTarget;
     private static BufferedImage buffImage = null; //buff image
     private static Point cursorPoint = new Point();
     public MoveableComponentsContainer() {
          setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED, Color.white, Color.gray));
          setLayout(null);
          dragSource = new DragSource();
          ComponentDragSourceListener tdsl = new ComponentDragSourceListener();
          dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, new ComponentDragGestureListener(tdsl));
          ComponentDropTargetListener tdtl = new ComponentDropTargetListener();
          dropTarget = new DropTarget(this, DnDConstants.ACTION_MOVE, tdtl);
          setPreferredSize(new Dimension(400,400));
          addMoveableComponents();
     private void addMoveableComponents() {
          MoveableLabel lab = new MoveableLabel("label 1");
          add(lab);
          lab.setLocation(10,10);
          lab = new MoveableLabel("label 2");
          add(lab);
          lab.setLocation(40,40);
          lab = new MoveableLabel("label 3");
          add(lab);
          lab.setLocation(70,70);
          lab = new MoveableLabel("label 4");
          add(lab);
          lab.setLocation(100,100);
     final class ComponentDragSourceListener implements DragSourceListener {
          public void dragDropEnd(DragSourceDropEvent dsde) {
          public void dragEnter(DragSourceDragEvent dsde)  {
               int action = dsde.getDropAction();
               if (action == DnDConstants.ACTION_MOVE) {
                    dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
               else {
                    dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
          public void dragOver(DragSourceDragEvent dsde) {
               int action = dsde.getDropAction();
               if (action == DnDConstants.ACTION_MOVE) {
                    dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
               else {
                    dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
          public void dropActionChanged(DragSourceDragEvent dsde)  {
               int action = dsde.getDropAction();
               if (action == DnDConstants.ACTION_MOVE) {
                    dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
               else {
                    dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
          public void dragExit(DragSourceEvent dse) {
             dse.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
     final class ComponentDragGestureListener implements DragGestureListener {
          ComponentDragSourceListener tdsl;
          public ComponentDragGestureListener(ComponentDragSourceListener tdsl) {
               this.tdsl = tdsl;
          public void dragGestureRecognized(DragGestureEvent dge) {
               Component comp = getComponentAt(dge.getDragOrigin());
               if (comp != null && comp != MoveableComponentsContainer.this) {
                    cursorPoint.setLocation(SwingUtilities.convertPoint(MoveableComponentsContainer.this, dge.getDragOrigin(), comp));
                    buffImage = new BufferedImage(comp.getWidth(), comp.getHeight(), java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE);//buffered image reference passing the label's ht and width
                    Graphics2D graphics = buffImage.createGraphics();//creating the graphics for buffered image
                    graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));     //Sets the Composite for the Graphics2D context
                    boolean opacity = ((JComponent)comp).isOpaque();
                    if (opacity) {
                         ((JComponent)comp).setOpaque(false);                         
                    comp.paint(graphics); //painting the graphics to label
                    if (opacity) {
                         ((JComponent)comp).setOpaque(true);                         
                    graphics.dispose();
                    remove(comp);
                    dragSource.startDrag(dge, DragSource.DefaultMoveDrop , buffImage, cursorPoint, new TransferableComponent(comp), tdsl);     
                    revalidate();
                    repaint();
     final class ComponentDropTargetListener implements DropTargetListener {
          private Rectangle rect2D = new Rectangle();
          Insets insets;
          public void dragEnter(DropTargetDragEvent dtde) {
               Point pt = dtde.getLocation();
               paintImmediately(rect2D.getBounds());
               rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
               ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
               dtde.acceptDrag(dtde.getDropAction());
          public void dragExit(DropTargetEvent dte) {
               paintImmediately(rect2D.getBounds());
          public void dragOver(DropTargetDragEvent dtde) {
               Point pt = dtde.getLocation();
               paintImmediately(rect2D.getBounds());
               rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
               ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
               dtde.acceptDrag(dtde.getDropAction());
          public void dropActionChanged(DropTargetDragEvent dtde) {
               Point pt = dtde.getLocation();
               paintImmediately(rect2D.getBounds());
               rect2D.setRect((int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),buffImage.getWidth(),buffImage.getHeight());
               ((Graphics2D) getGraphics()).drawImage(buffImage,(int) (pt.getX()-cursorPoint.getX()),(int) (pt.getY()-cursorPoint.getY()),MoveableComponentsContainer.this);
               dtde.acceptDrag(dtde.getDropAction());
          public void drop(DropTargetDropEvent dtde) {
               try {
                    paintImmediately(rect2D.getBounds());
                    int action = dtde.getDropAction();
                    Transferable transferable = dtde.getTransferable();
                    if (transferable.isDataFlavorSupported(TransferableComponent.COMPONENT_FLAVOR)) {
                         Component comp = (Component) transferable.getTransferData(TransferableComponent.COMPONENT_FLAVOR);
                         Point location = dtde.getLocation();
                         if (comp == null) {
                              dtde.rejectDrop();
                              dtde.dropComplete(false);
                              revalidate();
                              repaint();
                              return;                              
                         else {                         
                              add(comp, 0);
                              comp.setLocation((int)(location.getX()-cursorPoint.getX()),(int)(location.getY()-cursorPoint.getY()));
                              dtde.dropComplete(true);
                              revalidate();
                              repaint();
                              return;
                    else {
                         dtde.rejectDrop();
                         dtde.dropComplete(false);
                         return;               
               catch (Exception e) {     
                    System.out.println(e);
                    dtde.rejectDrop();
                    dtde.dropComplete(false);
Thanks so much for any help.
Reagrds
sunny

Craig Wood's code here might do what you want
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=2&t=015259

Similar Messages

  • Drawing Line to connect canvas components

    I have drawings on canvas components which I have added to a frame. I would like to connect the drawings in the canvas components using a line to connect the drawings inside the canvas components together. If I draw a line in a new canvas and add this component to the frame, the rectangular background of this canvas will cover part of the drawings of the two canvas components I am trying to connect the line to. Is there a way to create a line component that does what I want?

    just try this:
    1. create a component in which you can put yours different canvases
    2. create an image where you put in the actual display of the component (like a doublebuffer image (offscreenimage))
    3. modifie this image

  • How to draw lines in FCPX ?

    Hi there,
    I would like to have a simple Effects that will draw lines in various shape such as circle, ellipse or rectangle. How do I do it ?
    I need it because I want to have an effect that is drawing an ellipse over the text.
    Any ideas ?
    Thanks

    ok... hmmm...
    You can create control points for a line but you cannot animate the control points in FCPX. If you're okay with that, then here are the basics:
    Create a new top level group. Name it OSCs.
    In the Inspector, select the group and in the Group tab of the inspector, select Fixed Resolution. (It should already be set to 2D - if not - set 2D)
    In the Properties > Timing pane, set the length (Duration) of the group to at least as long as your project. (this step is not important in Motion but absolutely necessary for FCPX!)
    With the new group selected, add the filters you will use as control points. In general, every starts with Filters > Distortion > Poke. You will need two of them. For each Poke filter, select Publish OSC in the inspector. (I recommend renaming each filter - startOSC, endOSC for example.)
    Create another new group.
    Go into the Library > Content and search for Crosshair -- there's three of them, use Crosshair-Minute (they're the smallest ones.) Add two of them. (It's not necessary that they're in their own group -- just more convenient.) Rename the crosshairs: keeping with the OSCs, I recommend start and end, for example.
    Draw a Line.
    To the shape (line), add two Behaviors > Shape > Track Points.
    Rename the Track Points: Start and End.
    In the Behaviors inspector for the Track Points, drag the start Crosshair image into the Source well of the Start track points and the end Crosshair image into the End Track Points. The behavior parameters will change and you'll see a bunch of new stuff. Down at the bottom, you'll see Track 1 and Track 2 — leave one checked for one of the behaviors and the other one checked for the second behavior (that's 1 track 1 and 1 track 2.) You'll also see that the Transform is set to Mimic Source.  What you need to do is click the reset button on the Checked Track of each behavior and THEN change the Transform to Attach to Source. Once you do that, the line ends will snap to crosshair images (use Properties Transform X to move the crosshairs apart temporarily.)
    Next step:
    Select the start crosshair and in the Inspector > Properties, dial down the Position to reveal the XYZ parameters. Right click on the X and select Add Parameter Behavior > Link.  Repeat this step for the Y parameter (you cannot link Position.All for this step.)
    In the Behaviors inspector, for the start crosshair:
          For the Source Object, drag the OSCs group into the well.
    for the X parameter
          For the Source Parameter, set Filters.startOSC.Center.X for the Position.X
                                                 and set Filters.startOSC.Center.Y for the Position.Y
    You will notice the line end disappear off the screen. This is normal. To correct this, at the bottom of each behavior, set the X (or Y) offset to -0.5.
    Repeat for the end crosshair.
    You can turn off the crosshairs (uncheck the layers.)
    To test your OSCs, select *both* startOSC and endOSC (command select each layer) -- both Poke OSCs will appear and you can drag them around the canvas. The line should follow as you would expect if you've set everything up correctly.
    Publish the template.
    A couple of explanations:
    2D fixed resolution for the OSC group:  Groups in Motion that are not fixed resolution can dynamically change their boundaries. There are no fixed points of reference for Motion to calulate. If you forget to set Fixed Resolution, you can repair the condition by setting the Fixed Resolution option and then go into the Filters pane and reset the Center parameters for each Poke OSC.
    Offsets of -0.5:  All resolutions in the Canvas are calculated by the resolution of the X and Y dimensions of the project times the fractional position of objects (from 0.0 on the left side for X and on the bottom for Y — to 1.0 on the right side for X and on the top for Y.) The center of the canvas is 0, 0 in pixels of whatever the resolution is.  To adjust the fractional position used by the OSCs (and others) to the center pixel, the value needs to be moved by 1/2 of that distance.
    Clear as mud?  Once you've done it a few times, it will all become second nature.
    One more thing: you can publish curves... complex ones. But they have to be B-spline (you track all the points in a similar manner outlined above) and not Bezier. There's no way to control the handles for bezier curves.

  • How can I switch the connection pool dynamically during on load happens

    HI,
    I have two data bases which holds same data. i.e Prod_db, Prod_db1,
    I want to switch the connection pool dynamically during load happens
    Ex: During load happens i want to hit prod_db1, after load completes i want to hit prod_db. How to achieve this.

    create dynamic repository variable for DSN using init block so that value is changes based on your timings and use this in connection pool.
    If you use same user and passwords for both the databases that would be easy or else need to follow the same for uid and pwd.
    That should work, if not update.
    If helps pls mark correct/helpful

  • How to draw line with width at my will

    Dear frineds:
    I have following code to draw lines, but I was required:
    [1]. draw this line with some required width such as 0.2 or 0.9 or any width at my will
    [2]. each line after I draw, when I use mouse to click on it, it will be selected and then I can delete it,
    Please advice how to do it or any good example??
    Thanks
    sunny
    package com.draw;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class DrawingArea extends JPanel
         Vector angledLines;
         Point startPoint = null;
         Point endPoint = null;
         Graphics g;
         public DrawingArea()
              angledLines = new Vector();
              setPreferredSize(new Dimension(500,500));
              MyMouseListener ml = new MyMouseListener();
              addMouseListener(ml);
              addMouseMotionListener(ml);
              setBackground(Color.white);
         public void paintComponent(Graphics g)
              // automatically called when repaint
              super.paintComponent(g);
              g.setColor(Color.black);
              g.setFont(getFont());
              AngledLine line;
              if (startPoint != null && endPoint != null)
                   // draw the current dragged line
                   g.drawLine(startPoint.x, startPoint.y, endPoint.x,endPoint.y);
              for (Enumeration e = angledLines.elements(); e.hasMoreElements();)
                   // draw all the angled lines
                   line = (AngledLine)e.nextElement();
                   g.drawPolyline(line.xPoints, line.yPoints, line.n);
         class MyMouseListener extends MouseInputAdapter
              public void mousePressed(MouseEvent e)
                   if (SwingUtilities.isLeftMouseButton(e))
                        startPoint = e.getPoint();
              public void mouseReleased(MouseEvent e)
                   if (SwingUtilities.isLeftMouseButton(e))
                        if (startPoint != null)
                             AngledLine line = new AngledLine(startPoint, e.getPoint(), true);
                             angledLines.add(line);
                             startPoint = null;
                             repaint();
              public void mouseDragged(MouseEvent e)
                   if (SwingUtilities.isLeftMouseButton(e))
                        if (startPoint != null)
                             endPoint = e.getPoint();
                             repaint();
              public void mouseClicked( MouseEvent e )
                   if (g == null)
                        g = getGraphics();
                   g.drawRect(10,10,20,20);
         class AngledLine
              // inner class for angled lines
              public int[] xPoints, yPoints;
              public int n = 2;
              public AngledLine(Point startPoint, Point endPoint, boolean left)
                   xPoints = new int[n];
                   yPoints = new int[n];
                   xPoints[0] = startPoint.x;
                   xPoints[1] = endPoint.x;
                   yPoints[0] = startPoint.y;
                   yPoints[1] = endPoint.y;
                   /*if (left)
                        xPoints[1] = startPoint.x;
                        yPoints[1] = endPoint.y;
                   else
                        xPoints[1] = endPoint.x;
                        yPoints[1] = startPoint.y;
         public static void main(String[] args)
              JFrame frame = new JFrame("Test angled lines");
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              DrawingArea d = new DrawingArea();
              frame.getContentPane().add( d );
              frame.pack();
              frame.setVisible(true);
    }Message was edited by:
    sunnymanman

    sonudevgan wrote:
    dear piz tell me how i can read integer from user my email id is [email protected]
    foolish, foolish question

  • How to draw line on SAP form

    Hi everyone,
    Who have a good way to draw lines on SAP form?
    I created a Wizard form, and use Rectangle (Height=0) as the two lines between title and bottom button, but I met a problem, when show another form which cover the line, after close this form, some part of lines disappear, I have tried using SAP form refresh, it still can not restore showing line completely, who have good way to workaround the problem or give me another way to draw line.
    Thanks in advance!
    Kathy

    The only way I found to get a form looking really close to a standard B1 Wizard form is to use bitmaps.  I use 3 - one each for the top, bottom and left hand side.  The bitmaps include the line drawing and appropriate pictures/background colours.  I normally define these in the XML used to create the form as in the following example:-
    <item uid="PTOP" type="117" left="0" width="566" top="0" height="80" visible="1" enabled="1" from_pane="0" to_pane="0">
            <AutoManagedAttribute/>
            <specific picture="AZU_SPC_WIZ_TOP2.bmp">
                    <databind databound="0" table="" alias=""/>
            </specific>
    </item>
    <item uid="PBOT" type="117" left="0" width="566" top="336" height="40" visible="1" enabled="1" from_pane="0" to_pane="0">
            <AutoManagedAttribute/>
            <specific picture="AZU_SPC_WIZ_BOT.bmp">
                    <databind databound="0" table="" alias=""/>
            </specific>
    </item>
    <item uid="PLEFT" type="117" left="0" width="100" top="0" height="336" visible="1" enabled="1" from_pane="1" to_pane="1">
            <AutoManagedAttribute/>
            <specific picture="AZU_SPC_WIZ9.bmp">
                    <databind databound="0" table="" alias=""/>
            </specific>
    </item>
    John.

  • How to create a data connection with dynamic XML file?

    Thanks for all reply first!
    I have formatted the submitted data into an XML file on the server side,this file can be import to PDF form correctly.
    I try to send this XML file to the user to let him can review what he has submitted.
    I guess that I should create a data connection to the XML file so that it can be reviewed by the user.
    But the question is that the XML file is dynamic generated.
    How can i do?
    give me some clus or examples,please.
    thanks,
    Jasper.

    Hi Jasper,
    To show user back the result, you can use PDF instead of XML. You can store the PDF template in server and you can merge XML data with PDF template by Livecycle Form Data Integration service.
    We, as KGC, can generate huge number of Adobe Livecycle forms in small periods. Also we give consultancy on Adobe Livecycle ES products and Adobe Livecyle Designer. In case of any need, do not hesitate to contact us.
    Asiye Günaydın
    Project Consultant
    KGC Consulting Co.
    www.kgc.com.tr

  • HELP!!! Begginer working with a Swing Applet. DON'T KNOW HOW TO DRAW LINE

    Hi! I've been trying to draw a line in an applet and I can't. The thing is I'm using the tutorial to create the applet, so it comes with the standart methos and the standalone. I'm not sure if the problem is becausse I need to include in it a paint method or something.
    What I'm trying to do is to connect the to blocks (they really are jButtons), with an arrow. Thanks!!!!!!!!!
    Here's my code so far...// Copyright (c) 2000
    package package14;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import oracle.jdeveloper.layout.*;
    * Applet
    * <P>
    * @author Ana M Yanes Benatuil
    public class Appletboxes extends JApplet {
    boolean isStandalone = false;
    XYLayout xYLayout1 = new XYLayout();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    * Constructs a new instance.
    * getParameter
    * @param key
    * @param def
    * @return java.lang.String
    public String getParameter(String key, String def) {
    if (isStandalone) {
    return System.getProperty(key, def);
    if (getParameter(key) != null) {
    return getParameter(key);
    return def;
    public Appletboxes() {
    * Initializes the state of this instance.
    * init
    public void init() {
    try {
    jbInit();
    catch (Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception {
    this.getContentPane().setLayout(xYLayout1);
    this.setSize(new Dimension(836, 545));
    jButton1.setText("jButton1");
    jButton2.setText("jButton2");
    jButton2.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
    public void mouseDragged(MouseEvent e) {
    jButton2_mouseDragged(e);
    jButton1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
    public void mouseDragged(MouseEvent e) {
    jButton1_mouseDragged(e);
    this.getContentPane().add(jButton1, new XYConstraints(137, 120, 96, 45));
    this.getContentPane().add(jButton2, new XYConstraints(452, 118, 96, 49));
    * start
    public void start() {
    * stop
    public void stop() {
    * destroy
    public void destroy() {
    * getAppletInfo
    * @return java.lang.String
    public String getAppletInfo() {
    return "Applet Information";
    * getParameterInfo
    * @return java.lang.String[][]
    public String[][] getParameterInfo() {
    return null;
    * main
    * @param args
    public static void main(String[] args) {
    Appletboxes applet = new Appletboxes();
    applet.isStandalone = true;
    JFrame frame = new JFrame();
    frame.setTitle("Applet Frame");
    frame.getContentPane().add(applet, BorderLayout.CENTER);
    applet.init();
    applet.start();
    frame.setSize(400, 420);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
    frame.setVisible(true);
    frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });
    static {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch(Exception e) {
    e.printStackTrace();
    void jButton1_mouseDragged(MouseEvent e) {
    jButton1.setLocation(e.getX() + jButton1.getX() , e.getY() + jButton1.getY());
    void jButton2_mouseDragged(MouseEvent e) {
    jButton2.setLocation(e.getX() + jButton2.getX() , e.getY() + jButton2.getY());

    The other thing is that the boxes can be dragged and dropped, so the lines would have to be moved too (if they're related to the moved blocks)

  • How to draw line of best fit?

    Hey all,
    I am trying to draw a line of best fit with the scattered points being displayed as well. I have attached my VI below and tried all sorts of methods,
    but to no avail. I am aware that there is a 'liner fit.vi' which I tried, but it did not give me what I wanted. In fact the line wasn't best fit at all.
    I hope someone could help me as I'm new to LabVIEW.
    Thanks in advance!
    Cheers,
    Ruben 
    Attachments:
    Weibull LabVIEW Plot_Valve Spring.vi ‏15 KB

    Hi Ruben
    The Linear Fit.vi should provide the results you require.  Check the attachment for an edited version of your code.  Does this solve your problem?  You can check the help file for advice on using different fitting techniques, setting tolerances and weightings.
    Regards,
    Peter D
    Attachments:
    EDIT_Weibull LabVIEW Plot_Valve Spring.vi ‏23 KB

  • How to draw line art on a panel?

    I've spent a bit of time trying to figure out where to start, and come up with nothing, so.....
    ..... In CS6 I'm looking to put the equivalent of a C# picturebox onto a plugin panel to act as a thumbnail of sorts.  Within the picturebox the plugin would draw some lineart that would represent some properties of the original artwork that are of interest to the user.
    Is there a specific SDK suite that comes anywhere close to giving me some of that functionality?

    http://www.java2s.com/ExampleCode/2D-Graphics/Line.htm

  • How to draw Line Chart in SAP?

    There is a request that the customer want to see Line Chart in the report.
    Is it possible to do it using abap?
    Thank you very much.

    Hi,
    Yes it is possible.
    GOto Tcode SE83>Expand graphics node>double click on that
    you will get all graphic programs.

  • How to draw line in Text Box of crystal report

    Dear all expert,
    i have develop a crystal report, i need to underline the field heading. what i had done is, CTRL+U and edit my heading text. But it only underline what i type, the rest of the blank area of the field heading was not underline. how can i overcome this issues?
    Thank You.

    Hi,
    Instead of 'ctrl + u' the field, right click your text object, format text -> border -> enable the bottom with single
    Thx,
    Hao

  • How to draw white border(only corner) lines around camera view finder

    Hi. You know those white corner lines around the camera view that is found on most camera apps, how do I draw those lines around the camera view? I'm developing a video camera app and now I want to draw those lines to indicate where the camera view finder
    is. The white line starts at the top left corner of the camera view(horizontal) then stops about one quarter and starts again at the other side(top right). The same at left, right and bottom side. It shouldn't be a full square/rectangle just the corners. I
    think you understand what I'm talking about now. How can I draw just "video camera corner lines"? After this question I want to ask you how to change the resolution like to 176*220, 240*320 ect and what the available resolutions is for capturing
    video-clips. For now just the white corner lines of camera view. Thanks in advance:-)

    How do I draw lines and shapes on top of the camera view finder(cvf)?
    +how do I show the battery life bar on cvf?
    +how do I programmatically add text on the cvf?
    +how do I make a connection request? (connect to a URL)?
    +how do I change the resolution of the video camera? What is the acceptable values for resolution?
    +how do I listen for touch events on the cvf?
    Thanks

  • How to make lines I draw as an objects??

    Hi friends:
    I met a problem here, I find a similiar code below, but cannot solve it.
    How to make lines I draw as objects in this application??
    ie the lines I draw will be selectable as other JLabels, can be highlighted, can be deleted etc, just like any other components or object,
    How to do this??
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.util.Vector;
    import java.lang.reflect.Array;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Drawines
         public static void main(String[] args)
            JFrame f = new JFrame("Draw Lines");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new ConnectionPanel());
            f.setSize(400,300);
            f.setLocation(200,200);
            f.setVisible(true);
    class Drawines extends JPanel
        JLabel                                       label1, label2, label3, label4;
        JLabel[]                       labels;
        JLabel                                       selectedLabel;
        protected              JButton btn            = new JButton("DrawLines");
        protected              JButton btn1           = new JButton("Clear");
        protected              JButton btn2           = new JButton("No Draw");
        protected                      boolean isActivated = false;
        protected           int      stoppoint     = 0;          
        int cx, cy;
        Vector order                     = new Vector();
        Vector order1                     = new Vector();
        Object[] arr                    = null;
        public ConnectionPanel()
            setLayout(null);
            addLabels();
            label1.setBounds( 25,  50, 125, 25);
            label2.setBounds(225,  50, 125, 25);
            label3.setBounds( 25, 175, 125, 25);
            label4.setBounds(225, 175, 125, 25);
            btn.setBounds(10, 5, 100, 25);
            btn1.setBounds(100, 5, 100, 25);
            btn2.setBounds(200, 5, 100, 25);
                add(btn);
             add(btn1);
             add(btn2);
            determineCenterOfComponents();
            ComponentMover mover = new ComponentMover();
             ActionListener lst = new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                     ComponentMover mover = new ComponentMover();
                           addMouseListener(mover);
                           addMouseMotionListener(mover);
                           isActivated = false;
            ActionListener lst1 = new ActionListener() {
                       public void actionPerformed(ActionEvent e) {
                           isActivated=true;
              btn.addActionListener(lst);
              btn1.addActionListener(lst1);
        public void paintComponent(final Graphics g)
             super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
             Point[] p;
                System.out.println("order.size()"+ order.size());
                System.out.println("order1.size()"+ order1.size());
                     if (!isActivated && order1.size()==0) {
                         for(int i = 0 ; i < order.size()-1; i++) {
                                JLabel l1 = (JLabel)order.elementAt(i);
                               JLabel l2 = (JLabel)order.elementAt(i+1);
                               order1.add(order.elementAt(i));
                               order1.add(order.elementAt(i+1));
                               System.out.println();
                               p = getCenterPoints(l1, l2);
                               g2.setColor(Color.black);
                                            g2.draw(new Line2D.Double(p[0], p[1]));            
                     }else if(!isActivated && order1.size()>0){
                             order=order1;
                         for(int i1 = 0 ; i1 < order.size()-1; i1++) {
                               JLabel l1 = (JLabel)order.elementAt(i1);
                               JLabel l2 = (JLabel)order.elementAt(i1+1);
                               System.out.println();
                               p = getCenterPoints(l1, l2);
                               g2.setColor(Color.red);
                                g2.draw(new Line2D.Double(p[0], p[1]));    
                                System.out.println(" order1.size() = " + order.size());
                     }else {
                          order1 = order;
                         for(int i1 = 0 ; i1 < order1.size()-1; i1++) {
                                    JLabel l1 = (JLabel)order1.elementAt(i1);
                                    JLabel l2 = (JLabel)order1.elementAt(i1+1);
                                    p = getCenterPoints(l1, l2);
                                    g2.setColor(Color.blue);
                                    if (order.elementAt(i1) !=null){
                                         g2.draw(new Line2D.Double(p[0], p[1]));    
        private Point[] getCenterPoints(Component c1, Component c2)
            Point
                p1 = new Point(),
                p2 = new Point();
            Rectangle
                r1 = c1.getBounds(),
                r2 = c2.getBounds();
                 p1.x = r1.x + r1.width/2;
                 p1.y = r1.y + r1.height/2;
                 p2.x = r2.x + r2.width/2;
                 p2.y = r2.y + r2.height/2;
            return new Point[] {p1, p2};
        private void determineCenterOfComponents()
            int
                xMin = Integer.MAX_VALUE,
                yMin = Integer.MAX_VALUE,
                xMax = 0,
                yMax = 0;
            for(int i = 0; i < labels.length; i++)
                Rectangle r = labels.getBounds();
    if(r.x < xMin)
    xMin = r.x;
    if(r.y < yMin)
    yMin = r.y;
    if(r.x + r.width > xMax)
    xMax = r.x + r.width;
    if(r.y + r.height > yMax)
    yMax = r.y + r.height;
    cx = xMin + (xMax - xMin)/2;
    cy = yMin + (yMax - yMin)/2;
    private class ComponentMover extends MouseInputAdapter
    Point offsetP = new Point();
    boolean dragging;
    public void mousePressed(MouseEvent e)
    Point p = e.getPoint();
    for(int i = 0; i < labels.length; i++)
    Rectangle r = labels[i].getBounds();
    if(r.contains(p) && !isActivated )
    selectedLabel = labels[i];
    order.addElement(labels[i]);
    offsetP.x = p.x - r.x;
    offsetP.y = p.y - r.y;
    dragging = true;
    repaint(); //added
    break;
    public void mouseReleased(MouseEvent e)
    dragging = false;
    public void mouseDragged(MouseEvent e)
    if(dragging)
    Rectangle r = selectedLabel.getBounds();
    r.x = e.getX() - offsetP.x;
    r.y = e.getY() - offsetP.y;
    selectedLabel.setBounds(r.x, r.y, r.width, r.height);
    //determineCenterOfComponents();
    repaint();
    private void addLabels()
    label1 = new JLabel("Label 1");
    label2 = new JLabel("Label 2");
    label3 = new JLabel("Label 3");
    label4 = new JLabel("Label 4");
    labels = new JLabel[] {
    label1, label2, label3, label4
    for(int i = 0; i < labels.length; i++)
    labels[i].setHorizontalAlignment(SwingConstants.CENTER);
    labels[i].setBorder(BorderFactory.createEtchedBorder());
    add(labels[i]);
    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    2 choice, bundle your app in a jar, or get a native compiler.
    executable jar
    http://java.sun.com/j2se/1.3/docs/guide/jar/jarGuide.html
    http://developer.java.sun.com/developer/qow/archive/21/index.html
    native
    http://gcc.gnu.org/java/
    http://www-106.ibm.com/developerworks/library/j-native.html
    http://icafe.sourceforge.net/
    http://www.towerj.com/
    http://www.xlsoft.com/en/products/development/jet/jetpro.html

  • How to draw a line on chart

    Hi all,
    I am working on a chart in Design studio on BI platform. The following screen
    shot will depict the current state of my chart-
    Now
    I need to draw lines of different lengths and colors with certain distance from
    X-axis, as shown below. (I drew those lines on a screen shot of my chart with
    the help of MS paint
    but
    I need to do this with the help of design studio) . Basically I need help to
    get the following output in design studio. So, question is HOW TO DRAW A LINE
    IN DESIGN STUDIO?
    Kindly,
    help with this.
    Please suggest me to get the output.
    Thanks and Regards.
    Rakesh.

    Hi Tammy,
    Thanks for ur reply.
    I'm using DS 1.3. and no need of dynamic changes of line on chart.
    I just now gone through with CSS, but i didnt get the solution. i think somewhere im getting stuck with CSS.
    Can u please suggest me the step by step procedure to draw a line using CSS.
    Kindly help on this.
    Thanks and Regards,
    Rakesh

Maybe you are looking for

  • Itunes 11.0.2.26

    Dear Friends I have recently updated my itunes 11.0.2.26 When I get apps or update my previous apps from App Store with my iPad and I want to sync my iPad to my PC ( Windows 7) the new apps and updated ones won't transfer to my pc folder. it means if

  • PSE 7 Win Vista x64:  Scanner no longer works after reinstall

    Hello, I was using my Kodak i1220 scanner no problem in Adobe Photoshop Elements 7 on Windows Vista Ultimate x64 SP1 for several months (prior to that, I had been using PSE 6 with no issues). Recently I did a clean install of Windows. I loaded Photos

  • BOR or CLASS for Document Management Service (not SAP DMS for PLM)

    Hi All, Does anyone know if there is already a BOR or CLASS that can be used in Workflow that works with the Document Management Service?  This is in reference to the diagram displayed in the following link http://help.sap.com/saphelp_crm40/helpdata/

  • Issue with the variable assignment in th Bex broadcaster

    hi , i am working on Bex broadcaster . while creating a setting for a report, in the variable assignment under the General precalculation tab, the value given is not getting transferred. i tried it in development portal its working fine. do anyone ha

  • SAP SD CIN Query- 6

    Hi Is there any standard working scenario (approach) for any particular list of movement types which are required (configured) only for updating RG1 register(J1I5) and other set of movement types which are for updating RG23 A & C? or any common movem