Drawing fading line
Hello everyone!
I am trying to draw a fading line on a desktop. For example: we have a JFrame instance on the screen, when we press right mouse button over the frame and drag the mouse across the screen, I want to draw a line, fading through time. I don't want to restrict the line in the JFrame bounds, instead I want to draw it on the desktop screen.
Any tips or tricks. Thanks in advance.
If you don't want to restrict the line to a single JFrame, I believe the JLayeredPane is for you. It allows you to have a transparent pane which overlays multiple Swing components.
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JLayeredPane.html
Similar Messages
-
How to draw multiple lines on same panel??
hiya
i would like to know how can I draw multiple lines on the same panel ?? I have already use repaint(); but it just come out the lastest line (say line 3) i draw .......those previous lines(say line 1 and 2) are disappear ........
Thanks for your help matehttp://www.java2s.com/ExampleCode/2D-Graphics/Line.htm
-
How to draw horizontal line in smartform after end of the all line items
Hi Friends,
I am working on the smartform. I have created TABLE node in Main window.
i want to draw a horizontal line after end of the main window table node. i mean after printing all the line items of the table, I need to print one horizontal line.
Could you please help me how to resolve this issue.
FYI: I tried with the below two options. But no use.
1. desinged footer area in the table node of the main window.
2. tried with uline and system symbols.
please correct me if i am wrong. please explain in detail how to draw horizontal line after end of the main window table.
this is very urgent.
Thanks in advance
Regards
RaghuHello Valter Oliveira,
Thanks for your answer. But I need some more detail about blank line text. i.e thrid point.
Could you please tell me how to insert blank line text.
1 - in your table, create a line type with only one column, with the same width of the table
2 - in table painter, create a line under the line type
3 - insert a blank line text in the footer section with the line type you have created. -
Can we draw multiple lines on a single CAShapeLayer?
I want to draw multiple lines on a single layer of CAShapeLayer by UITouch. Is it possible?
if they use the same appleID then you can do it at www.icloud.com
-
How to draw a line in smartforms!
Hello ABAPers,
In smartform, I am having a table. Every 3 rows I want to draw a line. How can I do that in Smartforms?
Thanks,hi Naren,
Check these links out
drawing line in smartforms
Re: Smartforms - Line Height
Re: smartforms blank line
Regards,
Santosh -
Here are my last 3 duke dollars. Can someone please help me draw a line?
I have been BEATING my head on this for well over a week now. I'm new to Java2D and I cannot find even one example of this simple little thing that I am trying to do. Not one.
All I want to do is draw an image, zoom that image, then draw some lines on that image, and then zoom it and have those lines show up where they should.
For example, we have an image which has been zoomed. No lines are yet drawn on it.
A line is added.
The image is then zoomed in or out one more time.
How do we get the line to remap to the newly zoomed image?
What I am doing is:
0) Load up an image from a file.
1) Create a zoomed image by using the Image.getScaledInstance() method.
2) Create a BufferedImage with the width and height of the image AFTER the zoom has taken place.
3) Create a Graphics2D object by the createGraphics from this BufferedImage.
4) Place the image into the BufferedImage by doing a BufferedImage.drawImage
5) Select two points to be the start and end of the line.
6) Draw the line using Graphics2D.drawLine(start.x, start.y, end.x, end.y).
7) Zoom the image again (using the Image.getScaledInstance() method.
8) Create a new ImageIcon using the image from above and override its paintIcon method like this:
ImageIcon newIcon = new ImageIcon(newImage) {
public void paintIcon(Component c, Graphics g, int x, int y)
super.paintIcon(c, g, x, y);
zoom(); //<---- ZOOM call
Now in the zoom routine, what do I need to do to get the lines to draw at the proper location and size?
Remember, the points of the lines (stored in a list as home grown line objects) are in screen coordinates, not image coordinates since they are just click points
Note that when I use these points to draw a line, all is well (the line gets drawn where it should), but I have problems when I zoom the image.
Thanks!Below is the documentation and method signature of
Graphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer);The important thing to note is that it does scaling on the fly if the size dictated by the source co-ordinates is defferent than the size dictated by the destination co-ordinates. The source image is always left un-touched.
So basically your visual data is located in an offscreen image. You can draw a line on that. Then create a new image, get it's graphics and call drawImage(original_image, co-ordinates that cause it to scale how you like).
Then you can draw lines on the 2nd image, create a 3rd, ...etc
* Draws as much of the specified area of the specified image as is
* currently available, scaling it on the fly to fit inside the
* specified area of the destination drawable surface. Transparent pixels
* do not affect whatever pixels are already there.
* <p>
* This method returns immediately in all cases, even if the
* image area to be drawn has not yet been scaled, dithered, and converted
* for the current output device.
* If the current output representation is not yet complete then
* <code>drawImage</code> returns <code>false</code>. As more of
* the image becomes available, the process that draws the image notifies
* the specified image observer.
* <p>
* This method always uses the unscaled version of the image
* to render the scaled rectangle and performs the required
* scaling on the fly. It does not use a cached, scaled version
* of the image for this operation. Scaling of the image from source
* to destination is performed such that the first coordinate
* of the source rectangle is mapped to the first coordinate of
* the destination rectangle, and the second source coordinate is
* mapped to the second destination coordinate. The subimage is
* scaled and flipped as needed to preserve those mappings.
* @param img the specified image to be drawn
* @param dx1 the <i>x</i> coordinate of the first corner of the
* destination rectangle.
* @param dy1 the <i>y</i> coordinate of the first corner of the
* destination rectangle.
* @param dx2 the <i>x</i> coordinate of the second corner of the
* destination rectangle.
* @param dy2 the <i>y</i> coordinate of the second corner of the
* destination rectangle.
* @param sx1 the <i>x</i> coordinate of the first corner of the
* source rectangle.
* @param sy1 the <i>y</i> coordinate of the first corner of the
* source rectangle.
* @param sx2 the <i>x</i> coordinate of the second corner of the
* source rectangle.
* @param sy2 the <i>y</i> coordinate of the second corner of the
* source rectangle.
* @param observer object to be notified as more of the image is
* scaled and converted.
* @return <code>true</code> if the current output representation
* is complete; <code>false</code> otherwise.
* @see java.awt.Image
* @see java.awt.image.ImageObserver
* @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
* @since JDK1.1
public abstract boolean drawImage(Image img,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
ImageObserver observer); -
How to draw horizontal line at the end of table for multiple line items
Dear Experts,
Pls can anyone help me how to draw horizontal line at the end of table for multiple line items . kindly help me regarding this
Thanks
Ramesh ManoharanHi
I tried as per your logic but it is not solving my problem . when i am gone to table painter it is showing line type 1 and line type 2
is below format.. if u see here line type 1 bottom line and line type 2 top line both are same.. so how to avoid this ?
line type 1
line type 2 -
Problem in drawing a line in Java Application Program
Hi,
I am trying to draw a line after a message is displayed on the screen. But the line is not at all coming on the screen while running. but I can see a red line is appearing on the screen first and and it is getting overridden.
There is something wrong in the concept what I understood about graphics.Can anybody help to
understand where the problem is ?
Here is the part of the code which used to draw line.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import java.io.*;
import java.sql.*;
import java.util.*;
import java.util.Date.*;
import java.text.*;
import java.lang.*;
import MyPack.*;
class chalan_pay extends JFrame
JTextField jt1,jt2,jt3,jt4,jt5;
JLabel jlh,jl1,jl2,jl3,jl4,jl5,jl10;
JButton bt1,bt2,bt3;
Choice ch1,ch2,ch3,ch4;
Connection con = null;
int i1no,i2no,i3no,i4no,itno;
String idate;
public chalan_pay()
getContentPane().setLayout(null);
jt1= new JTextField(5);
jt1.setBounds(110,150,50,20);
jt2= new JTextField(10);
jt2.setBounds(400,150,100,20);
jt3= new JTextField(3);
jt3.setBounds(590,150,30,20);
jt4= new JTextField(2);
jt4.setBounds(750,150,30,20);
jlh= new JLabel();
jlh.setText("CHALLAN DETAILS");
jlh.setBounds(300,50,200,20);
jl1= new JLabel();
jl1.setText("IGM No. ");
jl1.setBounds(50,150,100,20);
jl2= new JLabel();
jl2.setText("IGM Date ");
jl2.setBounds(340,150,100,20);
jl3= new JLabel();
jl3.setText("Line No. ");
jl3.setBounds(530,150,100,20);
jl4= new JLabel();
jl4.setText("Subline No. ");
jl4.setBounds(680,150,100,20);
jl10= new JLabel();
jl10.setBounds(100,200,300,20);
ch1= new Choice();
ch1.setBounds(170,150,150,20);
getContentPane().add(ch1);
ch1.addItemListener(new Opt1());
bt1= new JButton("Exit");
bt1.setBounds(200,600,100,20);
getContentPane().add(bt1);
bt1.addActionListener(new Ex());
try
con=db_connect.getConnection();
Statement st1 = con.createStatement();
ResultSet rs1 = st1.executeQuery("select igm_no,to_char(igm_dt,'DD-MON-YY'),line_no,subline_no from "+
"det_item order by igm_no");
while(rs1.next())
ch1.addItem(String.valueOf(rs1.getInt(1))+" "+rs1.getString(2)+" "+
String.valueOf(rs1.getInt(3))+" "+String.valueOf(rs1.getInt(4)));
rs1.close();
st1.close();
catch(Exception e){e.printStackTrace();}
getContentPane().add(jlh);
getContentPane().add(jl1);
getContentPane().add(jt1);
getContentPane().add(jl2);
getContentPane().add(jt2);
getContentPane().add(jl3);
getContentPane().add(jt3);
getContentPane().add(jl4);
getContentPane().add(jt4);
getContentPane().add(jl10);
setSize(900,700);
setVisible(true);
show();
public void paint(Graphics g)
g.setColor(Color.red);
g.drawLine(0,300,600,300);
class Ex implements ActionListener
public void actionPerformed(ActionEvent evt)
if(evt.getSource() == bt1)
dispose();
return;
This code is incomplete. The program is compiled and Ran. I am unable to see the Line.
Is it because , I am using contentPane ?. Please help me to cake it clear.
mjavaI have no idea what JTutor is, but if it tells you to override paint() in Swing, it's not worth its disk space.
[http://java.sun.com/docs/books/tutorial/uiswing/painting/closer.html] clearly says that for all practical purposes paintComponent will be the only method that you will ever need to override. -
It's simple... I want the Illustrator pen tool to ALWAYS make corner annchor points and NEVER smooth. Right now I have to convert every single one of them, or I have to do a work around every time I draw a line and make one of the handles disappear. Is there some simple setting out there that will just "make it so?"@
The video I am watching this guy is just dragging every line to make curves. And every anchor point is a corner. He is not switching back and forth between the pen and the anchor points tool, and he is not using the convert points tool. He draws a curved line and starts another straight line only to curve it with a click and a drag. It is super efficient, and I could save a world of time if I could figure out what he is doing.
-
Drawing dashed line or dotted line in a flex line chart
Friends,
I want to draw a line chart which should be either dotted or dashed.
since there is no component like dashed line chart, can anyone help me in creating one.
i think if i extend the line series component, then i can draw that.
but am stuck there. pls help people.
Regards,
AnoopTry looking [url http://www.macdevcenter.com/pub/a/mac/2002/03/22/vertical_text.html]here.
: jay -
How can i use this library to draw squiggly line below word for RichEditable?
Squiggly Release Notes:
AdobeSpellingFramework.swc
A class that facilitates the drawing of squiggly lines below words for various text components.
Im not using squiggly spell check egine bcause it is not supporting arabic language.
Rest of the work i have completed, i just want to draw squiggly lines below word.
Please help me.....ThanksDid you ever get an answer for this ?
-
How to draw a line on ADF page between two nodes for mapping.
Hi everyone,
Does anyone have a solution that how can I wiring two points by drawing a line on ADF pages.
My scenario is user want to do a mapping between two xml files. We will build an ADF faces page. This page have two parts, left part contains one tree(base on the source xml), right part is the destination tree(target xml). User can drag an node from left and drop to right. Meantime, a line will be created to connect two node, it would be perfect that when user scroll down the page, or extend the tree node, the line between source and target will be remain connection two node.
Does anyone have a solution for this, thanks in advance.
Hongfu.so you want to do something like. xsl mapper in soa
http://www.haertfelder.com/images/pSoaBPEL3.png
i can think of using javascript.. not sure... neeed extra programming.. -
Drawing 2d line chart problem, urgent please!!!
Hello,
can anyone help me with the function GRAPH_MATRIX_2D please,
i couldn't draw a line graph with three data series, i mean with three lines in the graph.
i want to the chart to be drawn as line graph at the beginning, i shouldn't have to change the chart type later,
can anybody send me a sample code that does what i want.
i am expecting your answers,
thanks.Hi,
have you checked the two reports Matthias mentioned?
After downloading the SAP Chart Designer the general procedure should look like: create your chart settings interactively using the designer. Save these settings as a local XML file. Use this XML in your ABAP application and additionally create a data XML at runtime (the format is described in the pdf of the SAP Chart Designer zip).
Regards, Kai
PS: Please don't use these very outdated function modules graph_matrix* / grstat* in new projects! -
Drawing preloader line with AS?
Hello
I have the following AS (2) in a preloader (which works - in
the sense that it loads the next page):
The preloader should have a coloured line which runs from
left to right about 0.25px thick.
Whenever I have tried to draw the line using a pencil, it
appears too thick, or uneven, or even goes from right to left.
I have noticed that if I occasionally delete efforts I do not
like, even the next page fails to load.
What I am asking here is if it would be possible to draw the
line in AS?
Thanks for any useful advice.
SteveHello Devendran
Many thanks for your post.
So I would use something like:
lineStyle( 1, 0xBDA0F2, 100 );
moveTo( x1, y1 );
lineTo( x2,y2 );
But how would I incorporate that into my current Preloader AS
(2)?
Many thanks.
Steve -
Hi
how can I draw a line connecting top of each line series in
the chart with multiple axis. Screenshot link below.
ScreenshotYou could use the DataDrawingCanvas component found on
www.quietlyscheming.com
just make sure you get the source download for the DDC and
The bulk download from the site
There are some components needed by the DDC
Maybe you are looking for
-
AEDTM + UNAME not filled via HRMD_A inbound idoc
Sorry if this is the wrong forum but I couldn't find any forum related to IDocs. I have an inbound idoc: message type: HRMD_A basic type: ZHRMD_A0701 Processing the idoc is working, however, AEDTM and UNAME isn't filled (the fileds are empty). I woul
-
Details on new features in SP14
Hi, Does anyone know where I can find a list / overview of the new features in XI in SP14 ? Thanks Manish
-
This serial number does not qualify - try another
I just received my Adobe Photoshop CS5 Extended and trie to install it. I entered the serial number from my CS 3 Photoshop Extended and received the "This serial number does not qualify". Photoshop CS3 was part of the Design Premium bundle, but I r
-
Title error after direct download: "Book Title"
I recently created a series of ePubs using iBooks Author for a client. They are currently distributing the .ibooks file through a direct download link before publishing through the ibooks store. The issue is when the user downloads the .ibook file to
-
hi can i use the java mail api as it is here in webdynpro if u have any code regarding this plz send it to me